Skip to content

Commit 6e21829

Browse files
committed
Make Series more lazy
1 parent 53eadf5 commit 6e21829

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)