Implementing RefMonads in Haskell without ST,IO
Hal Daume III
hdaume@ISI.EDU
Thu, 29 May 2003 21:15:22 -0700 (PDT)
> But how can one implement RefMonad to support references of all possible
> types simultaneously?
...you could use Dynamics...
but other than that, I think you're stuck...
> ----- Original Message -----
> From: "Derek Elkins" <ddarius@hotpop.com>
> To: "Tim Sweeney" <tim@epicgames.com>
> Cc: <haskell@haskell.org>
> Sent: Thursday, May 29, 2003 10:31 PM
> Subject: Re: Implementing RefMonads in Haskell without ST,IO
>
>
> > On Thu, 29 May 2003 22:48:05 -0500
> > "Tim Sweeney" <tim@epicgames.com> wrote:
> >
> > > If it's not possible to implement a typesafe RefMonad instance
> > > directly in Haskell, without making use of built-in imperative
> > > features like IO, then doesn't this refute the claims that monads
> > > implement imperative features functionally?
> > >
> > > -Tim
> >
> > You certainly can have an instance of RefMonad that -simulates-
> > updateable references. You can't implement this with update inplace
> > without an update inplace primitive and if Haskell had an update inplace
> > primitive that you could use anywhere it wouldn't be a pure language.
> > Monads in Haskell -allow- imperative features and use of imperative
> > features without breaking the purity of the entire language. Outside a
> > monadic computation equational reasoning always holds, even when talking
> > about imperative actions. That monads implement an imperative effect
> > doesn't mean they implement it the same way an imperative language
> > would. Of course, the actual implementation doesn't matter so
> > implementing it imperatively is just as good as implementing it
> > functionally as far as static semantics go, which is why everything
> > (IO&ST) works out.
>
> _______________________________________________
> Haskell mailing list
> Haskell@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell
>