Re: type signatures with existentially quantified data constructors

2001-08-16 Thread Dylan Thurston
On Thu, Aug 16, 2001 at 01:11:25AM -0400, Avi Pfeffer wrote: > Works fine. Things get tricky when I try to add pairs. In order to type > a pair expression, I find I need to create a Pair class and introduce a > class constraint: > > class Pair a b c | a -> b c, b c -> a > > instance Pair (b,c

Re: type signatures with existentially quantified data constructors

2001-08-15 Thread Levent Erkok
How about: === data Expr a = Haskell a | If (Expr Bool) (Expr a) (Expr a) | forall b . Appl (Expr (b->a)) (Expr b) | forall b c . MkPair (Expr b) (Expr c) (b -> c -> a) eval :: Expr a -> a eval (

type signatures with existentially quantified data constructors

2001-08-15 Thread Avi Pfeffer
Hi all, I'm trying to write an interpreter for a language embedded in Haskell, that "inherits" Haskell types and values. So I create a type Expr a, to represent expressions of type a, and an evaluator that takes an Expr a and produces an a. (To keep things simple, let's assume there are no vari