Skip to content

Instantly share code, notes, and snippets.

@mjdominus
Created June 5, 2013 03:06
Show Gist options
  • Save mjdominus/5711342 to your computer and use it in GitHub Desktop.
Save mjdominus/5711342 to your computer and use it in GitHub Desktop.
what is 'lower" for?
data Zero
data Succ a
lower :: Succ a -> a
lower = undefined
class Modulus a where
modulus :: a -> Integer
instance Modulus Zero where
modulus = \a -> 0
instance (Modulus a) => Modulus (Succ a) where
modulus = \a -> 1 + modulus (lower a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment