Skip to content

Commit db6c23e

Browse files
authored
Merge pull request #954 from haskell-works/newhoggy/make-series-more-lazy
Make Series more lazy
2 parents 53eadf5 + 6e21829 commit db6c23e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/Data/Aeson/Encoding/Internal.hs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,10 @@ unsafePairSBS k v = Value $ retagEncoding $ Encoding (B.shortByteString k) >< v
158158
{-# INLINE unsafePairSBS #-}
159159

160160
instance Semigroup Series where
161-
Empty <> a = a
162-
a <> Empty = a
163-
Value a <> Value b = Value (a >< comma >< b)
161+
Empty <> a = a
162+
Value a <> b = Value $ a >< case b of
163+
Empty -> empty
164+
Value x -> comma >< x
164165

165166
instance Monoid Series where
166167
mempty = Empty

0 commit comments

Comments
 (0)