@@ -224,7 +224,7 @@ findTypeConstructor name = foldr tConsFolder Nothing
225resolveAtomType :: AtomType -> AtomType -> Either RelationalError AtomType
225resolveAtomType :: AtomType -> AtomType -> Either RelationalError AtomType
226resolveAtomType (ConstructedAtomType tConsName resolvedTypeVarMap) (ConstructedAtomType _ unresolvedTypeVarMap) =
226resolveAtomType (ConstructedAtomType tConsName resolvedTypeVarMap) (ConstructedAtomType _ unresolvedTypeVarMap) =
227− ConstructedAtomType tConsName <$> resolveAtomTypesInTypeVarMap resolvedTypeVarMap unresolvedTypeVarMap
227+ ConstructedAtomType tConsName <$> resolveAtomTypesInTypeVarMap resolvedTypeVarMap unresolvedTypeVarMap
228resolveAtomType typeFromRelation unresolvedType = if typeFromRelation == unresolvedType then
228resolveAtomType typeFromRelation unresolvedType = if typeFromRelation == unresolvedType then
229 Right typeFromRelation
229 Right typeFromRelation
@@ -257,7 +257,11 @@ resolveAtomTypesInTypeVarMap resolvedTypeMap unresolvedTypeMap = do
257 subType@(ConstructedAtomType _ _) -> do
257 subType@(ConstructedAtomType _ _) -> do
258 resSubType <- resolveAtomType resType subType
258 resSubType <- resolveAtomType resType subType
259 pure (resKey, resSubType)
259 pure (resKey, resSubType)
260− _ -> pure (resKey, resType)
260+ TypeVariableType _ -> pure (resKey, resType)
261+ typ -> if typ == resType then
262+ pure (resKey, resType)
264+ Left $ AtomTypeMismatchError typ resType
261 Nothing ->
265 Nothing ->
262 pure (resKey, resType) --swipe the missing type var from the expected map
266 pure (resKey, resType) --swipe the missing type var from the expected map
263 tVarList <- mapM (uncurry resolveTypePair) (M.toList resolvedTypeMap)
267 tVarList <- mapM (uncurry resolveTypePair) (M.toList resolvedTypeMap)