@@ -168,7 +168,7 @@ unifyRows r1 r2 =
168-- Infer the types of multiple mutually-recursive values, and return elaborated values including
168-- Infer the types of multiple mutually-recursive values, and return elaborated values including
169-- type class dictionaries and type annotations.
169-- type class dictionaries and type annotations.
171−typesOf :: Maybe ModuleName -> ModuleName -> [(Ident, Value)] -> Check [(Ident, (Value, Type))]
171+typesOf :: Maybe ModuleName -> ModuleName -> [(Ident, Expr)] -> Check [(Ident, (Expr, Type))]
172typesOf mainModuleName moduleName vals = do
172typesOf mainModuleName moduleName vals = do
173 tys <- fmap tidyUp . liftUnify $ do
173 tys <- fmap tidyUp . liftUnify $ do
174 (es, dict, untypedDict) <- typeDictionaryForBindingGroup moduleName vals
174 (es, dict, untypedDict) <- typeDictionaryForBindingGroup moduleName vals
@@ -194,7 +194,7 @@ typesOf mainModuleName moduleName vals = do
194 -- Apply the substitution that was returned from runUnify to both types and (type-annotated) values
194 -- Apply the substitution that was returned from runUnify to both types and (type-annotated) values
195 tidyUp (ts, sub) = map (\(i, (val, ty)) -> (i, (overTypes (sub $?) val, sub $? ty))) ts
195 tidyUp (ts, sub) = map (\(i, (val, ty)) -> (i, (overTypes (sub $?) val, sub $? ty))) ts
197−typeDictionaryForBindingGroup :: ModuleName -> [(Ident, Value)] -> UnifyT Type Check ([(Ident, (Value, Maybe (Type, Bool)))], M.Map (ModuleName, Ident) (Type, NameKind, NameVisibility), [(Ident, Type)])
197+typeDictionaryForBindingGroup :: ModuleName -> [(Ident, Expr)] -> UnifyT Type Check ([(Ident, (Expr, Maybe (Type, Bool)))], M.Map (ModuleName, Ident) (Type, NameKind, NameVisibility), [(Ident, Type)])
198typeDictionaryForBindingGroup moduleName vals = do
198typeDictionaryForBindingGroup moduleName vals = do
200 -- Map each declaration to a name/value pair, with an optional type, if the declaration is typed
200 -- Map each declaration to a name/value pair, with an optional type, if the declaration is typed
@@ -215,7 +215,7 @@ typeDictionaryForBindingGroup moduleName vals = do
215 dict = M.fromList (map (\(ident, ty) -> ((moduleName, ident), (ty, LocalVariable, Undefined))) $ typedDict ++ untypedDict)
215 dict = M.fromList (map (\(ident, ty) -> ((moduleName, ident), (ty, LocalVariable, Undefined))) $ typedDict ++ untypedDict)
216 return (es, dict, untypedDict)
216 return (es, dict, untypedDict)
218−typeForBindingGroupElement :: ModuleName -> (Ident, (Value, Maybe (Type, Bool))) -> M.Map (ModuleName, Ident) (Type, NameKind, NameVisibility) -> [(Ident, Type)] -> UnifyT Type Check (Ident, (Value, Type))
218+typeForBindingGroupElement :: ModuleName -> (Ident, (Expr, Maybe (Type, Bool))) -> M.Map (ModuleName, Ident) (Type, NameKind, NameVisibility) -> [(Ident, Type)] -> UnifyT Type Check (Ident, (Expr, Type))
219typeForBindingGroupElement moduleName el dict untypedDict =
219typeForBindingGroupElement moduleName el dict untypedDict =
220 -- If the declaration is a function, it has access to other values in the binding group.
220 -- If the declaration is a function, it has access to other values in the binding group.
221 -- If not, the generated code might fail at runtime since those values might be undefined.
221 -- If not, the generated code might fail at runtime since those values might be undefined.
@@ -241,17 +241,17 @@ typeForBindingGroupElement moduleName el dict untypedDict =
242-- Check if a value contains a type annotation
242-- Check if a value contains a type annotation
244−isTyped :: (Ident, Value) -> (Ident, (Value, Maybe (Type, Bool)))
244+isTyped :: (Ident, Expr) -> (Ident, (Expr, Maybe (Type, Bool)))
245isTyped (name, TypedValue checkType value ty) = (name, (value, Just (ty, checkType)))
245isTyped (name, TypedValue checkType value ty) = (name, (value, Just (ty, checkType)))
246isTyped (name, value) = (name, (value, Nothing))
246isTyped (name, value) = (name, (value, Nothing))
249-- Map a function over type annotations appearing inside a value
249-- Map a function over type annotations appearing inside a value
251−overTypes :: (Type -> Type) -> Value -> Value
251+overTypes :: (Type -> Type) -> Expr -> Expr
252overTypes f = let (_, f', _) = everywhereOnValues id g id in f'
252overTypes f = let (_, f', _) = everywhereOnValues id g id in f'
254− g :: Value -> Value
254+ g :: Expr -> Expr
255 g (TypedValue checkTy val t) = TypedValue checkTy val (f t)
255 g (TypedValue checkTy val t) = TypedValue checkTy val (f t)
256 g (TypeClassDictionary b (nm, tys) sco) = TypeClassDictionary b (nm, map f tys) sco
256 g (TypeClassDictionary b (nm, tys) sco) = TypeClassDictionary b (nm, map f tys) sco
257 g other = other
257 g other = other
@@ -259,7 +259,7 @@ overTypes f = let (_, f', _) = everywhereOnValues id g id in f'
260-- Replace type class dictionary placeholders with inferred type class dictionaries
260-- Replace type class dictionary placeholders with inferred type class dictionaries
262−replaceTypeClassDictionaries :: ModuleName -> Value -> Check Value
262+replaceTypeClassDictionaries :: ModuleName -> Expr -> Check Expr
263replaceTypeClassDictionaries mn =
263replaceTypeClassDictionaries mn =
264 let (_, f, _) = everywhereOnValuesTopDownM return go return
264 let (_, f, _) = everywhereOnValuesTopDownM return go return
@@ -296,7 +296,7 @@ data DictionaryValue
296-- Check that the current set of type class dictionaries entail the specified type class goal, and, if so,
296-- Check that the current set of type class dictionaries entail the specified type class goal, and, if so,
297-- return a type class dictionary reference.
297-- return a type class dictionary reference.
299−entails :: Environment -> ModuleName -> [TypeClassDictionaryInScope] -> (Qualified ProperName, [Type]) -> Bool -> Check Value
299+entails :: Environment -> ModuleName -> [TypeClassDictionaryInScope] -> (Qualified ProperName, [Type]) -> Bool -> Check Expr
300entails env moduleName context = solve (sortedNubBy canonicalizeDictionary (filter filterModule context))
300entails env moduleName context = solve (sortedNubBy canonicalizeDictionary (filter filterModule context))
302 sortedNubBy :: (Ord k) => (v -> k) -> [v] -> [v]
302 sortedNubBy :: (Ord k) => (v -> k) -> [v] -> [v]
@@ -354,8 +354,8 @@ entails env moduleName context = solve (sortedNubBy canonicalizeDictionary (filt
354 mkDictionary fnName Nothing = LocalDictionaryValue fnName
354 mkDictionary fnName Nothing = LocalDictionaryValue fnName
355 mkDictionary fnName (Just []) = GlobalDictionaryValue fnName
355 mkDictionary fnName (Just []) = GlobalDictionaryValue fnName
356 mkDictionary fnName (Just dicts) = DependentDictionaryValue fnName dicts
356 mkDictionary fnName (Just dicts) = DependentDictionaryValue fnName dicts
357− -- Turn a DictionaryValue into a Value
357+ -- Turn a DictionaryValue into a Expr
358− dictionaryValueToValue :: DictionaryValue -> Value
358+ dictionaryValueToValue :: DictionaryValue -> Expr
359 dictionaryValueToValue (LocalDictionaryValue fnName) = Var fnName
359 dictionaryValueToValue (LocalDictionaryValue fnName) = Var fnName
360 dictionaryValueToValue (GlobalDictionaryValue fnName) = App (Var fnName) (ObjectLiteral [])
360 dictionaryValueToValue (GlobalDictionaryValue fnName) = App (Var fnName) (ObjectLiteral [])
361 dictionaryValueToValue (DependentDictionaryValue fnName dicts) = foldl App (Var fnName) (map dictionaryValueToValue dicts)
361 dictionaryValueToValue (DependentDictionaryValue fnName dicts) = foldl App (Var fnName) (map dictionaryValueToValue dicts)
@@ -434,7 +434,7 @@ typeHeadsAreEqual _ _ _ _ = Nothing
435-- Ensure skolem variables do not escape their scope
435-- Ensure skolem variables do not escape their scope
437−skolemEscapeCheck :: Value -> Check ()
437+skolemEscapeCheck :: Expr -> Check ()
438skolemEscapeCheck (TypedValue False _ _) = return ()
438skolemEscapeCheck (TypedValue False _ _) = return ()
439skolemEscapeCheck root@TypedValue{} =
439skolemEscapeCheck root@TypedValue{} =
440 -- Every skolem variable is created when a ForAll type is skolemized.
440 -- Every skolem variable is created when a ForAll type is skolemized.
@@ -446,11 +446,11 @@ skolemEscapeCheck root@TypedValue{} =
446 let (_, f, _, _, _) = everythingWithContextOnValues [] [] (++) def go def def def
446 let (_, f, _, _, _) = everythingWithContextOnValues [] [] (++) def go def def def
447 in case f root of
447 in case f root of
448 [] -> return ()
448 [] -> return ()
449− ((binding, val) : _) -> throwError $ mkErrorStack ("Rigid/skolem type variable " ++ maybe "" (("bound by " ++) . prettyPrintValue) binding ++ " has escaped.") (Just (ValueError val))
449+ ((binding, val) : _) -> throwError $ mkErrorStack ("Rigid/skolem type variable " ++ maybe "" (("bound by " ++) . prettyPrintValue) binding ++ " has escaped.") (Just (ExprError val))
451 def s _ = (s, [])
451 def s _ = (s, [])
453− go :: [(SkolemScope, Value)] -> Value -> ([(SkolemScope, Value)], [(Maybe Value, Value)])
453+ go :: [(SkolemScope, Expr)] -> Expr -> ([(SkolemScope, Expr)], [(Maybe Expr, Expr)])
454 go scos val@(TypedValue _ _ (ForAll _ _ (Just sco))) = ((sco, val) : scos, [])
454 go scos val@(TypedValue _ _ (ForAll _ _ (Just sco))) = ((sco, val) : scos, [])
455 go scos val@(TypedValue _ _ ty) = case collectSkolems ty \\ map fst scos of
455 go scos val@(TypedValue _ _ ty) = case collectSkolems ty \\ map fst scos of
456 (sco : _) -> (scos, [(findBindingScope sco, val)])
456 (sco : _) -> (scos, [(findBindingScope sco, val)])
@@ -462,14 +462,14 @@ skolemEscapeCheck root@TypedValue{} =
462 collect (Skolem _ _ scope) = [scope]
462 collect (Skolem _ _ scope) = [scope]
463 collect _ = []
463 collect _ = []
464 go scos _ = (scos, [])
464 go scos _ = (scos, [])
465− findBindingScope :: SkolemScope -> Maybe Value
465+ findBindingScope :: SkolemScope -> Maybe Expr
466 findBindingScope sco =
466 findBindingScope sco =
467 let (_, f, _, _, _) = everythingOnValues mappend (const mempty) go' (const mempty) (const mempty) (const mempty)
467 let (_, f, _, _, _) = everythingOnValues mappend (const mempty) go' (const mempty) (const mempty) (const mempty)
468 in getFirst $ f root
468 in getFirst $ f root
470 go' val@(TypedValue _ _ (ForAll _ _ (Just sco'))) | sco == sco' = First (Just val)
470 go' val@(TypedValue _ _ (ForAll _ _ (Just sco'))) | sco == sco' = First (Just val)
471 go' _ = mempty
471 go' _ = mempty
472−skolemEscapeCheck val = throwError $ mkErrorStack "Untyped value passed to skolemEscapeCheck" (Just (ValueError val))
472+skolemEscapeCheck val = throwError $ mkErrorStack "Untyped value passed to skolemEscapeCheck" (Just (ExprError val))
475-- Ensure a row contains no duplicate labels
475-- Ensure a row contains no duplicate labels
@@ -503,7 +503,7 @@ varIfUnknown ty =
503-- This is necessary during type checking to avoid unifying a polymorphic type with a
503-- This is necessary during type checking to avoid unifying a polymorphic type with a
504-- unification variable.
504-- unification variable.
506−instantiatePolyTypeWithUnknowns :: Value -> Type -> UnifyT Type Check (Value, Type)
506+instantiatePolyTypeWithUnknowns :: Expr -> Type -> UnifyT Type Check (Expr, Type)
507instantiatePolyTypeWithUnknowns val (ForAll ident ty _) = do
507instantiatePolyTypeWithUnknowns val (ForAll ident ty _) = do
508 ty' <- replaceVarWithUnknown ident ty
508 ty' <- replaceVarWithUnknown ident ty
509 instantiatePolyTypeWithUnknowns val ty'
509 instantiatePolyTypeWithUnknowns val ty'
@@ -571,19 +571,19 @@ expandAllTypeSynonyms = everywhereOnTypesTopDownM go
572-- Ensure a set of property names and value does not contain duplicate labels
572-- Ensure a set of property names and value does not contain duplicate labels
574−ensureNoDuplicateProperties :: (Error e, MonadError e m) => [(String, Value)] -> m ()
574+ensureNoDuplicateProperties :: (Error e, MonadError e m) => [(String, Expr)] -> m ()
575ensureNoDuplicateProperties ps = guardWith (strMsg "Duplicate property names") $ length (nub . map fst $ ps) == length ps
575ensureNoDuplicateProperties ps = guardWith (strMsg "Duplicate property names") $ length (nub . map fst $ ps) == length ps
578-- Infer a type for a value, rethrowing any error to provide a more useful error message
578-- Infer a type for a value, rethrowing any error to provide a more useful error message
580−infer :: Value -> UnifyT Type Check Value
580+infer :: Expr -> UnifyT Type Check Expr
581−infer val = rethrow (mkErrorStack "Error inferring type of value" (Just (ValueError val)) <>) $ infer' val
581+infer val = rethrow (mkErrorStack "Error inferring type of value" (Just (ExprError val)) <>) $ infer' val
584-- Infer a type for a value
584-- Infer a type for a value
586−infer' :: Value -> UnifyT Type Check Value
586+infer' :: Expr -> UnifyT Type Check Expr
587infer' v@(NumericLiteral _) = return $ TypedValue True v tyNumber
587infer' v@(NumericLiteral _) = return $ TypedValue True v tyNumber
588infer' v@(StringLiteral _) = return $ TypedValue True v tyString
588infer' v@(StringLiteral _) = return $ TypedValue True v tyString
589infer' v@(BooleanLiteral _) = return $ TypedValue True v tyBoolean
589infer' v@(BooleanLiteral _) = return $ TypedValue True v tyBoolean
@@ -670,7 +670,7 @@ infer' (TypedValue checkType val ty) = do
670infer' (PositionedValue pos val) = rethrowWithPosition pos $ infer' val
670infer' (PositionedValue pos val) = rethrowWithPosition pos $ infer' val
671infer' _ = error "Invalid argument to infer"
671infer' _ = error "Invalid argument to infer"
673−inferLetBinding :: [Declaration] -> [Declaration] -> Value -> (Value -> UnifyT Type Check Value) -> UnifyT Type Check ([Declaration], Value)
673+inferLetBinding :: [Declaration] -> [Declaration] -> Expr -> (Expr -> UnifyT Type Check Expr) -> UnifyT Type Check ([Declaration], Expr)
674inferLetBinding seen [] ret j = (,) seen <$> makeBindingGroupVisible (j ret)
674inferLetBinding seen [] ret j = (,) seen <$> makeBindingGroupVisible (j ret)
675inferLetBinding seen (ValueDeclaration ident nameKind [] Nothing tv@(TypedValue checkType val ty) : rest) ret j = do
675inferLetBinding seen (ValueDeclaration ident nameKind [] Nothing tv@(TypedValue checkType val ty) : rest) ret j = do
676 Just moduleName <- checkCurrentModule <$> get
676 Just moduleName <- checkCurrentModule <$> get
@@ -810,7 +810,7 @@ skolemize ident sko scope = replaceTypeVars ident (Skolem ident sko scope)
810-- SuperClassDictionary placeholder. These type variables are somewhat unique since they are the
810-- SuperClassDictionary placeholder. These type variables are somewhat unique since they are the
811-- only example of scoped type variables.
811-- only example of scoped type variables.
813−skolemizeTypesInValue :: String -> Int -> SkolemScope -> Value -> Value
813+skolemizeTypesInValue :: String -> Int -> SkolemScope -> Expr -> Expr
814skolemizeTypesInValue ident sko scope = let (_, f, _) = everywhereOnValues id go id in f
814skolemizeTypesInValue ident sko scope = let (_, f, _) = everywhereOnValues id go id in f
816 go (SuperClassDictionary c ts) = SuperClassDictionary c (map (skolemize ident sko scope) ts)
816 go (SuperClassDictionary c ts) = SuperClassDictionary c (map (skolemize ident sko scope) ts)
@@ -828,8 +828,8 @@ introduceSkolemScope = everywhereOnTypesM go
829-- Check the type of a value, rethrowing errors to provide a better error message
829-- Check the type of a value, rethrowing errors to provide a better error message
831−check :: Value -> Type -> UnifyT Type Check Value
831+check :: Expr -> Type -> UnifyT Type Check Expr
832−check val ty = rethrow (mkErrorStack errorMessage (Just (ValueError val)) <>) $ check' val ty
832+check val ty = rethrow (mkErrorStack errorMessage (Just (ExprError val)) <>) $ check' val ty
834 errorMessage =
834 errorMessage =
835 "Error checking type of term " ++
835 "Error checking type of term " ++
@@ -840,7 +840,7 @@ check val ty = rethrow (mkErrorStack errorMessage (Just (ValueError val)) <>) $
841-- Check the type of a value
841-- Check the type of a value
843−check' :: Value -> Type -> UnifyT Type Check Value
843+check' :: Expr -> Type -> UnifyT Type Check Expr
844check' val (ForAll ident ty _) = do
844check' val (ForAll ident ty _) = do
845 scope <- newSkolemScope
845 scope <- newSkolemScope
846 sko <- newSkolemConstant
846 sko <- newSkolemConstant
@@ -963,7 +963,7 @@ check' val ty | containsTypeSynonyms ty = do
963 check val ty'
963 check val ty'
964check' (PositionedValue pos val) ty =
964check' (PositionedValue pos val) ty =
965 rethrowWithPosition pos $ check val ty
965 rethrowWithPosition pos $ check val ty
966−check' val ty = throwError $ mkErrorStack ("Value does not have type " ++ prettyPrintType ty) (Just (ValueError val))
966+check' val ty = throwError $ mkErrorStack ("Expr does not have type " ++ prettyPrintType ty) (Just (ExprError val))
968containsTypeSynonyms :: Type -> Bool
968containsTypeSynonyms :: Type -> Bool
969containsTypeSynonyms = everythingOnTypes (||) go where
969containsTypeSynonyms = everythingOnTypes (||) go where
@@ -975,15 +975,15 @@ containsTypeSynonyms = everythingOnTypes (||) go where
976-- The @lax@ parameter controls whether or not every record member has to be provided. For object updates, this is not the case.
976-- The @lax@ parameter controls whether or not every record member has to be provided. For object updates, this is not the case.
978−checkProperties :: [(String, Value)] -> Type -> Bool -> UnifyT Type Check [(String, Value)]
978+checkProperties :: [(String, Expr)] -> Type -> Bool -> UnifyT Type Check [(String, Expr)]
979checkProperties ps row lax = let (ts, r') = rowToList row in go ps ts r' where
979checkProperties ps row lax = let (ts, r') = rowToList row in go ps ts r' where
980 go [] [] REmpty = return []
980 go [] [] REmpty = return []
981 go [] [] u@(TUnknown _) = do u =?= REmpty
981 go [] [] u@(TUnknown _) = do u =?= REmpty
982 return []
982 return []
983 go [] [] (Skolem _ _ _) | lax = return []
983 go [] [] (Skolem _ _ _) | lax = return []
984 go [] ((p, _): _) _ | lax = return []
984 go [] ((p, _): _) _ | lax = return []
985− | otherwise = throwError $ mkErrorStack ("Object does not have property " ++ p) (Just (ValueError (ObjectLiteral ps)))
985+ | otherwise = throwError $ mkErrorStack ("Object does not have property " ++ p) (Just (ExprError (ObjectLiteral ps)))
986− go ((p,_):_) [] REmpty = throwError $ mkErrorStack ("Property " ++ p ++ " is not present in closed object type " ++ prettyPrintRow row) (Just (ValueError (ObjectLiteral ps)))
986+ go ((p,_):_) [] REmpty = throwError $ mkErrorStack ("Property " ++ p ++ " is not present in closed object type " ++ prettyPrintRow row) (Just (ExprError (ObjectLiteral ps)))
987 go ((p,v):ps') [] u@(TUnknown _) = do
987 go ((p,v):ps') [] u@(TUnknown _) = do
988 v'@(TypedValue _ _ ty) <- infer v
988 v'@(TypedValue _ _ ty) <- infer v
989 rest <- fresh
989 rest <- fresh
@@ -1002,13 +1002,13 @@ checkProperties ps row lax = let (ts, r') = rowToList row in go ps ts r' where
1002 v' <- check v ty
1002 v' <- check v ty
1003 ps'' <- go ps' (delete (p, ty) ts) r
1003 ps'' <- go ps' (delete (p, ty) ts) r
1004 return $ (p, v') : ps''
1004 return $ (p, v') : ps''
1005− go _ _ _ = throwError $ mkErrorStack ("Object does not have type " ++ prettyPrintType (TypeApp tyObject row)) (Just (ValueError (ObjectLiteral ps)))
1005+ go _ _ _ = throwError $ mkErrorStack ("Object does not have type " ++ prettyPrintType (TypeApp tyObject row)) (Just (ExprError (ObjectLiteral ps)))
1008-- Check the type of a function application, rethrowing errors to provide a better error message
1008-- Check the type of a function application, rethrowing errors to provide a better error message
1010−checkFunctionApplication :: Value -> Type -> Value -> Maybe Type -> UnifyT Type Check (Type, Value)
1010+checkFunctionApplication :: Expr -> Type -> Expr -> Maybe Type -> UnifyT Type Check (Type, Expr)
1011−checkFunctionApplication fn fnTy arg ret = rethrow (mkErrorStack errorMessage (Just (ValueError fn)) <>) $ do
1011+checkFunctionApplication fn fnTy arg ret = rethrow (mkErrorStack errorMessage (Just (ExprError fn)) <>) $ do
1012 subst <- unifyCurrentSubstitution <$> UnifyT get
1012 subst <- unifyCurrentSubstitution <$> UnifyT get
1013 checkFunctionApplication' fn (subst $? fnTy) arg (($?) subst <$> ret)
1013 checkFunctionApplication' fn (subst $? fnTy) arg (($?) subst <$> ret)
@@ -1019,7 +1019,7 @@ checkFunctionApplication fn fnTy arg ret = rethrow (mkErrorStack errorMessage (J
1020-- Check the type of a function application
1020-- Check the type of a function application
1022−checkFunctionApplication' :: Value -> Type -> Value -> Maybe Type -> UnifyT Type Check (Type, Value)
1022+checkFunctionApplication' :: Expr -> Type -> Expr -> Maybe Type -> UnifyT Type Check (Type, Expr)
1023checkFunctionApplication' fn (TypeApp (TypeApp tyFunction' argTy) retTy) arg ret = do
1023checkFunctionApplication' fn (TypeApp (TypeApp tyFunction' argTy) retTy) arg ret = do
1024 tyFunction' =?= tyFunction
1024 tyFunction' =?= tyFunction
1025 arg' <- check arg argTy
1025 arg' <- check arg argTy
@@ -1053,8 +1053,8 @@ checkFunctionApplication' _ fnTy arg _ = throwError . strMsg $ "Cannot apply a f
1054-- Check whether one type subsumes another, rethrowing errors to provide a better error message
1054-- Check whether one type subsumes another, rethrowing errors to provide a better error message
1056−subsumes :: Maybe Value -> Type -> Type -> UnifyT Type Check (Maybe Value)
1056+subsumes :: Maybe Expr -> Type -> Type -> UnifyT Type Check (Maybe Expr)
1057−subsumes val ty1 ty2 = rethrow (mkErrorStack errorMessage (ValueError <$> val) <>) $ subsumes' val ty1 ty2
1057+subsumes val ty1 ty2 = rethrow (mkErrorStack errorMessage (ExprError <$> val) <>) $ subsumes' val ty1 ty2
1059 errorMessage = "Error checking that type "
1059 errorMessage = "Error checking that type "
1060 ++ prettyPrintType ty1
1060 ++ prettyPrintType ty1
@@ -1064,7 +1064,7 @@ subsumes val ty1 ty2 = rethrow (mkErrorStack errorMessage (ValueError <$> val) <
1065-- Check whether one type subsumes another
1065-- Check whether one type subsumes another
1067−subsumes' :: Maybe Value -> Type -> Type -> UnifyT Type Check (Maybe Value)
1067+subsumes' :: Maybe Expr -> Type -> Type -> UnifyT Type Check (Maybe Expr)
1068subsumes' val (ForAll ident ty1 _) ty2 = do
1068subsumes' val (ForAll ident ty1 _) ty2 = do
1069 replaced <- replaceVarWithUnknown ident ty1
1069 replaced <- replaceVarWithUnknown ident ty1
1070 subsumes val replaced ty2
1070 subsumes val replaced ty2