git.iko.soy/typeable/servant
on master help sign in
Use aeson's Day instance
commitafc0f31f913456418c8b89e2315e12f961ea3b85 authorJulian K. Arni <jkarni@gmail.com> dateWed 23 Sep 2015, 11:58 (11 years ago) parent162f5bb
2 files changed+1−6
servant-examples/servant-examples.cabal+1−1 servant-examples/tutorial/T2.hs−5
servant-examples/servant-examples.cabal+1−1
@@ -21,7 +21,7 @@ executable tutorial
2121 main-is: tutorial.hs
2222 other-modules: T1, T2, T3, T4, T5, T6, T7, T8, T9, T10
2323 build-depends:
24− aeson >= 0.8
24+ aeson >= 0.10
2525 , base >= 4.7 && < 5
2626 , bytestring
2727 , directory
servant-examples/tutorial/T2.hs−5
@@ -17,11 +17,6 @@ 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]