Skip to content

Instantly share code, notes, and snippets.

@spockz
Created April 17, 2010 18:50
Show Gist options
  • Select an option

  • Save spockz/369740 to your computer and use it in GitHub Desktop.

Select an option

Save spockz/369740 to your computer and use it in GitHub Desktop.
data Zero = Zero
data Succ a = Succ a
class Times x y z | x y -> z where
times :: x -> y -> z
instance Times Zero x Zero where
times Zero x = Zero
instance (Times n x r', Add x r' r) => Times (Succ n) x r where
times (Succ n) x = add x (times n x)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment