From 1b7fd5be013652b70395f145e6fb5e257eae4f48 Mon Sep 17 00:00:00 2001 From: ross Date: Thu, 13 Oct 2005 10:36:42 +0000 Subject: [PATCH] [project @ 2005-10-13 10:36:42 by ross] MArray instance for Lazy.ST --- Data/Array/Base.hs | 10 ++++++++++ 1 file changed, 10 insertions(+) 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 -- 1.7.10.4