File tree Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Original file line number Diff line number Diff line change 55module Data.Array.ST
66 ( STArray (..)
77 , Assoc
8- , runSTArray
8+ , run
99 , withArray
1010 , empty
1111 , peek
@@ -26,7 +26,8 @@ module Data.Array.ST
2626
2727import Prelude
2828
29- import Control.Monad.ST (ST , kind Region , run )
29+ import Control.Monad.ST as ST
30+ import Control.Monad.ST (ST , kind Region )
3031import Data.Maybe (Maybe (..))
3132import Unsafe.Coerce (unsafeCoerce )
3233
@@ -46,8 +47,8 @@ type Assoc a = { value :: a, index :: Int }
4647-- | immutable array for later perusal. This function avoids copying the array
4748-- | before returning it - it uses unsafeFreeze internally, but this wrapper is
4849-- | a safe interface to that function.
49- runSTArray :: forall a . (forall h . ST h (STArray h a )) -> Array a
50- runSTArray st = run (st >>= unsafeFreeze)
50+ run :: forall a . (forall h . ST h (STArray h a )) -> Array a
51+ run st = ST . run (st >>= unsafeFreeze)
5152
5253-- | Perform an effect requiring a mutable array on a copy of an immutable array,
5354-- | safely returning the result as an immutable array.
Original file line number Diff line number Diff line change @@ -18,9 +18,9 @@ run act = ST.run (act >>= STA.unsafeFreeze)
1818testArrayST :: Effect Unit
1919testArrayST = do
2020
21- log " runSTArray should produce an immutable array by running a constructor operation"
21+ log " run should produce an immutable array by running a constructor operation"
2222
23- assert $ STA .runSTArray (do
23+ assert $ STA .run (do
2424 arr <- STA .empty
2525 void $ STA .push 1 arr
2626 void $ STA .push 2 arr
You can’t perform that action at this time.
0 commit comments