Skip to content

Enhance simple eval plugin to allow evaluating within scope of functions #368

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

Open
codygman opened this issue Sep 1, 2020 · 1 comment

Comments

@codygman
Copy link

codygman commented Sep 1, 2020

Given this:

main = do
    let name = "codygman"
   -- >>> name
    in pure ()

I'd want the evaluation of name to work resulting in:

main = do
    let name = "codygman"
   -- >>> name
   -- codygman
    in pure ()

This would require bringing all bindings up to that point into scope. Typically I copy paste definitions in ghci like:

> let name = "codygman"
> name

I can see how this could be complex and have some edge cases, but the value of it would be immense especially for new Haskell users.

In fact this request comes because I was making an intro video "0 to Haskell ide in 5 minutes" type video and this feature was going to be the sort of centerpoint/ending to that video.

This would allow not really needing to use anything but haskell-language-server for development as well instead of having to open ghci for many cases. Regardless of whether that's always better, I think it's a good option to have.

I think this might be blocked or more difficult to implement if the current implementation isn't using -fexternal-interpreter as described here.

related: #94 #191 #51

@konn
Copy link
Collaborator

konn commented Sep 17, 2020

I find this feature really useful too! It could eliminate the infamous uses of trace function in many cases.

On the other hand, I think there are several corner cases to be considered.

For example, consider the following:

add n m =  do
  let k = n + m
  -- >>> m
  pure k

Then, what the result of >>> m must be?
That is, how could we define the "evaluation result" containing bound variables?

pepeiborra pushed a commit that referenced this issue Dec 27, 2020
* Add documentation for Util.hs

* Add documentation to OfInterest
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

3 participants