Skip to content

Commit 53ad197

Browse files
committed
Update for STArray changes
1 parent 337c2cc commit 53ad197

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/Data/Set.purs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ import Control.Monad.Rec.Class (Step(..), tailRecM2)
3232
import Control.Monad.ST (ST)
3333
import Control.Monad.ST as ST
3434
import Data.Array as Array
35-
import Data.Array.ST (STArray, emptySTArray, pushSTArray, unsafeFreeze)
35+
import Data.Array.ST (STArray)
36+
import Data.Array.ST as STArray
3637
import Data.Eq (class Eq1)
3738
import Data.Foldable (class Foldable, foldMap, foldl, foldr)
3839
import Data.List (List)
@@ -158,7 +159,7 @@ properSubset s1 s2 = subset s1 s2 && (s1 /= s2)
158159

159160
-- | The set of elements which are in both the first and second set
160161
intersection :: forall a. Ord a => Set a -> Set a -> Set a
161-
intersection s1 s2 = fromFoldable (ST.run (emptySTArray >>= intersect >>= unsafeFreeze))
162+
intersection s1 s2 = fromFoldable (ST.run (STArray.empty >>= intersect >>= STArray.unsafeFreeze))
162163
where
163164
toArray = Array.fromFoldable <<< toList
164165
ls = toArray s1
@@ -172,7 +173,7 @@ intersection s1 s2 = fromFoldable (ST.run (emptySTArray >>= intersect >>= unsafe
172173
if l < ll && r < rl
173174
then case compare (ls `Array.unsafeIndex` l) (rs `Array.unsafeIndex` r) of
174175
EQ -> do
175-
_ <- pushSTArray acc (ls `Array.unsafeIndex` l)
176+
_ <- STArray.push (ls `Array.unsafeIndex` l) acc
176177
pure $ Loop {a: l + 1, b: r + 1}
177178
LT -> pure $ Loop {a: l + 1, b: r}
178179
GT -> pure $ Loop {a: l, b: r + 1}

0 commit comments

Comments
 (0)