@@ -680,7 +680,7 @@ infer' (TypedValue checkType val ty) = do
680 Just moduleName <- checkCurrentModule <$> get
680 Just moduleName <- checkCurrentModule <$> get
681 kind <- liftCheck $ kindOf moduleName ty
681 kind <- liftCheck $ kindOf moduleName ty
682 guardWith (strMsg $ "Expected type of kind *, was " ++ prettyPrintKind kind) $ kind == Star
682 guardWith (strMsg $ "Expected type of kind *, was " ++ prettyPrintKind kind) $ kind == Star
683− ty' <- introduceSkolemScope <=< replaceAllTypeSynonyms $ ty
683+ ty' <- introduceSkolemScope <=< replaceAllTypeSynonyms $ ty
684 val' <- if checkType then check val ty' else return val
684 val' <- if checkType then check val ty' else return val
685 return $ TypedValue True val' ty'
685 return $ TypedValue True val' ty'
686infer' (PositionedValue pos val) = rethrowWithPosition pos $ infer' val
686infer' (PositionedValue pos val) = rethrowWithPosition pos $ infer' val
@@ -693,8 +693,9 @@ inferLetBinding seen (ValueDeclaration ident nameKind [] Nothing tv@(TypedValue
693 kind <- liftCheck $ kindOf moduleName ty
693 kind <- liftCheck $ kindOf moduleName ty
694 guardWith (strMsg $ "Expected type of kind *, was " ++ prettyPrintKind kind) $ kind == Star
694 guardWith (strMsg $ "Expected type of kind *, was " ++ prettyPrintKind kind) $ kind == Star
695 let dict = if isFunction val then M.singleton (moduleName, ident) (ty, nameKind) else M.empty
695 let dict = if isFunction val then M.singleton (moduleName, ident) (ty, nameKind) else M.empty
696+ ty' <- introduceSkolemScope <=< replaceAllTypeSynonyms $ ty
696− TypedValue _ val' ty' <- if checkType then bindNames dict (check val ty) else return tv
697+ 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
698+ bindNames (M.singleton (moduleName, ident) (ty'', nameKind)) $ inferLetBinding (seen ++ [ValueDeclaration ident nameKind [] Nothing (TypedValue checkType val' ty'')]) rest ret j
698inferLetBinding seen (ValueDeclaration ident nameKind [] Nothing val : rest) ret j = do
699inferLetBinding seen (ValueDeclaration ident nameKind [] Nothing val : rest) ret j = do
699 valTy <- fresh
700 valTy <- fresh
700 Just moduleName <- checkCurrentModule <$> get
701 Just moduleName <- checkCurrentModule <$> get