Skip to content

Instantly share code, notes, and snippets.

@debasishg
Created December 28, 2010 12:56
Show Gist options
  • Save debasishg/757184 to your computer and use it in GitHub Desktop.
Save debasishg/757184 to your computer and use it in GitHub Desktop.
Sample use of a monad
-- example of a monadic operation
do s <- readFile f
writeFile g s
return s
-- gets translated to
readFile f >>= \s->
writeFile g s >>= \_->
return s
-- >>= does the sequencing and is called the "bind"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment