Use aeson's Day instance

This commit is contained in:
Julian K. Arni 2015-09-23 11:58:02 +02:00
parent 162f5bbd9c
commit afc0f31f91
2 changed files with 1 additions and 6 deletions

View file

@ -21,7 +21,7 @@ executable tutorial
main-is: tutorial.hs main-is: tutorial.hs
other-modules: T1, T2, T3, T4, T5, T6, T7, T8, T9, T10 other-modules: T1, T2, T3, T4, T5, T6, T7, T8, T9, T10
build-depends: build-depends:
aeson >= 0.8 aeson >= 0.10
, base >= 4.7 && < 5 , base >= 4.7 && < 5
, bytestring , bytestring
, directory , directory

View file

@ -17,11 +17,6 @@ data User = User
, registration_date :: Day , registration_date :: Day
} deriving (Eq, Show, Generic) } deriving (Eq, Show, Generic)
-- orphan ToJSON instance for Day. necessary to derive one for User
instance ToJSON Day where
-- display a day in YYYY-mm-dd format
toJSON d = toJSON (showGregorian d)
instance ToJSON User instance ToJSON User
type UserAPI = "users" :> Get '[JSON] [User] type UserAPI = "users" :> Get '[JSON] [User]