type Church t = (t -> t) -> t -> t
c4 = \s -> \z -> s (s (s (s z)))
int2church :: Integer -> Church t
int2church 0 = \s -> \z -> z
int2church n = \s -> \z -> s (int2church (n-1) s z)
--int2church n s z = s (int2church (n-1) s z)
church2int :: Church Integer -> Integer
church2int c = c (+1) 0
type Churchlist t u = (t -> u -> u) -> u -> u
mapChurch :: (t -> s) -> (Churchlist t u) -> (Churchlist s u)
mapChurch f l = \c -> \n -> l (\a -> \b -> c (f a) b) n
church2list c = c (:) []
--list2church [] = \c -> \n -> n
--list2church (x:xs) = \c -> \n -> c x (list2church xs c n)
list2church xs = \c -> \n -> foldr c n xs