Skip to content

Commit f6604b3

Browse files
committed
Rename runSTArray to run, to avoid function / module name duplication.
1 parent 79995c7 commit f6604b3

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/Data/Array/ST.purs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
module 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

2727
import 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)
3031
import Data.Maybe (Maybe(..))
3132
import 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.

test/Test/Data/Array/ST.purs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ run act = ST.run (act >>= STA.unsafeFreeze)
1818
testArrayST :: Effect Unit
1919
testArrayST = 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

0 commit comments

Comments
 (0)