Created
July 7, 2017 23:19
-
-
Save jmikkola/ae7e665f0091df14d8b104c6a373b240 to your computer and use it in GitHub Desktop.
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
{-# LANGUAGE DeriveFunctor #-} | |
import Control.Monad.Free | |
data MThing next | |
= MItem String next | |
| MEnd | |
deriving (Show, Functor) | |
doThing :: Free MThing () | |
doThing = do | |
mitem "foo" | |
mitem "bar" | |
stop | |
mitem :: String -> Free MThing () | |
mitem s = Free (MItem s (Pure ())) | |
stop :: Free MThing () | |
stop = Free MEnd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment