X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;ds=inline;f=Data%2FArray%2FBase.hs;h=224c11d1f8cf10ad242050853e36498d3d3ed498;hb=2570f264ed329f04017d507250494eb0ab680d64;hp=6864362d2481d608e9214f12e888d7a973dfa020;hpb=6d89a2fe861274e66e6fa0a5cdd48b1161b33b75;p=haskell-directory.git diff --git a/Data/Array/Base.hs b/Data/Array/Base.hs index 6864362..224c11d 100644 --- a/Data/Array/Base.hs +++ b/Data/Array/Base.hs @@ -6,7 +6,7 @@ -- -- Maintainer : libraries@haskell.org -- Stability : experimental --- Portability : non-portable +-- Portability : non-portable (MPTCs, uses Control.Monad.ST) -- -- Basis for IArray and MArray. Not intended for external consumption; -- use IArray or MArray instead. @@ -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