File tree Expand file tree Collapse file tree 5 files changed +195
-183
lines changed Expand file tree Collapse file tree 5 files changed +195
-183
lines changed Original file line number Diff line number Diff line change @@ -60,6 +60,7 @@ module Data.Aeson
60
60
-- ** Generic JSON classes and options
61
61
, GFromJSON(..)
62
62
, GToJSON(..)
63
+ , GToEncoding(..)
63
64
, genericToJSON
64
65
, genericToEncoding
65
66
, genericParseJSON
Original file line number Diff line number Diff line change @@ -39,6 +39,7 @@ module Data.Aeson.Types
39
39
-- ** Generic JSON classes
40
40
, GFromJSON(..)
41
41
, GToJSON(..)
42
+ , GToEncoding(..)
42
43
, genericToJSON
43
44
, genericToEncoding
44
45
, genericParseJSON
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ module Data.Aeson.Types.Class
19
19
-- * Generic JSON classes
20
20
, GFromJSON(..)
21
21
, GToJSON(..)
22
+ , GToEncoding(..)
22
23
, genericToJSON
23
24
, genericToEncoding
24
25
, genericParseJSON
@@ -40,6 +41,9 @@ class GToJSON f where
40
41
-- default generic implementation of 'toJSON'.
41
42
gToJSON :: Options -> f a -> Value
42
43
44
+ -- | Class of generic representation types ('Rep') that can be converted to
45
+ -- a JSON 'Encoding'.
46
+ class GToEncoding f where
43
47
-- | This method (applied to 'defaultOptions') can be used as the
44
48
-- default generic implementation of 'toEncoding'.
45
49
gToEncoding :: Options -> f a -> Encoding
@@ -59,7 +63,7 @@ genericToJSON opts = gToJSON opts . from
59
63
-- | A configurable generic JSON encoder. This function applied to
60
64
-- 'defaultOptions' is used as the default for 'toEncoding' when the type
61
65
-- is an instance of 'Generic'.
62
- genericToEncoding :: (Generic a, GToJSON (Rep a)) => Options -> a -> Encoding
66
+ genericToEncoding :: (Generic a, GToEncoding (Rep a)) => Options -> a -> Encoding
63
67
genericToEncoding opts = gToEncoding opts . from
64
68
65
69
-- | A configurable generic JSON decoder. This function applied to
You can’t perform that action at this time.
0 commit comments