Skip to content

Commit

Permalink
Using coerce instead of getters
Browse files Browse the repository at this point in the history
  • Loading branch information
AliceRixte committed Jun 6, 2024
1 parent afe5ae3 commit e37d60e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/Data/Aeson/Types/ToJSON.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2122,14 +2122,14 @@ instance ToJSON a => ToJSON (Monoid.Product a) where
omitField = omitField1

instance ToJSON Monoid.All where
toJSON = toJSON . Monoid.getAll
toEncoding = toEncoding . Monoid.getAll
omitField = omitField . Monoid.getAll
toJSON = (toJSON :: Bool -> Value) . coerce
toEncoding = (toEncoding :: Bool -> Encoding) . coerce
omitField = (omitField :: Bool -> Bool) . coerce

instance ToJSON Monoid.Any where
toJSON = toJSON . Monoid.getAny
toEncoding = toEncoding . Monoid.getAny
omitField = omitField . Monoid.getAny
toJSON = (toJSON :: Bool -> Value) . coerce
toEncoding = (toEncoding :: Bool -> Encoding) . coerce
omitField = (omitField :: Bool -> Bool) . coerce

instance ToJSON1 Monoid.First where
liftToJSON o t to' = liftToJSON o t to' . Monoid.getFirst
Expand Down

0 comments on commit e37d60e

Please sign in to comment.