Skip to content
Browse files

Change mappend for CommaTracker to be a bit lazier

  • Loading branch information...
1 parent 3e314ec commit f9873e1c98a6b2096b8e115727d9040b68c37765 @lpsmith committed
Showing with 5 additions and 4 deletions.
  1. +5 −4 src/Data/Json/Builder/Internal.hs
View
9 src/Data/Json/Builder/Internal.hs
@@ -106,7 +106,8 @@ data CommaMonoid
instance Monoid CommaMonoid where
mempty = Empty
- mappend Empty y = y
- mappend x Empty = x
- mappend (Comma a) (Comma b)
- = Comma (a ++ fromChar ',' ++ b)
+ mappend Empty x = x
+ mappend (Comma a) x
+ = Comma (a ++ case x of
+ Empty -> mempty
+ Comma b -> fromChar ',' ++ b)

0 comments on commit f9873e1

Please sign in to comment.
Something went wrong with that request. Please try again.