From cd395a27e85c29f8a899d773df9e1a7114c22183 Mon Sep 17 00:00:00 2001 From: Simon Hengel Date: Thu, 5 Nov 2015 09:13:24 +0800 Subject: [PATCH] aeson-0.10.0.0 fixes --- servant-examples/tutorial/T1.hs | 3 +++ servant-examples/tutorial/T2.hs | 3 +++ 2 files changed, 6 insertions(+) diff --git a/servant-examples/tutorial/T1.hs b/servant-examples/tutorial/T1.hs index 491465ea..97bbecb8 100644 --- a/servant-examples/tutorial/T1.hs +++ b/servant-examples/tutorial/T1.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE TypeFamilies #-} @@ -17,10 +18,12 @@ data User = User , registration_date :: Day } deriving (Eq, Show, Generic) +#if !MIN_VERSION_aeson(0,10,0) -- 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) +#endif instance ToJSON User diff --git a/servant-examples/tutorial/T2.hs b/servant-examples/tutorial/T2.hs index 72aca76a..fc49d256 100644 --- a/servant-examples/tutorial/T2.hs +++ b/servant-examples/tutorial/T2.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE TypeFamilies #-} @@ -17,10 +18,12 @@ data User = User , registration_date :: Day } deriving (Eq, Show, Generic) +#if !MIN_VERSION_aeson(0,10,0) -- 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) +#endif instance ToJSON User