@@ -141,7 +141,7 @@ checkTypedBindingGroupElement mn (ident, (val', ty, checkType)) dict = do
141141 ty' <- replaceTypeWildcards ty
142142 -- Kind check
143143 (kind, args) <- liftCheck $ kindOfWithScopedVars ty
144− checkTypeKind kind
144+ checkTypeKind ty kind
145145 -- Check the type with the new names in scope
146146 ty'' <- introduceSkolemScope <=< replaceAllTypeSynonyms <=< replaceTypeWildcards $ ty'
147147 val'' <- if checkType
@@ -190,8 +190,8 @@ replaceTypeClassDictionaries mn =
190190-- |
191191-- Check the kind of a type, failing if it is not of kind *.
192192--
193−checkTypeKind :: Kind -> UnifyT t Check ()
194−checkTypeKind kind = guardWith (errorMessage (ExpectedType kind)) $ kind == Star
193+checkTypeKind :: Type -> Kind -> UnifyT t Check ()
194+checkTypeKind ty kind = guardWith (errorMessage (ExpectedType ty kind)) $ kind == Star
195195
196196-- |
197197-- Remove any ForAlls and ConstrainedType constructors in a type by introducing new unknowns
@@ -301,7 +301,7 @@ infer' (SuperClassDictionary className tys) = do
301301infer' (TypedValue checkType val ty) = do
302302 Just moduleName <- checkCurrentModule <$> get
303303 (kind, args) <- liftCheck $ kindOfWithScopedVars ty
304− checkTypeKind kind
304+ checkTypeKind ty kind
305305 ty' <- introduceSkolemScope <=< replaceAllTypeSynonyms <=< replaceTypeWildcards $ ty
306306 val' <- if checkType then withScopedTypeVars moduleName args (check val ty') else return val
307307 return $ TypedValue True val' ty'
@@ -313,7 +313,7 @@ inferLetBinding seen [] ret j = (,) seen <$> withBindingGroupVisible (j ret)
313313inferLetBinding seen (ValueDeclaration ident nameKind [] (Right (tv@(TypedValue checkType val ty))) : rest) ret j = do
314314 Just moduleName <- checkCurrentModule <$> get
315315 (kind, args) <- liftCheck $ kindOfWithScopedVars ty
316− checkTypeKind kind
316+ checkTypeKind ty kind
317317 let dict = M.singleton (moduleName, ident) (ty, nameKind, Undefined)
318318 ty' <- introduceSkolemScope <=< replaceAllTypeSynonyms <=< replaceTypeWildcards $ ty
319319 TypedValue _ val' ty'' <- if checkType then withScopedTypeVars moduleName args (bindNames dict (check val ty')) else return tv
@@ -527,7 +527,7 @@ check' (SuperClassDictionary className tys) _ = do
527527check' (TypedValue checkType val ty1) ty2 = do
528528 Just moduleName <- checkCurrentModule <$> get
529529 (kind, args) <- liftCheck $ kindOfWithScopedVars ty1
530− checkTypeKind kind
530+ checkTypeKind ty1 kind
531531 ty1' <- introduceSkolemScope <=< replaceAllTypeSynonyms <=< replaceTypeWildcards $ ty1
532532 ty2' <- introduceSkolemScope <=< replaceAllTypeSynonyms <=< replaceTypeWildcards $ ty2
533533 val' <- subsumes (Just val) ty1' ty2'
@@ -582,7 +582,7 @@ check' val ty | containsTypeSynonyms ty = do
582582 ty' <- introduceSkolemScope <=< expandAllTypeSynonyms <=< replaceTypeWildcards $ ty
583583 check val ty'
584584check' val kt@(KindedType ty kind) = do
585− checkTypeKind kind
585+ checkTypeKind ty kind
586586 val' <- check' val ty
587587 return $ TypedValue True val' kt
588588check' (PositionedValue pos _ val) ty =