@@ -53,7 +53,9 @@ solve maxUniverseLevel inpConstraints =
5353 constraints = M.map S.fromList $ M.fromListWith (++)
5454 [ (v, [(c,fc)])
5555 | (c, fc) <- inpConstraints
56− , v <- varsIn c
56+ , let vars = varsIn c
57+ , length vars > 1 -- do not register unary constraints
58+ , v <- vars
5759 ]
5860
5961 -- | this is where the actual work is done.
@@ -122,9 +124,10 @@ solve maxUniverseLevel inpConstraints =
122124
123125 -- | add all constraints related to a variable.
124126 addToQueue :: MonadState SolverState m => Var -> m ()
125− addToQueue var = do
126− let cs = constraints M.! var
127− modify $ \ st -> st { queue = S.union cs (queue st) }
127+ addToQueue var =
128+ case M.lookup var constraints of
129+ Nothing -> return ()
130+ Just cs -> modify $ \ st -> st { queue = S.union cs (queue st) }
128131
129132 -- | intersecting two domains, the resulting domain can be wiped out.
130133 domainIntersect :: (Int, Int) -> (Int, Int) -> (Int, Int)