Skip to content

Commit

Permalink
Change mappend for CommaTracker to be a bit lazier
Browse files Browse the repository at this point in the history
  • Loading branch information
lpsmith committed Jun 8, 2011
1 parent 3e314ec commit f9873e1
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/Data/Json/Builder/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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.