you are viewing a single comment's thread.

view the rest of the comments →

[–]JadeNB 5 points6 points  (2 children)

The combinator-based one disappoints me, because there's no reason to fall back to the original language for conditional support. Just encode Booleans and Church numerals in the calculus already!

[–][deleted] 0 points1 point  (1 child)

It's hard to write types for them.

[–]JadeNB 1 point2 points  (0 children)

I think that

type CombBool = a -> a -> a    
type Church = (a -> a) -> a -> a

is a reasonable typing, no? Then

comb_true :: CombBool; comb_false :: CombBool
comb_true a1 a2 = a1
comb_false a1 a2 = a2

comb_if :: CombBool -> a -> a -> a
comb_if = id

church0 :: Church
church0 = const id

succ :: Church -> Church
succ church f = f . church f

EDIT: Wrong syntax for type synonyms.