From: ross Date: Thu, 13 Oct 2005 10:36:42 +0000 (+0000) Subject: [project @ 2005-10-13 10:36:42 by ross] X-Git-Tag: cmm-merge2~13 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=1b7fd5be013652b70395f145e6fb5e257eae4f48;p=haskell-directory.git [project @ 2005-10-13 10:36:42 by ross] MArray instance for Lazy.ST --- diff --git a/Data/Array/Base.hs b/Data/Array/Base.hs index 6864362..756a703 100644 --- a/Data/Array/Base.hs +++ b/Data/Array/Base.hs @@ -18,6 +18,8 @@ module Data.Array.Base where import Prelude +import Control.Monad.ST.Lazy ( strictToLazyST ) +import qualified Control.Monad.ST.Lazy as Lazy (ST) import Data.Ix ( Ix, range, index, rangeSize ) import Data.Int import Data.Word @@ -1071,6 +1073,14 @@ instance MArray (STArray s) e (ST s) where {-# INLINE unsafeWrite #-} unsafeWrite = ArrST.unsafeWriteSTArray +instance MArray (STArray s) e (Lazy.ST s) where + {-# INLINE newArray #-} + newArray (l,u) e = strictToLazyST (ArrST.newSTArray (l,u) e) + {-# INLINE unsafeRead #-} + unsafeRead arr i = strictToLazyST (ArrST.unsafeReadSTArray arr i) + {-# INLINE unsafeWrite #-} + unsafeWrite arr i e = strictToLazyST (ArrST.unsafeWriteSTArray arr i e) + #ifdef __HUGS__ INSTANCE_TYPEABLE3(STArray,sTArrayTc,"STArray") #endif