on master help sign in
Improved performance of generic toJSON of sums by a factor of 2

simply by writing the function in pointfree style.

commitaf385c48aa0eebb248c8dde9aaee27c05ae1f806 authorBas van Dijk <v.dijk.bas@gmail.com> dateThu 3 Nov 2011, 00:17 (15 years ago) parent8ba8f84
1 file changed+1−1
Data/Aeson/Types/Internal.hs+1−1
Data/Aeson/Types/Internal.hs+1−1
@@ -1014,7 +1014,7 @@ instance (GObject a, GObject b) => GObject (a :+: b) where
10141014 {-# INLINE gObject #-}
10151015
10161016instance (Constructor c, GToJSON a, ConsToJSON a) => GObject (C1 c a) where
1017− gObject m1 = M.singleton (pack (conName m1)) (gToJSON m1)
1017+ gObject = M.singleton (pack $ conName (undefined :: t c a p)) . gToJSON
10181018 {-# INLINE gObject #-}
10191019
10201020--------------------------------------------------------------------------------