Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable eval plugin to run in its own terminal and enble terminal to be piped to a log file #4390

Open
theGhostJW opened this issue Aug 25, 2024 · 0 comments

Comments

@theGhostJW
Copy link

theGhostJW commented Aug 25, 2024

Is your enhancement request related to a problem? Please describe.

I just discovered that in VSCode the eval plugin logs to the Haskell Output window in addition adding the result to the code editor.

Code to Eval

-- >>> helloWorldNonInteractive
-- "DONE"
helloWorldNonInteractive :: IO Text
helloWorldNonInteractive = putStrLn "Hello, World!" >> pure "DONE"

VSCode Haskell Output

2024-08-24T23:53:08.298464Z | Info | Live bytes: 95.98MB Heap size: 718.27MB
2024-08-24T23:54:08.351720Z | Info | Live bytes: 95.98MB Heap size: 718.27MB
toIfaceIdDetails [DataConWrapper]
toIfaceIdDetails [DataConWrapper]
toIfaceIdDetails [DataConWrapper]
Hello, World!
2024-08-24T23:55:08.383369Z | Info | Live bytes: 95.98MB Heap size: 718.27MB

It is also apparent that the output that is interleaved with the HLS logs are not copied to file when that option is selected in VSCode settings.

haskell.log

2024-08-24T23:54:08.351135Z | Info | Live bytes: 95.98MB Heap size: 718.27MB
2024-08-24T23:55:08.382573Z | Info | Live bytes: 95.98MB Heap size: 718.27MB
2024-08-24T23:56:08.436285Z | Info | Live bytes: 95.98MB Heap size: 718.27MB
2024-08-24T23:57:08.481933Z | Info | Live bytes: 95.98MB Heap size: 718.27MB

Describe the solution you'd like

It would be awesome if there could be an option with the eval plugin to output to a separate output window, free of the noise of HLS logs and optionally log the same to a file. Better still if an interactive terminal could be used instead of a an output window. Interactive code seems to bork the current version hls eval (which is understandable given there is no way to interact with a program invoked via eval).

-- >>> helloWorld
-- "DONE"
helloWorld :: IO Text
helloWorld = do
  putStrLn "What is your name?"
  name <- T.getLine
  putStrLn $ "Hello, " <> toS name <> "!"
  pure "DONE"

this will cause a Connection got disposed error

Describe alternatives you've considered

A somewhat similar ux can be achieved with cabal repl or ghcid or more recently ghciwatch but it would be great to be able to do it all with eval

@theGhostJW theGhostJW changed the title enable eval plugin to run in its own terminal and enble terminal to be piped to a log file Enable eval plugin to run in its own terminal and enble terminal to be piped to a log file Aug 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants