ToyLib is my Haskell library for solving AtCoder problems. Note that most of the contents has been ported into the Extra module of ac-library-hs.
toy-lib-exe is the source file bunlder.
Generate a template that bundles all the source files:
$ cabal run toy-lib-exe > template.hsMinify the toy-lib modules and their dependencies into one line:
$ cabal run toy-lib-exe -m Data.Graph.Sparse Data.UnionFind.MutableEmbed 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)As of 2025, AtCoder is using GHC 9.8.4 (Source: 使用できる言語とライブラリの一覧). Install GHC 9.8.4 and the corresponding tools with ghcup.
If you're a Nix Flakes user, run direnv allow to enable nix-direnv.
No explicit exports are assumed, as they're bundled into one file (Main.hs):
ghc-options:
- -Wno-missing-export-listsWe're using Haskell2010 because haskell-src-exts (the parser) does not understand GHC2021, but all the extensions enabled by GHC20210 are enabled via default-extensisons:
default-language: Haskell2010
default-extensions:
- BangPatterns
# and lots moreWe have limitations coming from haskell-src-exts:
-
Can't use
MultiWayIf
haskell-src-extsdoes not understand it well. -
Can't use
GHC2021syntax
For exampleimport X qualified as Yis not available.
See the Justfile for details. Otherwise, you could run the following commands manually.
Run doctest via REPL:
$ cabal repl --with-ghc=doctest --repl-options='-w -Wdefault'Run haddock from command line:
$ cabal haddock
$ cabal haddock --open- cojna/iota iota is surely the best resource!
- meooow25/haccepted Beautiful library compatible with Codeforces.
- minoki/my-atcoder-solutions Solutions to EDPC and more.
- unnohideyuki/AtHaskell
- mizunashi-mana/haskell-atcoder-template