@@ -32,8 +32,7 @@ import Data.Map.Strict (Map)
3232import qualified Data.Map.Strict as M
3333import Data.MonoTraversable
3434import Data.Monoid
35−import Data.Range (Range (..))
36−import qualified Data.Range as R
35+import qualified Data.RangeSet.Map as RS
3736import Data.Sequence (Seq (..))
3837import Data.Sequences
3938import Data.Set (Set)
@@ -186,19 +185,19 @@ v <<- x | v `occursIn` x = tell (InfinityType x) >> return mempty
186185v <<- x = return $ Substitution $ M.singleton v x
187186
188187unify :: Constraint -> UnifyM Substitution
189−unify = unifyWithPriority EmptyRange
188+unify = unifyWithPriority RS.empty
190189
191190unifyWithPriority ::
192191 -- | The range of type variables to interpret as being lower
193192 -- priority (try to replace them if possible)
194− Range TypeVariable ->
193+ RS.RSet TypeVariable ->
195194 Constraint ->
196195 UnifyM Substitution
197196unifyWithPriority range (lhs :~ rhs) =
198197 case (lhs, rhs) of
199198 (NAtomic x, NAtomic y) | x == y -> return mempty
200199 (NTypeVariable x, NTypeVariable y) ->
201− if y `R.member` range
200+ if y `RS.member` range
202201 then x <<- NTypeVariable y
203202 else y <<- NTypeVariable x
204203 (NTypeVariable t, x) -> t <<- x
@@ -215,12 +214,12 @@ unifyWithPriority range (lhs :~ rhs) =
215214 (x, y) -> tell (CanNotUnify x y) >> return mempty
216215
217216solve :: Seq Constraint -> UnifyM Substitution
218−solve = solveWithPriority EmptyRange
217+solve = solveWithPriority RS.empty
219218
220219solveWithPriority ::
221220 -- | The range of type variables to interpret as being lower
222221 -- priority (try to replace them if possible)
223− Range TypeVariable ->
222+ RS.RSet TypeVariable ->
224223 Seq Constraint ->
225224 UnifyM Substitution
226225solveWithPriority _ Empty = return mempty
@@ -478,12 +477,12 @@ inferGeneral x = traceSubtree (showExpr x) $ do
478477 s' <- solveWithPriority range cs
479478 traceValue "substitutions_after_solving" $ prettySubstitution s'
480479 let s = subs <> s'
481− returnedS = Substitution . M.filterWithKey (\k _ -> k `R.notMember` range) . unSubstitution $ s
480+ returnedS = Substitution . M.filterWithKey (\k _ -> k `RS.notMember` range) . unSubstitution $ s
482481 traceSubtree "returned" $ do
483482 traceValue "substitutions" $ prettySubstitution returnedS
484483 -- Filter for optimization purposes
485484 subEnv returnedS
486− let retT = close (Predicate (`R.member` range) <> Predicate (`S.notMember` free returnedS)) $ sub s t
485+ let retT = close (Predicate (`RS.member` range) <> Predicate (`S.notMember` free returnedS)) $ sub s t
487486 traceValue "type" $ renderPretty retT
488487 return retT
489488