Created
June 5, 2013 00:50
-
-
Save mjdominus/5710839 to your computer and use it in GitHub Desktop.
mod-n intgers
This file contains hidden or 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 Zero | |
data Succ a | |
class Modulus a where | |
modulus :: a -> Int | |
instance Modulus Zero where | |
modulus = \a -> 0 | |
instance (Modulus a) => Modulus (Succ a) where | |
modulus = \a -> 1 + modulus a | |
z = undefined :: Zero | |
a = undefined :: Succ (Succ Zero) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment