diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2016-01-09 23:27:15 +0000 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2016-01-09 23:27:15 +0000 |
commit | 3d0621a8747a4977f6f8bc72e8a11386c7cb2e73 (patch) | |
tree | 1172a3cc57c31256404086454c5498ba9aa9f326 /spec/src | |
parent | 44e4f33ad94045e3a91734b90cea83fe8c37ba65 (diff) | |
download | thermoprint-3d0621a8747a4977f6f8bc72e8a11386c7cb2e73.tar thermoprint-3d0621a8747a4977f6f8bc72e8a11386c7cb2e73.tar.gz thermoprint-3d0621a8747a4977f6f8bc72e8a11386c7cb2e73.tar.bz2 thermoprint-3d0621a8747a4977f6f8bc72e8a11386c7cb2e73.tar.xz thermoprint-3d0621a8747a4977f6f8bc72e8a11386c7cb2e73.zip |
Cleanup up monoid instances
Diffstat (limited to 'spec/src')
-rw-r--r-- | spec/src/Thermoprint/Printout.hs | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/spec/src/Thermoprint/Printout.hs b/spec/src/Thermoprint/Printout.hs index 23e950a..c96573e 100644 --- a/spec/src/Thermoprint/Printout.hs +++ b/spec/src/Thermoprint/Printout.hs | |||
@@ -83,8 +83,12 @@ instance Monoid Block where | |||
83 | | Seq.null xs = y | 83 | | Seq.null xs = y |
84 | | Seq.null ys = x | 84 | | Seq.null ys = x |
85 | | otherwise = NewlSep (xs <> ys) | 85 | | otherwise = NewlSep (xs <> ys) |
86 | (NewlSep xs) `mappend` y = NewlSep (xs |> y) | 86 | (NewlSep xs) `mappend` y |
87 | x `mappend` (NewlSep ys) = NewlSep (x <| ys) | 87 | | Seq.null xs = y |
88 | | otherwise = NewlSep (xs |> y) | ||
89 | x `mappend` (NewlSep ys) | ||
90 | | Seq.null ys = x | ||
91 | | otherwise = NewlSep (x <| ys) | ||
88 | x `mappend` y = NewlSep $ Seq.fromList [x, y] | 92 | x `mappend` y = NewlSep $ Seq.fromList [x, y] |
89 | 93 | ||
90 | instance Monoid Line where | 94 | instance Monoid Line where |
@@ -93,8 +97,12 @@ instance Monoid Line where | |||
93 | | Seq.null xs = y | 97 | | Seq.null xs = y |
94 | | Seq.null ys = x | 98 | | Seq.null ys = x |
95 | | otherwise = SpaceSep (xs <> ys) | 99 | | otherwise = SpaceSep (xs <> ys) |
96 | (SpaceSep xs) `mappend` y = SpaceSep (xs |> y) | 100 | (SpaceSep xs) `mappend` y |
97 | x `mappend` (SpaceSep ys) = SpaceSep (x <| ys) | 101 | | Seq.null xs = y |
102 | | otherwise = SpaceSep (xs |> y) | ||
103 | x `mappend` (SpaceSep ys) | ||
104 | | Seq.null ys = x | ||
105 | | otherwise = SpaceSep (x <| ys) | ||
98 | x `mappend` y = SpaceSep $ Seq.fromList [x, y] | 106 | x `mappend` y = SpaceSep $ Seq.fromList [x, y] |
99 | 107 | ||
100 | 108 | ||