On Fri, Aug 26, 2005 at 08:27:43PM -0400, ChrisK wrote:
> to figure out since there was no Data.Array.ST.Lazy.  Does anyone know
> why it was left out?  I'll put a note on the HaskellTwo page about that...

Some time ago when I wanted a lazy hashtable I came up with this,
which, after minimal testing, seemed to work:
(Lazy STRef's are implemented in exactly the same way, btw)

\begin{code}

{-# OPTIONS -fglasgow-exts #-}
module MArrayLazyST (
    STArray,
    module Data.Array.MArray
) where

import Control.Monad.ST.Lazy
import Data.Array.Base
import Data.Array.ST
import Data.Array.MArray

instance MArray (STArray s) e (ST s) where
    newArray range e = strictToLazyST (newArray range e)
    newArray_ range = strictToLazyST (newArray_ range)
    unsafeRead arr i = strictToLazyST (unsafeRead arr i)
    unsafeWrite arr i e = strictToLazyST (unsafeWrite arr i e)

\end{code}


Cheers,
Remi

-- 
Nobody can be exactly like me. Even I have trouble doing it.
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to