@@ -1,8 +1,4 @@
1−{-# LANGUAGE CPP, FlexibleContexts #-}
2−
3−#ifdef GENERICS
4−{-# LANGUAGE DefaultSignatures #-}
5−#endif
1+{-# LANGUAGE DefaultSignatures, FlexibleContexts #-}
62
73-- |
84-- Module: Data.Aeson.Types.Class
@@ -21,18 +17,14 @@ module Data.Aeson.Types.Class
2117 -- ** Core JSON classes
2218 FromJSON(..)
2319 , ToJSON(..)
24−#ifdef GENERICS
2520 -- ** Generic JSON classes
2621 , GFromJSON(..)
2722 , GToJSON(..)
2823 , genericToJSON
2924 , genericParseJSON
30−#endif
3125 ) where
3226
3327import Data.Aeson.Types.Internal
34−
35−#ifdef GENERICS
3628import GHC.Generics
3729
3830-- | Class of generic representation types ('Rep') that can be converted to JSON.
@@ -58,7 +50,6 @@ genericToJSON opts = gToJSON opts . from
5850-- type is an instance of 'Generic'.
5951genericParseJSON :: (Generic a, GFromJSON (Rep a)) => Options -> Value -> Parser a
6052genericParseJSON opts = fmap to . gParseJSON opts
61−#endif
6253
6354-- | A type that can be converted to JSON.
6455--
@@ -115,10 +106,8 @@ genericParseJSON opts = fmap to . gParseJSON opts
115106class ToJSON a where
116107 toJSON :: a -> Value
117108
118−#ifdef GENERICS
119109 default toJSON :: (Generic a, GToJSON (Rep a)) => a -> Value
120110 toJSON = genericToJSON defaultOptions
121−#endif
122111
123112-- | A type that can be converted from JSON, with the possibility of
124113-- failure.
@@ -188,7 +177,5 @@ class ToJSON a where
188177class FromJSON a where
189178 parseJSON :: Value -> Parser a
190179
191−#ifdef GENERICS
192180 default parseJSON :: (Generic a, GFromJSON (Rep a)) => Value -> Parser a
193181 parseJSON = genericParseJSON defaultOptions
194−#endif