Skip to content

Instantly share code, notes, and snippets.

@jdoiwork
Last active August 29, 2015 14:01
Show Gist options
  • Save jdoiwork/df2db5ad5d2cc2a00d92 to your computer and use it in GitHub Desktop.
Save jdoiwork/df2db5ad5d2cc2a00d92 to your computer and use it in GitHub Desktop.
{-# LANGUAGE RecordWildCards #-}
module Handler.Hoge where
import Import
-- ...
data Person = Person
{ name :: Text
, age :: Int
}
instance ToJSON Person where
toJSON Person {..} = object
[ "name" .= name
, "age" .= age
]
getPersonR :: Handler Value
getPersonR = returnJson $ [Person "Michael" 28]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment