diff options
author | Joe Crayne <joe@jerkface.net> | 2019-03-26 21:39:23 -0400 |
---|---|---|
committer | Joe Crayne <joe@jerkface.net> | 2019-03-26 21:39:23 -0400 |
commit | 3fe2aaee4abc51de1c4b92909bafdd88be49fd76 (patch) | |
tree | a0db519f391ca048db4db9016b3c9ba97893592c /haskell/Data/VCDIFF.hs | |
parent | 29105efba2db42dcce426a29a11539b3083ec356 (diff) |
Added Semigroup instance.haskell
Diffstat (limited to 'haskell/Data/VCDIFF.hs')
-rw-r--r-- | haskell/Data/VCDIFF.hs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/haskell/Data/VCDIFF.hs b/haskell/Data/VCDIFF.hs index fe4cc98..db75fb1 100644 --- a/haskell/Data/VCDIFF.hs +++ b/haskell/Data/VCDIFF.hs | |||
@@ -273,6 +273,9 @@ data Result x = Result | |||
273 | -- is an error code and message indicating what. | 273 | -- is an error code and message indicating what. |
274 | } deriving (Show,Functor) | 274 | } deriving (Show,Functor) |
275 | 275 | ||
276 | instance Semigroup x => Semigroup (Result x) where | ||
277 | Result x xe <> y = Result (x <> result y) (maybe (resultError y) Just xe) | ||
278 | |||
276 | instance Monoid x => Monoid (Result x) where | 279 | instance Monoid x => Monoid (Result x) where |
277 | mempty = Result mempty Nothing | 280 | mempty = Result mempty Nothing |
278 | mappend (Result x xe) y = Result (mappend x $ result y) (maybe (resultError y) Just xe) | 281 | mappend (Result x xe) y = Result (mappend x $ result y) (maybe (resultError y) Just xe) |