Skip to content

Instantly share code, notes, and snippets.

@TikhonJelvis
Created February 21, 2022 20:10
Show Gist options
  • Save TikhonJelvis/a22802af11a8b1171f5f587a40c67d50 to your computer and use it in GitHub Desktop.
Save TikhonJelvis/a22802af11a8b1171f5f587a40c67d50 to your computer and use it in GitHub Desktop.
Haskell to-do list with BlockArguments and Writer
list :: [Task Text]
list = to do
(□) "milk"
(□) "eggs"
(✓) "orange juice"
data Task a = Done a | Todo a deriving (Show)
to = execWriter
(✓) task = tell [Done task]
@naldoco
Copy link

naldoco commented Feb 23, 2022

naldoco@mm todo $ stack exec -- ghci src/Todo.hs test/TodoSpec.hs
GHCi, version 8.10.7: https://www.haskell.org/ghc/ :? for help
Loaded GHCi configuration from /home/naldoco/.ghc/ghci.conf
[1 of 2] Compiling Todo ( src/Todo.hs, interpreted )
[2 of 2] Compiling TodoSpec ( test/TodoSpec.hs, interpreted )
Ok, two modules loaded.
: list
[Todo "milk",Todo "eggs",Done "orange juice"]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment