@@ -224,7 +224,7 @@ findTypeConstructor name = foldr tConsFolder Nothing
224224
225225resolveAtomType :: AtomType -> AtomType -> Either RelationalError AtomType
226226resolveAtomType (ConstructedAtomType tConsName resolvedTypeVarMap) (ConstructedAtomType _ unresolvedTypeVarMap) =
227− ConstructedAtomType tConsName <$> resolveAtomTypesInTypeVarMap resolvedTypeVarMap unresolvedTypeVarMap
227+ ConstructedAtomType tConsName <$> resolveAtomTypesInTypeVarMap resolvedTypeVarMap unresolvedTypeVarMap
228228resolveAtomType typeFromRelation unresolvedType = if typeFromRelation == unresolvedType then
229229 Right typeFromRelation
230230 else
@@ -257,7 +257,11 @@ resolveAtomTypesInTypeVarMap resolvedTypeMap unresolvedTypeMap = do
257257 subType@(ConstructedAtomType _ _) -> do
258258 resSubType <- resolveAtomType resType subType
259259 pure (resKey, resSubType)
260− _ -> pure (resKey, resType)
260+ TypeVariableType _ -> pure (resKey, resType)
261+ typ -> if typ == resType then
262+ pure (resKey, resType)
263+ else
264+ Left $ AtomTypeMismatchError typ resType
261265 Nothing ->
262266 pure (resKey, resType) --swipe the missing type var from the expected map
263267 tVarList <- mapM (uncurry resolveTypePair) (M.toList resolvedTypeMap)