Re: [Haskell-cafe] Re: Chuch encoding of data structures in Haskell

2010-05-28 Thread wren ng thornton
Ivan Miljenovic wrote: On 28 May 2010 15:18, wren ng thornton w...@freegeek.org wrote: Stefan Monnier wrote: churchedBool :: t - t - t Important detail: the precise type is ∀t. t → t → t. encodeBool x = \t e - if x then t else e So the type of encodeBool should be: Bool → ∀t. t → t → t

Re: [Haskell-cafe] Re: Chuch encoding of data structures in Haskell

2010-05-27 Thread C. McCann
On Thu, May 27, 2010 at 9:11 PM, Stefan Monnier monn...@iro.umontreal.ca wrote: I.e. to make such an encoding really usable, you need deep polymorphism (which GHC supports just fine, but which is not part of the Haskell standard). Ah, yes, and thank you for pointing that out. My message

Re: [Haskell-cafe] Re: Chuch encoding of data structures in Haskell

2010-05-27 Thread wren ng thornton
Stefan Monnier wrote: churchedBool :: t - t - t Important detail: the precise type is ∀t. t → t → t. encodeBool x = \t e - if x then t else e So the type of encodeBool should be: Bool → ∀t. t → t → t whereas Haskell will infer it to be ∀t. Bool → t → t → t Those are the same type.

Re: [Haskell-cafe] Re: Chuch encoding of data structures in Haskell

2010-05-27 Thread Ivan Miljenovic
On 28 May 2010 15:18, wren ng thornton w...@freegeek.org wrote: Stefan Monnier wrote: churchedBool :: t - t - t Important detail: the precise type is ∀t. t → t → t. encodeBool x = \t e - if x then t else e So the type of encodeBool should be:  Bool → ∀t. t → t → t whereas Haskell will