Skip to content

Commit 2619e30

Browse files
committed
Formatting
1 parent 1538a1c commit 2619e30

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

src/Data/Argonaut/Decode/Class.purs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,12 @@ decodeJArray = maybe (Left "Value is not an Array") Right <<< toArray
101101
decodeJObject :: Json -> Either String (FO.Object Json)
102102
decodeJObject = maybe (Left "Value is not an Object") Right <<< toObject
103103

104+
instance decodeRecord
105+
:: ( GDecodeJson row list
106+
, RL.RowToList row list
107+
)
108+
=> DecodeJson (Record row) where
104109

105-
instance decodeRecord :: (GDecodeJson row list, RL.RowToList row list) => DecodeJson (Record row) where
106110
decodeJson json =
107111
case toObject json of
108112
Just object -> gDecodeJson object (RLProxy :: RLProxy list)
@@ -122,13 +126,13 @@ instance gDecodeJsonCons
122126
, Row.Lacks field rowTail
123127
)
124128
=> GDecodeJson row (RL.Cons field value tail) where
125-
129+
126130
gDecodeJson object _ = do
127131
let sProxy :: SProxy field
128132
sProxy = SProxy
129133

130134
fieldName = reflectSymbol sProxy
131-
135+
132136
rest <- gDecodeJson object (RLProxy :: RLProxy tail)
133137

134138
case FO.lookup fieldName object of
@@ -137,4 +141,4 @@ instance gDecodeJsonCons
137141
Right $ Record.insert sProxy val rest
138142

139143
Nothing ->
140-
Left $ "JSON was missing expected field: " <> fieldName
144+
Left $ "JSON was missing expected field: " <> fieldName

src/Data/Argonaut/Encode/Class.purs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,13 @@ instance encodeMap :: (Ord a, EncodeJson a, EncodeJson b) => EncodeJson (M.Map a
7676
instance encodeVoid :: EncodeJson Void where
7777
encodeJson = absurd
7878

79-
instance encodeRecord :: (GEncodeJson row list, RL.RowToList row list) => EncodeJson (Record row) where
80-
encodeJson rec = fromObject $ gEncodeJson rec (RLProxy :: RLProxy list)
79+
instance encodeRecord
80+
:: ( GEncodeJson row list
81+
, RL.RowToList row list
82+
)
83+
=> EncodeJson (Record row) where
8184

85+
encodeJson rec = fromObject $ gEncodeJson rec (RLProxy :: RLProxy list)
8286

8387
class GEncodeJson (row :: # Type) (list :: RL.RowList) where
8488
gEncodeJson :: Record row -> RLProxy list -> FO.Object Json
@@ -93,7 +97,7 @@ instance gEncodeJsonCons
9397
, Row.Cons field value tail' row
9498
)
9599
=> GEncodeJson row (RL.Cons field value tail) where
96-
100+
97101
gEncodeJson row _ =
98102
let
99103
sProxy :: SProxy field
@@ -102,4 +106,4 @@ instance gEncodeJsonCons
102106
FO.insert
103107
(reflectSymbol sProxy)
104108
(encodeJson $ Record.get sProxy row)
105-
(gEncodeJson row $ RLProxy :: RLProxy tail)
109+
(gEncodeJson row $ RLProxy :: RLProxy tail)

0 commit comments

Comments
 (0)