Skip to content

Instantly share code, notes, and snippets.

@WillNess
Last active December 14, 2015 03:29
Show Gist options
  • Select an option

  • Save WillNess/5021669 to your computer and use it in GitHub Desktop.

Select an option

Save WillNess/5021669 to your computer and use it in GitHub Desktop.
Church numerals mult m n s z = m (n s) z
zero s z = z
succ n s z = s (n s z)
one s z = s z
two s z = s (s z)
false x y = y = zero x y
true x y = x = const x y
const x y = x
isZero n = n (const false) true
mult m n s z = m (n s) z
= (m . n) s z
-- http://stackoverflow.com/questions/12942397/
-- lambda-calculus-in-haskell-is-there-some-way-to-make-
-- church-numerals-type-check/12942637#12942637
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment