Last active
July 30, 2018 14:30
-
-
Save kylecorbelli/fcee9d74e1c74b5a3d26a55994e44d97 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
main :: IO () | |
main = | |
putStrLn "what is your email address?" >> | |
getLine >>= \email -> | |
putStrLn . show $ runReader view email | |
view :: Reader Email Html | |
view = | |
page >>= \page' -> | |
return $ div | |
[ page' | |
] | |
page :: Reader Email Html | |
page = | |
content >>= \content' -> | |
return $ div | |
[ topNav | |
, content' | |
] | |
topNav :: Html | |
topNav = | |
div | |
[ h1 [ "OurSite.com" ] | |
] | |
content :: Reader Email Html | |
content = | |
ask >>= \email -> | |
right >>= \right' -> | |
return $ div | |
[ h1 [ "Custom Content for " ++ email ] | |
, left | |
, right' | |
] | |
left :: Html | |
left = | |
div | |
[ p [ "this is the left side" ] | |
] | |
right :: Reader Email Html | |
right = | |
article >>= \article' -> | |
return $ div | |
[ article' | |
] | |
article :: Reader Email Html | |
article = | |
widget >>= \widget' -> | |
return $ div | |
[ p [ "this is an article" ] | |
, widget' | |
] | |
widget :: Reader Email Html | |
widget = | |
ask >>= \email -> | |
return $ div | |
[ p [ "Hey " ++ email ++ ", we've got a great offer for you!" ] | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment