on master help sign in
Fix #290: Remove MINIMAL pragma for toJSON
f3fce24Bas van Dijk
Data/Aeson/Types/Class.hs+6−1
@@ -135,7 +135,12 @@ genericParseJSON opts = fmap to . gParseJSON opts
135class ToJSON a where
135class ToJSON a where
136 -- | Convert a Haskell value to a JSON-friendly intermediate type.
136 -- | Convert a Haskell value to a JSON-friendly intermediate type.
137 toJSON :: a -> Value
137 toJSON :: a -> Value
138+
139+ -- TODO: We would like to set the MINIMAL pragma for toJSON but then
140+ -- instances which are using the default Generic implementation will
141+ -- complain that toJSON is not defined.
142+ -- See GHC bug: https://ghc.haskell.org/trac/ghc/ticket/10959
138− {-# MINIMAL toJSON #-}
143+ -- {-# MINIMAL toJSON -- #-}
139
144
140 default toJSON :: (Generic a, GToJSON (Rep a)) => a -> Value
145 default toJSON :: (Generic a, GToJSON (Rep a)) => a -> Value
141 toJSON = genericToJSON defaultOptions
146 toJSON = genericToJSON defaultOptions