Commits

basvandijk committed b2204e1

Improved performance of generic toJSON of sums by a factor of 2
simply by writing the function in pointfree style.

Comments (0)

Files changed (1)

Data/Aeson/Types/Internal.hs

     {-# INLINE gObject #-}
 
 instance (Constructor c, GToJSON a, ConsToJSON a) => GObject (C1 c a) where
-    gObject m1 = M.singleton (pack (conName m1)) (gToJSON m1)
+    gObject = M.singleton (pack $ conName (undefined :: t c a p)) . gToJSON
     {-# INLINE gObject #-}
 
 --------------------------------------------------------------------------------