Last active
February 24, 2017 07:11
-
-
Save s9gf4ult/5e338a2fc69f63ba36002544b3cc1b1f 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
import Data.Time | |
class Diffable a where | |
type Diff a :: * | |
diff :: a -> a -> Diff a | |
addDiff :: Diff a -> a -> a | |
instance {-# OVERLAPPABLE #-} (Num a) => Diffable a where | |
type Diff a = a | |
diff = (-) | |
addDiff = (+) | |
instance Diffable UTCTime where | |
type Diff UTCTime = NominalDiffTime | |
diff = diffUTCTime | |
addDiff = addUTCTime | |
-- Conflicting family instance declarations: | |
-- Diff a -- Defined at src/Peridot/Diffable.hs:11:8 | |
-- Diff UTCTime -- Defined at src/Peridot/Diffable.hs:16:8 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment