@@ -17,17 +17,12 @@ data User = User
17 , registration_date :: Day
17 , registration_date :: Day
18 } deriving (Eq, Show, Generic)
18 } deriving (Eq, Show, Generic)
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)
25instance ToJSON User
20instance ToJSON User
27type UserAPI = "users" :> Get '[JSON] [User]
22type UserAPI = "users" :> Get '[JSON] [User]
29users :: [User]
24users :: [User]
31 [ User "Isaac Newton" 372 "isaac@newton.co.uk" (fromGregorian 1683 3 1)
26 [ User "Isaac Newton" 372 "isaac@newton.co.uk" (fromGregorian 1683 3 1)
32 , User "Albert Einstein" 136 "ae@mc2.org" (fromGregorian 1905 12 1)
27 , User "Albert Einstein" 136 "ae@mc2.org" (fromGregorian 1905 12 1)