Re: [Haskell-cafe] A question on existential types and Church encoding

2010-06-07 Thread Ryan Ingram
In the new type, the parameter 'a' is misleading. It has no connection to the 'a's on the right of the equals sign. You might as well write: type CB = forall a. a - a - a On Tue, Jun 1, 2010 at 12:40 PM, Cory Knapp cory.m.kn...@gmail.com wrote: Ah! That makes sense. Which raises a new

Re: [Haskell-cafe] A question on existential types and Church encoding

2010-06-01 Thread Cory Knapp
Thanks! That was exactly the sort of response I was looking for. This explains why you need to double up for your current definitions. To choose between two booleans (which will in turn allow you to choose between 'a's), you need a CB (CB a). You can eliminate the asymmetric type, though, like

Re: [Haskell-cafe] A question on existential types and Church encoding

2010-06-01 Thread Jason Dagit
On Tue, Jun 1, 2010 at 12:40 PM, Cory Knapp cory.m.kn...@gmail.com wrote: Thanks! That was exactly the sort of response I was looking for. This explains why you need to double up for your current definitions. To choose between two booleans (which will in turn allow you to choose between

Re: [Haskell-cafe] A question on existential types and Church encoding

2010-06-01 Thread C. McCann
On Tue, Jun 1, 2010 at 3:40 PM, Cory Knapp cory.m.kn...@gmail.com wrote: In the new type, the parameter 'a' is misleading. It has no connection to the 'a's on the right of the equals sign. You might as well write:  type CB = forall a. a - a - a Ah! That makes sense. Which raises a new

Re: [Haskell-cafe] A question on existential types and Church encoding

2010-06-01 Thread Dan Doel
On Tuesday 01 June 2010 3:40:41 pm Cory Knapp wrote: Note: this is universal quantification, not existential. As I would assume. But I always see the forall keyword used when discussing existential quantification. I don't know if I've ever seen an exists keyword. Is there one? How would it

Re: [Haskell-cafe] A question on existential types and Church encoding

2010-06-01 Thread Daniel Fischer
On Tuesday 01 June 2010 23:21:35, Dan Doel wrote: I think SPJ is on record as saying it would add a lot of complexity to the current GHC type system, and I'm inclined to believe him. In matters concerning the GHC type system, that's a fairly natural stance, I think.

Re: [Haskell-cafe] A question on existential types and Church encoding

2010-05-30 Thread Jason Dagit
On Sat, May 29, 2010 at 9:28 PM, Cory Knapp cory.m.kn...@gmail.com wrote: Hello, A professor of mine was recently playing around during a lecture with Church booleans (I.e., true = \x y - x; false = \x y - y) in Scala and OCaml. I missed what he did, so I reworked it in Haskell and got this:

Re: [Haskell-cafe] A question on existential types and Church encoding

2010-05-30 Thread wren ng thornton
Jason Dagit wrote: In Church's λ-calc the types are ignored, Not so. Church-style lambda calculus is the one where types matter; Curry-style is the one that ignores types and evaluates as if it were the untyped lambda calculus. Church encodings are based on the untyped LC rather than

Re: [Haskell-cafe] A question on existential types and Church encoding

2010-05-30 Thread Dan Doel
On Sunday 30 May 2010 12:28:36 am Cory Knapp wrote: type CB a = a - a - a ct :: CB aC ct x y = x cf :: CB a cf x y = y cand :: CB (CB a) - CB a - CB a cand p q = p q cf cor :: CB (CB a) - CB a - CB a cor p q = p ct q The reason these types are required is that the 'a' in your

Re: [Haskell-cafe] A question on existential types and Church encoding

2010-05-30 Thread Jason Dagit
On Sun, May 30, 2010 at 4:08 AM, wren ng thornton w...@freegeek.org wrote: Jason Dagit wrote: In Church's λ-calc the types are ignored, Not so. Church-style lambda calculus is the one where types matter; Curry-style is the one that ignores types and evaluates as if it were the untyped

[Haskell-cafe] A question on existential types and Church encoding

2010-05-29 Thread Cory Knapp
Hello, A professor of mine was recently playing around during a lecture with Church booleans (I.e., true = \x y - x; false = \x y - y) in Scala and OCaml. I missed what he did, so I reworked it in Haskell and got this: type CB a = a - a - a ct :: CB aC ct x y = x cf :: CB a cf x y = y cand ::