Skip to content

toyboot4e/toy-lib

Repository files navigation

ToyLib

ToyLib is my Haskell library for solving AtCoder problems.

Documentation

CLI

toy-lib-exe is the source file bunlder.

Usage

Generate a template that bundles all the source files:

$ cabal run toy-lib-exe > template.hs

Minify the toy-lib modules and their dependencies into one line:

$ cabal run toy-lib-exe -m Data.Graph.Sparse Data.UnionFind.Mutable

Embed toy-lib modules:

$ cat Example.hs
-- {{{ toy-lib import
import Math.Manhattan
-- }}} toy-lib import

$ cabal run toy-lib-exe -e Examle.hs
rot45 :: (Int, Int) -> (Int, Int);rot45 (!x, !y) = (x - y, x + y)

Project setting notes

Installation

toy-lib.cabal

No exports are assumed, as they're bundled into one file (Main.hs):

ghc-options:
- -Wno-missing-export-lists

We're using Haskell2010 because haskell-src-exts (the parser) does not understand GHC2021, but all the extensions enabled by it are enabled as default-extensisons:

default-language: Haskell2010

default-extensions:
- BangPatterns
# and lots more

doctest

Run doctest via REPL:

$ cabal repl --with-ghc=doctest --repl-options='-w -Wdefault'

haddock

Run haddock from command line:

$ cabal haddock
$ cabal haddock --open

Limitations

We have limitations coming from haskell-src-exts:

  • Can't use MultiWayIf
    haskell-src-exts does not understand it well.

  • Can't use GHC2021 syntax
    For example import X qualified as Y is not available.

Thanks

cojna/iota

About

My Haskell library for AtCoder contests

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published