2
0
Fork 0
mirror of https://github.com/MartinThoma/LaTeX-examples.git synced 2025-04-25 14:28:05 +02:00
LaTeX-examples/documents/Programmierparadigmen/scripts/haskell/church.hs

8 lines
201 B
Haskell
Raw Normal View History

2014-03-12 21:07:00 +01:00
type Church t = (t -> t) -> t -> t
int2church :: Integer -> Church t
int2church 0 s z = z
int2church n s z = int2church (n - 1) s (s z)
church2int :: Church Integer -> Integer
church2int n = n (+1) 0