@@ -680,7 +680,7 @@ infer' (TypedValue checkType val ty) = do
680680 Just moduleName <- checkCurrentModule <$> get
681681 kind <- liftCheck $ kindOf moduleName ty
682682 guardWith (strMsg $ "Expected type of kind *, was " ++ prettyPrintKind kind) $ kind == Star
683− ty' <- introduceSkolemScope <=< replaceAllTypeSynonyms $ ty
683+ ty' <- introduceSkolemScope <=< replaceAllTypeSynonyms $ ty
684684 val' <- if checkType then check val ty' else return val
685685 return $ TypedValue True val' ty'
686686infer' (PositionedValue pos val) = rethrowWithPosition pos $ infer' val
@@ -693,8 +693,9 @@ inferLetBinding seen (ValueDeclaration ident nameKind [] Nothing tv@(TypedValue
693693 kind <- liftCheck $ kindOf moduleName ty
694694 guardWith (strMsg $ "Expected type of kind *, was " ++ prettyPrintKind kind) $ kind == Star
695695 let dict = if isFunction val then M.singleton (moduleName, ident) (ty, nameKind) else M.empty
696− TypedValue _ val' ty' <- if checkType then bindNames dict (check val ty) else return tv
697− bindNames (M.singleton (moduleName, ident) (ty', nameKind)) $ inferLetBinding (seen ++ [ValueDeclaration ident nameKind [] Nothing (TypedValue checkType val' ty')]) rest ret j
696+ ty' <- introduceSkolemScope <=< replaceAllTypeSynonyms $ ty
697+ TypedValue _ val' ty'' <- if checkType then bindNames dict (check val ty') else return tv
698+ bindNames (M.singleton (moduleName, ident) (ty'', nameKind)) $ inferLetBinding (seen ++ [ValueDeclaration ident nameKind [] Nothing (TypedValue checkType val' ty'')]) rest ret j
698699inferLetBinding seen (ValueDeclaration ident nameKind [] Nothing val : rest) ret j = do
699700 valTy <- fresh
700701 Just moduleName <- checkCurrentModule <$> get