git.iko.soy/typeable/servant
on master help sign in
aeson-0.10.0.0 fixes
cd395a2Simon Hengel
servant-examples/tutorial/T1.hs+3
@@ -1,3 +1,4 @@
1+{-# LANGUAGE CPP #-}
1{-# LANGUAGE DataKinds #-}
2{-# LANGUAGE DataKinds #-}
2{-# LANGUAGE DeriveGeneric #-}
3{-# LANGUAGE DeriveGeneric #-}
3{-# LANGUAGE TypeFamilies #-}
4{-# LANGUAGE TypeFamilies #-}
@@ -17,10 +18,12 @@ data User = User
17 , registration_date :: Day
18 , registration_date :: Day
18 } deriving (Eq, Show, Generic)
19 } deriving (Eq, Show, Generic)
19
20
21+#if !MIN_VERSION_aeson(0,10,0)
20-- orphan ToJSON instance for Day. necessary to derive one for User
22-- orphan ToJSON instance for Day. necessary to derive one for User
21instance ToJSON Day where
23instance ToJSON Day where
22 -- display a day in YYYY-mm-dd format
24 -- display a day in YYYY-mm-dd format
23 toJSON d = toJSON (showGregorian d)
25 toJSON d = toJSON (showGregorian d)
26+#endif
24
27
25instance ToJSON User
28instance ToJSON User
26
29
servant-examples/tutorial/T2.hs+3
@@ -1,3 +1,4 @@
1+{-# LANGUAGE CPP #-}
1{-# LANGUAGE DataKinds #-}
2{-# LANGUAGE DataKinds #-}
2{-# LANGUAGE DeriveGeneric #-}
3{-# LANGUAGE DeriveGeneric #-}
3{-# LANGUAGE TypeFamilies #-}
4{-# LANGUAGE TypeFamilies #-}
@@ -17,10 +18,12 @@ data User = User
17 , registration_date :: Day
18 , registration_date :: Day
18 } deriving (Eq, Show, Generic)
19 } deriving (Eq, Show, Generic)
19
20
21+#if !MIN_VERSION_aeson(0,10,0)
20-- orphan ToJSON instance for Day. necessary to derive one for User
22-- orphan ToJSON instance for Day. necessary to derive one for User
21instance ToJSON Day where
23instance ToJSON Day where
22 -- display a day in YYYY-mm-dd format
24 -- display a day in YYYY-mm-dd format
23 toJSON d = toJSON (showGregorian d)
25 toJSON d = toJSON (showGregorian d)
26+#endif
24
27
25instance ToJSON User
28instance ToJSON User
26
29