@@ -17,17 +17,12 @@ data User = User
1717 , registration_date :: Day
1818 } deriving (Eq, Show, Generic)
1919
20−-- orphan ToJSON instance for Day. necessary to derive one for User
21−instance ToJSON Day where
22− -- display a day in YYYY-mm-dd format
23− toJSON d = toJSON (showGregorian d)
24−
2520instance ToJSON User
2621
2722type UserAPI = "users" :> Get '[JSON] [User]
2823
2924users :: [User]
30−users =
25+users =
3126 [ User "Isaac Newton" 372 "isaac@newton.co.uk" (fromGregorian 1683 3 1)
3227 , User "Albert Einstein" 136 "ae@mc2.org" (fromGregorian 1905 12 1)
3328 ]