Re: Lazy evaluation alternative

2003-01-26 Thread Keith Wansbrough
> I wonder if I could run an idea I've had by this list. It seems to > me you could get some of the desired effects of lazy evaluation by using > continuation passing style in code. For example, take this psuedo-code > using CPS to represent an infinite data type. This has been known for a lon

Re: seeking ideas for short lecture on type classes

2003-01-26 Thread Norman Ramsey
> > In a fit of madness, I have agreed to deliver a 50-minute lecture > > on type classes to an audience of undergraduate students. These > > students will have seen some simple typing rules for F2 and will > > have some exposure to Hindley-Milner type inference in the context > > of ML. >

Re: seeking ideas for short lecture on type classes

2003-01-26 Thread John Hörnkvist
On Saturday, January 25, 2003, at 04:14 AM, Andrew J Bromage wrote: G'day all. On Fri, Jan 24, 2003 at 06:13:29PM -0500, Norman Ramsey wrote: In a fit of madness, I have agreed to deliver a 50-minute lecture on type classes to an audience of undergraduate students. These students will have s

Re: seeking ideas for short lecture on type classes

2003-01-26 Thread Dean Herington
On Sun, 26 Jan 2003, Norman Ramsey wrote: > > > In a fit of madness, I have agreed to deliver a 50-minute lecture > > > on type classes to an audience of undergraduate students. These > > > students will have seen some simple typing rules for F2 and will > > > have some exposure to Hindley-Mi

Re: seeking ideas for short lecture on type classes

2003-01-26 Thread Nick Name
On Sun, 26 Jan 2003 19:07:01 -0500 (EST) Dean Herington <[EMAIL PROTECTED]> wrote: > What may distinguish Haskell from typical OO languages (I'm not an > expert on them) is that in Haskell such polymorphic functions could > (always or at least nearly so) be specialized statically for their > u

existential typing question

2003-01-26 Thread Dean Herington
Can someone explain why the type declaration for `g` is required in the following? class RT r t where rt :: r -> t data D t = Dt t | forall r. RT r t => Dr r f :: D t -> D t f = g where -- g :: D t -> D t g (Dr r) = Dt (rt r) As given above, the program evokes these error messages: w

Re: existential typing question

2003-01-26 Thread Hal Daume III
Because you could have an instance: instance RT r t1 and another instance for a t2 /= t1: instance RT r t2 then when you say: g (Dr r) = Dt (r t) then, 'r t' could either have type t1 or t2, thus giving the result value type 'Dt t1' or 'Dt t2'. If your class had fundeps 'r -> t', then