@@ -283,8 +283,12 @@ evalContextExpr (AddInclusionDependency newDepName newDep) = do
283283 if M.member newDepName currDeps then
284284 return $ Just (InclusionDependencyNameInUseError newDepName)
285285 else do
286− put $ DatabaseContext newDeps (relationVariables currContext) (atomFunctions currContext)
287− return Nothing
286+ let potentialContext = DatabaseContext newDeps (relationVariables currContext) (atomFunctions currContext)
287+ case checkConstraints potentialContext of
288+ Just err -> return $ Just err
289+ Nothing -> do
290+ put potentialContext
291+ return Nothing
288292
289293evalContextExpr (RemoveInclusionDependency depName) = do
290294 currContext <- get