Skip to content

Instantly share code, notes, and snippets.

@pseudonom
Last active December 16, 2015 16:41
Show Gist options
  • Select an option

  • Save pseudonom/5685fc6045a83aeafbaf to your computer and use it in GitHub Desktop.

Select an option

Save pseudonom/5685fc6045a83aeafbaf to your computer and use it in GitHub Desktop.
Example of Yesod handler composition
getUsersR' :: Handler [User]
getUsersR' =
return
[ User 1 "Isaac" "Newton"
, User 2 "Albert" "Einstein"
]
getUsersR :: Handler Value
getUsersR = toJSON <$> getUsersR'
getFirstUserR' :: Handler User
getFirstUserR' = head <$> getUsersR'
getFirstUserR :: Handler Value
getFirstUserR = toJSON <$> getFirstUserR'
-- https://github.com/frontrowed/blog-yesod
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment