Skip to content

Instantly share code, notes, and snippets.

@jmikkola
Created July 7, 2017 23:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jmikkola/ae7e665f0091df14d8b104c6a373b240 to your computer and use it in GitHub Desktop.
Save jmikkola/ae7e665f0091df14d8b104c6a373b240 to your computer and use it in GitHub Desktop.
{-# 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