diff options
-rw-r--r-- | haskell/Data/VCDIFF.hs | 3 | ||||
-rw-r--r-- | haskell/Data/VCDIFF/Types.hsc | 3 |
2 files changed, 6 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) |
diff --git a/haskell/Data/VCDIFF/Types.hsc b/haskell/Data/VCDIFF/Types.hsc index 015f406..54237b8 100644 --- a/haskell/Data/VCDIFF/Types.hsc +++ b/haskell/Data/VCDIFF/Types.hsc | |||
@@ -167,6 +167,9 @@ pattern XD3_COMPLEVEL_3 = Flags (#const XD3_COMPLEVEL_3) | |||
167 | pattern XD3_COMPLEVEL_6 = Flags (#const XD3_COMPLEVEL_6) | 167 | pattern XD3_COMPLEVEL_6 = Flags (#const XD3_COMPLEVEL_6) |
168 | pattern XD3_COMPLEVEL_9 = Flags (#const XD3_COMPLEVEL_9) | 168 | pattern XD3_COMPLEVEL_9 = Flags (#const XD3_COMPLEVEL_9) |
169 | 169 | ||
170 | instance Semigroup Flags where | ||
171 | Flags a <> Flags b = Flags (a .|. b) | ||
172 | |||
170 | instance Monoid Flags where | 173 | instance Monoid Flags where |
171 | mempty = Flags 0 | 174 | mempty = Flags 0 |
172 | Flags a `mappend` Flags b = Flags (a .|. b) | 175 | Flags a `mappend` Flags b = Flags (a .|. b) |