on master help sign in
Move ToJSON to default signature in ToObject class

There is not need to have ToJSON as superclass because it is only used for default implementation.

commit39b04b03da3e64c5f357d87fb05d3566bffb9229 authorLeonid Onokhov <sopvop@gmail.com> dateMon 18 Jul 2016, 13:07 (10 years ago) parent8df79e3
1 file changed+3−1
katip/src/Katip/Core.hs+3−1
katip/src/Katip/Core.hs+3−1
@@ -1,4 +1,5 @@
11{-# LANGUAGE CPP #-}
2+{-# LANGUAGE DefaultSignatures #-}
23{-# LANGUAGE DeriveFunctor #-}
34{-# LANGUAGE DeriveGeneric #-}
45{-# LANGUAGE ExistentialQuantification #-}
@@ -367,8 +368,9 @@ instance Monoid PayloadSelection where
367368-- a ToJSON instance like:
368369--
369370-- > instance ToObject Foo
370−class ToJSON a => ToObject a where
371+class ToObject a where
371372 toObject :: a -> A.Object
373+ default toObject :: ToJSON a => a -> A.Object
372374 toObject v = case toJSON v of
373375 A.Object o -> o
374376 _ -> mempty