@@ -32,7 +32,8 @@ import Control.Monad.Rec.Class (Step(..), tailRecM2)
3232import Control.Monad.ST (ST )
3333import Control.Monad.ST as ST
3434import 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
3637import Data.Eq (class Eq1 )
3738import Data.Foldable (class Foldable , foldMap , foldl , foldr )
3839import 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
160161intersection :: 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