Re: Using existential types

2003-10-03 Thread Tomasz Zielonka
On Thu, Oct 02, 2003 at 06:42:59PM -0700, [EMAIL PROTECTED] wrote: data Datatype ex = forall vt . Datatype (DatatypeVal ex vt) In practice one rarely would write forall vt. Datatype (DatatypeVal ex vt) unless he is writing something like the ST monad. You can only pass vt to

Re: Using existential types

2003-10-03 Thread Tomasz Zielonka
On Fri, Oct 03, 2003 at 09:42:48AM +0200, Tomasz Zielonka wrote: However this approach has caveats. For example you can't store the state of Stat and restart it later. All steps are done within one call to runStat. I was wrong. I can write: updateStat :: Stat i o - i - Stat i o updateStat

Re: Using existential types

2003-10-03 Thread Graham Klyne
At 18:42 02/10/03 -0700, [EMAIL PROTECTED] wrote: Therefore, when you quantify a value, you typically want to impose a constraint forall vt. (C vt) = Datatype (DatatypeVal ex vt) That's a useful observation, thanks. I've had a enough cases recently where I found that a class doesn't

Re: interact behaves oddly if used interactively

2003-10-03 Thread Claus Reinke
I completely agree with Thomas Hallgren's message. I also view the IO monad as a temporary solution and regret that research into better lazy IO seems to have stoped. Well, not everywhere. Since noone else has mentioned it so far, it is worth throwing in the obligatory reference to the

Re: Why does this work - haskell mysteries?

2003-10-03 Thread Graham Klyne
This seems to me like one of those frustrating problems... if you are comfortable with the language then why it works is obvious, but it's difficult to explain why it's obvious. (My mathematical analysis lecturer often used to say if it's obvious then either it's an assumption or it can be

RE: Why does this work - haskell mysteries?

2003-10-03 Thread Michael Wang
I am guessing this is how the data got accumulated: in you my_store, the function stored is like \w - if w == 'a' then 3 else if w == 'b' then 5 else if w == 'a' then 4 else (\w - 0 ) w 'a' is stored twice