Skip to content

in comment evaluation works for pure function not with IO sideeffect on vscode windows #4506

Closed
@Reventum

Description

@Reventum

Your environment

Your environment
Which OS do you use?
windows 10

Which version of GHC do you use and how did you install it?
ghc 9.8.4 / tried other versions 9.2.2 same issue

How is your project built (alternative: link to the project)?
stack build

Which LSP client (editor/plugin) do you use?

vscode latest + extension Haskell v2.4.4

Which version of HLS do you use and how did you install it?
hls v 2.9.0.1
ghcup installed it

Have you configured HLS in any way (especially: a hie.yaml file)?
no

Steps to reproduce

stack new project

in any hs file

add in comment evaluation

someFunc :: IO ()
someFunc = putStrLn "someFunc"

pureFunc :: String
pureFunc = "someFunc"

-- >>> someFunc

-- >>> pureFunc

Expected behaviour

-- >>> someFunc
-- "someFunc"

-- >>> pureFunc
-- "someFunc"

Actual behaviour

-- >>> someFunc

-- >>> pureFunc
-- "someFunc"

Debug information

verbose log trace of hls in vscode output window trying to evaluate first pureFunc that works then someFunc fails
with no response

[Trace - 11:52:52 AM] Sending request 'textDocument/hover - (187)'.
Params: {
    "textDocument": {
        "uri": "file:///c%3A/Users/rjber/Documents/stick/haskellUnCourse/AdvancedCourse/course/src/Lib.hs"
    },
    "position": {
        "line": 19,
        "character": 3
    }
}


[Trace - 11:52:52 AM] Received response 'textDocument/hover - (187)' in 5ms.
Result: {
    "contents": {
        "kind": "markdown",
        "value": ""
    },
    "range": {
        "end": {
            "character": 26,
            "line": 38
        },
        "start": {
            "character": 6,
            "line": 3
        }
    }
}


[Trace - 11:52:59 AM] Sending request 'workspace/executeCommand - (188)'.
Params: {
    "command": "5940:eval:evalCommand",
    "arguments": [
        {
            "evalId": 3,
            "module_": {
                "uri": "file:///c%3A/Users/rjber/Documents/stick/haskellUnCourse/AdvancedCourse/course/src/Lib.hs"
            },
            "sections": [
                {
                    "sectionFormat": {
                        "tag": "SingleLine"
                    },
                    "sectionLanguage": "Plain",
                    "sectionName": "",
                    "sectionTests": [
                        {
                            "tag": "Example",
                            "testLines": [
                                " pureFunc"
                            ],
                            "testOutput": [
                                "\"someFunc\""
                            ],
                            "testRange": {
                                "end": {
                                    "character": 15,
                                    "line": 19
                                },
                                "start": {
                                    "character": 0,
                                    "line": 19
                                }
                            }
                        }
                    ]
                }
            ]
        }
    ]
}



<interactive>:1:1: warning: [-Wmissing-export-lists]
    The export item ‘module Ghci1’ is missing an export list
[Trace - 11:52:59 AM] Received request 'workspace/applyEdit - (34)'.
Params: {
    "edit": {
        "changes": {
            "file:///c%3A/Users/rjber/Documents/stick/haskellUnCourse/AdvancedCourse/course/src/Lib.hs": [
                {
                    "newText": "-- \"someFunc\"\n",
                    "range": {
                        "end": {
                            "character": 0,
                            "line": 21
                        },
                        "start": {
                            "character": 0,
                            "line": 20
                        }
                    }
                }
            ]
        }
    }
}


[Trace - 11:52:59 AM] Received response 'workspace/executeCommand - (188)' in 90ms.
No result returned.


[Trace - 11:52:59 AM] Sending response 'workspace/applyEdit - (34)'. Processing request took 32ms
Result: {
    "applied": true
}


[Trace - 11:53:12 AM] Sending request 'workspace/executeCommand - (189)'.
Params: {
    "command": "5940:eval:evalCommand",
    "arguments": [
        {
            "evalId": 2,
            "module_": {
                "uri": "file:///c%3A/Users/rjber/Documents/stick/haskellUnCourse/AdvancedCourse/course/src/Lib.hs"
            },
            "sections": [
                {
                    "sectionFormat": {
                        "tag": "SingleLine"
                    },
                    "sectionLanguage": "Plain",
                    "sectionName": "",
                    "sectionTests": [
                        {
                            "tag": "Example",
                            "testLines": [
                                " someFunc"
                            ],
                            "testOutput": [],
                            "testRange": {
                                "end": {
                                    "character": 15,
                                    "line": 17
                                },
                                "start": {
                                    "character": 0,
                                    "line": 17
                                }
                            }
                        }
                    ]
                }
            ]
        }
    ]
}



<interactive>:1:1: warning: [-Wmissing-export-lists]
    The export item ‘module Ghci1’ is missing an export list
[Trace - 11:53:12 AM] Received request 'workspace/applyEdit - (35)'.
Params: {
    "edit": {
        "changes": {
            "file:///c%3A/Users/rjber/Documents/stick/haskellUnCourse/AdvancedCourse/course/src/Lib.hs": [
                {
                    "newText": "",
                    "range": {
                        "end": {
                            "character": 0,
                            "line": 18
                        },
                        "start": {
                            "character": 0,
                            "line": 18
                        }
                    }
                }
            ]
        }
    }
}


[Trace - 11:53:12 AM] Received response 'workspace/executeCommand - (189)' in 40ms.
No result returned.


[Trace - 11:53:12 AM] Sending response 'workspace/applyEdit - (35)'. Processing request took 113ms
Result: {
    "applied": true
}


2025-02-25T10:53:45.614885Z | Info | Live bytes: 66.48MB Heap size: 1013.97MB
2025-02-25T10:54:45.617790Z | Info | Live bytes: 66.48MB Heap size: 1013.97MB
2025-02-25T10:55:45.619090Z | Info | Live bytes: 66.48MB Heap size: 1013.97MB
2025-02-25T10:56:45.621220Z | Info | Live bytes: 66.48MB Heap size: 1013.97MB
2025-02-25T10:57:45.623990Z | Info | Live bytes: 66.48MB Heap size: 1013.97MB
2025-02-25T10:58:45.625772Z | Info | Live bytes: 66.48MB Heap size: 1013.97MB
2025-02-25T10:59:45.628328Z | Info | Live bytes: 66.48MB Heap size: 1013.97MB
2025-02-25T11:00:45.635434Z | Info | Live bytes: 66.48MB Heap size: 1013.97MB
2025-02-25T11:01:45.646184Z | Info | Live bytes: 66.48MB Heap size: 1013.97MB
2025-02-25T11:02:45.655985Z | Info | Live bytes: 66.48MB Heap size: 1013.97MB
2025-02-25T11:03:45.669175Z | Info | Live bytes: 66.48MB Heap size: 1013.97MB
2025-02-25T11:04:45.684078Z | Info | Live bytes: 66.48MB Heap size: 1013.97MB
[Trace - 12:05:38 PM] Sending request 'textDocument/codeLens - (190)'.
Params: {
    "textDocument": {
        "uri": "file:///c%3A/Users/rjber/Documents/stick/haskellUnCourse/AdvancedCourse/course/src/Lib.hs"
    }
}


[Trace - 12:05:38 PM] Received response 'textDocument/codeLens - (190)' in 8ms.
Result: [
    {
        "command": {
            "arguments": [
                {
                    "evalId": 2,
                    "module_": {
                        "uri": "file:///c%3A/Users/rjber/Documents/stick/haskellUnCourse/AdvancedCourse/course/src/Lib.hs"
                    },
                    "sections": [
                        {
                            "sectionFormat": {
                                "tag": "SingleLine"
                            },
                            "sectionLanguage": "Plain",
                            "sectionName": "",
                            "sectionTests": [
                                {
                                    "tag": "Example",
                                    "testLines": [
                                        " someFunc"
                                    ],
                                    "testOutput": [],
                                    "testRange": {
                                        "end": {
                                            "character": 15,
                                            "line": 17
                                        },
                                        "start": {
                                            "character": 0,
                                            "line": 17
                                        }
                                    }
                                }
                            ]
                        }
                    ]
                }
            ],
            "command": "5940:eval:evalCommand",
            "title": "Evaluate..."
        },
        "range": {
            "end": {
                "character": 0,
                "line": 18
            },
            "start": {
                "character": 0,
                "line": 17
            }
        }
    },
    {
        "command": {
            "arguments": [
                {
                    "evalId": 3,
                    "module_": {
                        "uri": "file:///c%3A/Users/rjber/Documents/stick/haskellUnCourse/AdvancedCourse/course/src/Lib.hs"
                    },
                    "sections": [
                        {
                            "sectionFormat": {
                                "tag": "SingleLine"
                            },
                            "sectionLanguage": "Plain",
                            "sectionName": "",
                            "sectionTests": [
                                {
                                    "tag": "Example",
                                    "testLines": [
                                        " pureFunc"
                                    ],
                                    "testOutput": [
                                        "\"someFunc\""
                                    ],
                                    "testRange": {
                                        "end": {
                                            "character": 15,
                                            "line": 19
                                        },
                                        "start": {
                                            "character": 0,
                                            "line": 19
                                        }
                                    }
                                }
                            ]
                        }
                    ]
                }
            ],
            "command": "5940:eval:evalCommand",
            "title": "Refresh..."
        },
        "range": {
            "end": {
                "character": 0,
                "line": 20
            },
            "start": {
                "character": 0,
                "line": 19
            }
        }
    },
    {
        "command": {
            "arguments": [
                {
                    "evalId": 4,
                    "module_": {
                        "uri": "file:///c%3A/Users/rjber/Documents/stick/haskellUnCourse/AdvancedCourse/course/src/Lib.hs"
                    },
                    "sections": [
                        {
                            "sectionFormat": {
                                "tag": "SingleLine"
                            },
                            "sectionLanguage": "Plain",
                            "sectionName": "",
                            "sectionTests": [
                                {
                                    "tag": "Example",
                                    "testLines": [
                                        " MkPoint 2.0 4.0 "
                                    ],
                                    "testOutput": [
                                        "MkPoint {xcoord = 2.0, ycoord = 4.0}"
                                    ],
                                    "testRange": {
                                        "end": {
                                            "character": 23,
                                            "line": 40
                                        },
                                        "start": {
                                            "character": 0,
                                            "line": 40
                                        }
                                    }
                                }
                            ]
                        }
                    ]
                }
            ],
            "command": "5940:eval:evalCommand",
            "title": "Refresh..."
        },
        "range": {
            "end": {
                "character": 0,
                "line": 41
            },
            "start": {
                "character": 0,
                "line": 40
            }
        }
    }
]


2025-02-25T11:05:45.700030Z | Info | Live bytes: 66.48MB Heap size: 1013.97MB
2025-02-25T11:06:45.704211Z | Info | Live bytes: 66.48MB Heap size: 1013.97MB
[Trace - 12:06:52 PM] Sending request 'textDocument/hover - (191)'.
Params: {
    "textDocument": {
        "uri": "file:///c%3A/Users/rjber/Documents/stick/haskellUnCourse/AdvancedCourse/course/src/Lib.hs"
    },
    "position": {
        "line": 23,
        "character": 10
    }
}


[Trace - 12:06:52 PM] Received response 'textDocument/hover - (191)' in 5ms.
Result: {
    "contents": {
        "kind": "markdown",
        "value": "\n```haskell\nPoint :: Type\n```\n\n*Defined at C:\\Users\\rjber\\Documents\\stick\\haskellUnCourse\\AdvancedCourse\\course\\src\\Lib.hs:24:1*\n\n"
    },
    "range": {
        "end": {
            "character": 10,
            "line": 23
        },
        "start": {
            "character": 5,
            "line": 23
        }
    }
}


[Trace - 12:06:54 PM] Sending request 'textDocument/codeLens - (192)'.
Params: {
    "textDocument": {
        "uri": "file:///c%3A/Users/rjber/Documents/stick/haskellUnCourse/AdvancedCourse/course/src/Lib.hs"
    }
}


[Trace - 12:06:54 PM] Received response 'textDocument/codeLens - (192)' in 5ms.
Result: [
    {
        "command": {
            "arguments": [
                {
                    "evalId": 2,
                    "module_": {
                        "uri": "file:///c%3A/Users/rjber/Documents/stick/haskellUnCourse/AdvancedCourse/course/src/Lib.hs"
                    },
                    "sections": [
                        {
                            "sectionFormat": {
                                "tag": "SingleLine"
                            },
                            "sectionLanguage": "Plain",
                            "sectionName": "",
                            "sectionTests": [
                                {
                                    "tag": "Example",
                                    "testLines": [
                                        " someFunc"
                                    ],
                                    "testOutput": [],
                                    "testRange": {
                                        "end": {
                                            "character": 15,
                                            "line": 17
                                        },
                                        "start": {
                                            "character": 0,
                                            "line": 17
                                        }
                                    }
                                }
                            ]
                        }
                    ]
                }
            ],
            "command": "5940:eval:evalCommand",
            "title": "Evaluate..."
        },
        "range": {
            "end": {
                "character": 0,
                "line": 18
            },
            "start": {
                "character": 0,
                "line": 17
            }
        }
    },
    {
        "command": {
            "arguments": [
                {
                    "evalId": 3,
                    "module_": {
                        "uri": "file:///c%3A/Users/rjber/Documents/stick/haskellUnCourse/AdvancedCourse/course/src/Lib.hs"
                    },
                    "sections": [
                        {
                            "sectionFormat": {
                                "tag": "SingleLine"
                            },
                            "sectionLanguage": "Plain",
                            "sectionName": "",
                            "sectionTests": [
                                {
                                    "tag": "Example",
                                    "testLines": [
                                        " pureFunc"
                                    ],
                                    "testOutput": [
                                        "\"someFunc\""
                                    ],
                                    "testRange": {
                                        "end": {
                                            "character": 15,
                                            "line": 19
                                        },
                                        "start": {
                                            "character": 0,
                                            "line": 19
                                        }
                                    }
                                }
                            ]
                        }
                    ]
                }
            ],
            "command": "5940:eval:evalCommand",
            "title": "Refresh..."
        },
        "range": {
            "end": {
                "character": 0,
                "line": 20
            },
            "start": {
                "character": 0,
                "line": 19
            }
        }
    },
    {
        "command": {
            "arguments": [
                {
                    "evalId": 4,
                    "module_": {
                        "uri": "file:///c%3A/Users/rjber/Documents/stick/haskellUnCourse/AdvancedCourse/course/src/Lib.hs"
                    },
                    "sections": [
                        {
                            "sectionFormat": {
                                "tag": "SingleLine"
                            },
                            "sectionLanguage": "Plain",
                            "sectionName": "",
                            "sectionTests": [
                                {
                                    "tag": "Example",
                                    "testLines": [
                                        " MkPoint 2.0 4.0 "
                                    ],
                                    "testOutput": [
                                        "MkPoint {xcoord = 2.0, ycoord = 4.0}"
                                    ],
                                    "testRange": {
                                        "end": {
                                            "character": 23,
                                            "line": 40
                                        },
                                        "start": {
                                            "character": 0,
                                            "line": 40
                                        }
                                    }
                                }
                            ]
                        }
                    ]
                }
            ],
            "command": "5940:eval:evalCommand",
            "title": "Refresh..."
        },
        "range": {
            "end": {
                "character": 0,
                "line": 41
            },
            "start": {
                "character": 0,
                "line": 40
            }
        }
    }
]


[Trace - 12:06:54 PM] Sending request 'textDocument/codeAction - (193)'.
Params: {
    "textDocument": {
        "uri": "file:///c%3A/Users/rjber/Documents/stick/haskellUnCourse/AdvancedCourse/course/src/Lib.hs"
    },
    "range": {
        "start": {
            "line": 16,
            "character": 0
        },
        "end": {
            "line": 20,
            "character": 13
        }
    },
    "context": {
        "diagnostics": []
    }
}


[Trace - 12:06:54 PM] Received response 'textDocument/codeAction - (193)' in 25ms.
Result: []


[Trace - 12:06:55 PM] Sending request 'textDocument/codeAction - (194)'.
Params: {
    "textDocument": {
        "uri": "file:///c%3A/Users/rjber/Documents/stick/haskellUnCourse/AdvancedCourse/course/src/Lib.hs"
    },
    "range": {
        "start": {
            "line": 11,
            "character": 0
        },
        "end": {
            "line": 20,
            "character": 13
        }
    },
    "context": {
        "diagnostics": []
    }
}


[Trace - 12:06:55 PM] Received response 'textDocument/codeAction - (194)' in 25ms.
Result: []


2025-02-25T11:07:45.707681Z | Info | Live bytes: 66.48MB Heap size: 1013.97MB
2025-02-25T11:08:45.712217Z | Info | Live bytes: 66.48MB Heap size: 1013.97MB
2025-02-25T11:09:45.726021Z | Info | Live bytes: 66.48MB Heap size: 1013.97MB
[Trace - 12:09:50 PM] Sending request 'textDocument/hover - (195)'.
Params: {
    "textDocument": {
        "uri": "file:///c%3A/Users/rjber/Documents/stick/haskellUnCourse/AdvancedCourse/course/src/Lib.hs"
    },
    "position": {
        "line": 38,
        "character": 8
    }
}


[Trace - 12:09:50 PM] Received response 'textDocument/hover - (195)' in 5ms.
Result: {
    "contents": {
        "kind": "markdown",
        "value": "\n```haskell\naprojonX :: Point\n```\n\n*Defined at C:\\Users\\rjber\\Documents\\stick\\haskellUnCourse\\AdvancedCourse\\course\\src\\Lib.hs:39:1*\n\n"
    },
    "range": {
        "end": {
            "character": 8,
            "line": 38
        },
        "start": {
            "character": 0,
            "line": 38
        }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: needs triagetype: bugSomething isn't right: doesn't work as intended, documentation is missing/outdated, etc..

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions