Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Change mappend for CommaTracker to be a bit lazier

  • Loading branch information...
commit f9873e1c98a6b2096b8e115727d9040b68c37765 1 parent 3e314ec
Leon P Smith authored June 08, 2011

Showing 1 changed file with 5 additions and 4 deletions. Show diff stats Hide diff stats

  1. 9  src/Data/Json/Builder/Internal.hs
9  src/Data/Json/Builder/Internal.hs
@@ -106,7 +106,8 @@ data CommaMonoid
106 106
 
107 107
 instance Monoid CommaMonoid where
108 108
   mempty = Empty
109  
-  mappend Empty y = y
110  
-  mappend x Empty = x
111  
-  mappend (Comma a) (Comma b)
112  
-        = Comma (a ++ fromChar ',' ++ b)
  109
+  mappend Empty     x = x
  110
+  mappend (Comma a) x
  111
+        = Comma (a ++ case x of
  112
+                        Empty   -> mempty
  113
+                        Comma b -> fromChar ',' ++ b)

0 notes on commit f9873e1

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