-
Notifications
You must be signed in to change notification settings - Fork 217
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
Multi-line REPL #1867
Multi-line REPL #1867
Conversation
]; | ||
testHaskellDepends = [ base containers mtl process ]; | ||
doHaddock = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we're hitting a weird GHC 8.4.4 haddock bug:
Haddock coverage:
src/System/Console/Repline.hs:266:3: error:
parse error on input ‘-- | banner function’
|
266 | -- | banner function
| ^^^^^^^^^^^^^^^^^^^^
This does not happen with GHC 8.6.5!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like something that would be good to fix in time for 0.4!
Also good to check in CI…
EDIT: Reported in sdiehl/repline#31
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed upstream!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's broken again, it's originally an ormolu
issue and it is marked as wontfix: tweag/ormolu#624
Let me clarify our general problem first, since it may help with future work. ProblemI can't add a breakpoint or print statement in a dhall file. This is important when reviewing and changing functions, not really when doing record operations. Decent solutionFolks want to copy a file up to some let binding and paste it into a repl. Problem with solution: loading things into a repl means I have to go add :save / :load ?We use If multiline paste improvements could eventually handle a serious of Mutli-lineThis will help enormously for k8s examples as-is. This will help the seed files' readability (not one massively long line of minimal k8s config). And, this will help with getting more folks working in the repl with large expressions. Thank you! |
f4b03e5
to
b026a2e
Compare
@thebritican Thanks for the explanation! The multi-line feature did end up breaking the ➜ dhall repl
Welcome to the Dhall v1.33.0 REPL! Type :help for more information.
⊢ :paste
-- Entering multi-line mode. Press <Ctrl-D> to finish.
| :let simple-multi-line =
| 2 +
| 2
|
simple-multi-line : Natural
⊢ simple-multi-line
4
⊢ :paste
-- Entering multi-line mode. Press <Ctrl-D> to finish.
| :let string-multi-line = ''
| Hello
| World
| ''
|
string-multi-line : Text
⊢ string-multi-line
''
Hello
World
''
⊢ :save test-file
Context saved to `test-file` ➜ cat test-file
:let simple-multi-line = 4
:let string-multi-line = ''
Hello
World
'' That was a problem for the Does that completely solve your issue or do you think there is still something that would be needed in order to seed the environment that goes with the docs? As a side note, I don't know how much you should be relying on the exact format of serialisation used by the Dhall REPL. There are no specs for it and it's very much a ad-hoc format at the moment 😅 |
I'll have to try it out to be sure but the snippets look great to me! This is what i was hoping for when creating the original issue |
@basile-henry: It looks like
|
To fix some of the build failures, I think you will need to:
|
This version of repline enabled multi-line inputs
b026a2e
to
a6452cf
Compare
I do have an issue with the stack setup. For some reason
I don't understand why this is happening because as far as I can tell |
@basile-henry: I pushed a couple of changes which will hopefully fix the build failures (or at least get further) |
Great thanks! 🤞 |
@basile-henry: Great work! Thank you for doing this 🙂 |
Just tried this in the new It even works with
Thanks @basile-henry and everyone else involved! :) |
The actual multi-line logic is implemented in the upcoming
repline
0.4 release. This PR simply updates the REPL code to use this new release.I wanted to open this draft PR to gather some feedback on the feature and see if there was anything missing. If/when the feedback is positive, and I'm sure no extra feature will be needed on the
repline
side of things, I will ask for a new release to be cut, and then update this PR to use the Hackage release.To summarize the feature:
:paste
command<Ctrl-D>
to finish/submit the multi-line input:paste
(only one command per multi-line input)@thebritican Does this resolve #1680? Reading the issue once again, I am not sure I understand exactly how
:load
and:save
are used as part of some documentation. Are you giving to your readers a file to:load
?I think I need to have a closer look at the interaction of this multi-line input with the
:load
/:save
feature, as the format is line based. Hopefully it's not completely broken and I can make it work. 🤞