Created
February 21, 2022 20:10
-
-
Save TikhonJelvis/a22802af11a8b1171f5f587a40c67d50 to your computer and use it in GitHub Desktop.
Haskell to-do list with BlockArguments and Writer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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"]