Skip to content

Instantly share code, notes, and snippets.

@pseudonom
Last active March 5, 2018 22:46
Show Gist options
  • Select an option

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

Select an option

Save pseudonom/bd231df7c62d2d4c7778 to your computer and use it in GitHub Desktop.
{-# LANGUAGE UndecidableInstances #-}
instance {-# OVERLAPPABLE #-} (ToJSON a) => ToContent a where
toContent = toContent . toJSON
instance {-# OVERLAPPABLE #-} (ToJSON a) => ToTypedContent a where
toTypedContent = TypedContent typeJson . toContent
getUsersR :: Handler [User]
getUsersR =
return
[ User 1 "Isaac" "Newton"
, User 2 "Albert" "Einstein"
]
getFirstUserR :: Handler User
getFirstUserR = head <$> getUsersR
-- https://github.com/frontrowed/blog-yesod
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment