Skip to content

Instantly share code, notes, and snippets.

@swr1bm86
Forked from egonSchiele/reader.hs
Last active August 29, 2015 14:23
Show Gist options
  • Save swr1bm86/9853eb749568858351e0 to your computer and use it in GitHub Desktop.
Save swr1bm86/9853eb749568858351e0 to your computer and use it in GitHub Desktop.
import Control.Monad.Reader
hello :: Reader String String
hello = do
name <- ask
return ("hello, " ++ name ++ "!")
bye :: Reader String String
bye = do
name <- ask
return ("bye, " ++ name ++ "!")
convo :: Reader String String
convo = do
c1 <- hello
c2 <- bye
return $ c1 ++ c2
main = print . runReader convo $ "adit"
@swr1bm86
Copy link
Author

reader monad just to pass single config to all the functions that dependent on that config option

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