Use aeson's Day instance
This commit is contained in:
parent
162f5bbd9c
commit
afc0f31f91
2 changed files with 1 additions and 6 deletions
|
@ -21,7 +21,7 @@ executable tutorial
|
|||
main-is: tutorial.hs
|
||||
other-modules: T1, T2, T3, T4, T5, T6, T7, T8, T9, T10
|
||||
build-depends:
|
||||
aeson >= 0.8
|
||||
aeson >= 0.10
|
||||
, base >= 4.7 && < 5
|
||||
, bytestring
|
||||
, directory
|
||||
|
|
|
@ -17,11 +17,6 @@ data User = User
|
|||
, registration_date :: Day
|
||||
} 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
|
||||
|
||||
type UserAPI = "users" :> Get '[JSON] [User]
|
||||
|
|
Loading…
Reference in a new issue