[Haskell-cafe] Re: Fast Mutable Variables for the IO and ST monads
Simon Marlow
simonmarhaskell at gmail.com
Mon Feb 6 08:41:50 EST 2006
Bulat Ziganshin wrote:
> only for the souls interesting in writing efficient programs :)
>
> i included in this letter my own module used for fast variables -
> "DataVariables.hs". and "wc.hs" contains example of using these vars.
The Var class is interesting - basically the equivalent of the MArray
class for mutable variables. Is there a reason you couldn't use the
same pattern as the MArray class? MArray of Ptr works fine, but for
some reason you couldn't do it with Var, why not?
I suggest you follow the same scheme as the unboxed array types, and
have IOURef/STURef types, parameterised over the element type. Of
course, we should have instances for all of the primitive numeric types
plus Ptr, ForeignPtr, StablePtr, Bool.
Cheers,
Simon
More information about the Haskell-Cafe
mailing list