on master help sign in
Add standard instances to ease debugging
6286541Bryan O'Sullivan
Data/Aeson/Types/Internal.hs+15−1
@@ -1,4 +1,5 @@
1−{-# LANGUAGE DeriveDataTypeable, GeneralizedNewtypeDeriving, Rank2Types #-}
1+{-# LANGUAGE DeriveDataTypeable, GeneralizedNewtypeDeriving, Rank2Types,
2+ RecordWildCards #-}
2
3
3-- |
4-- |
4-- Module: Data.Aeson.Types.Internal
5-- Module: Data.Aeson.Types.Internal
@@ -377,6 +378,18 @@ data Options = Options
377 -- field, like a newtype.
378 -- field, like a newtype.
378 }
379 }
379
380
381+instance Show Options where
382+ show Options{..} = "Options {" ++
383+ "fieldLabelModifier =~ " ++
384+ show (fieldLabelModifier "exampleField") ++ ", " ++
385+ "constructorTagModifier =~ " ++
386+ show (constructorTagModifier "ExampleConstructor") ++ ", " ++
387+ "allNullaryToStringTag = " ++ show allNullaryToStringTag ++ ", " ++
388+ "omitNothingFields = " ++ show omitNothingFields ++ ", " ++
389+ "sumEncoding = " ++ show sumEncoding ++ ", " ++
390+ "unwrapUnaryRecords = " ++ show unwrapUnaryRecords ++
391+ "}"
392+
380-- | Specifies how to encode constructors of a sum datatype.
393-- | Specifies how to encode constructors of a sum datatype.
381data SumEncoding =
394data SumEncoding =
382 TaggedObject { tagFieldName :: String
395 TaggedObject { tagFieldName :: String
@@ -401,6 +414,7 @@ data SumEncoding =
401 -- first element is the tag of the constructor (modified by the
414 -- first element is the tag of the constructor (modified by the
402 -- 'constructorTagModifier') and the second element the encoded
415 -- 'constructorTagModifier') and the second element the encoded
403 -- contents of the constructor.
416 -- contents of the constructor.
417+ deriving (Eq, Show)
404
418
405-- | Default encoding 'Options':
419-- | Default encoding 'Options':
406--
420--