Created
August 14, 2015 07:41
-
-
Save fumieval/7cb288313c802a36740f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data Pos a = Rel !a | Abs !a deriving (Show, Read, Eq, Ord, Functor) | |
instance Num a => Monoid (Pos a) where | |
mempty = Rel 0 | |
_ `mappend` Abs a = Abs a | |
Abs a `mappend` Rel b = Abs (a + b) | |
Rel a `mappend` Rel b = Rel (a + b) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment