-
Notifications
You must be signed in to change notification settings - Fork 0
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
Quiet mode #29
Comments
Well, I figured out a way to do this with a zero parameter type class and I added it to a new branch with this commit. None of the things that print stuff out is being imported directly by the
and use it like this
The trick is: we don't define an instance in any of the normal source files. Instead, we define it in the We could add to the Another nice thing about this is that GHCi lets you redefine instances whenever you want, so we could change the settings without too much trouble (at least, we could define .ghci What does everyone think? Ugly hack or a reasonable solution? |
At some point, we should add something that tells the server not to try to send anything back at all if quiet mode is enabled. |
I'd give that 'reasonable hack' status... seems nice and neat to me, though it means you cannot modify the settings at runtime like you could with state/reader. Is that a problem? This paper might even worth reading: http://dl.acm.org/citation.cfm?id=1017481 I seem to remember it does something similar. |
@xich That's the paper I had in mind, ha. At first, I was thinking I would need reflection for it to work at all. Also actually, I just edited my comment above with regard to that. It depends on where you want to modify it. GHCi lets you redefine instances whenever you want (at any point using the REPL, you can enter If we need more than that, we'll probably need reflection using a technique like in that paper. |
I like that zero-parameter typeclass idea a lot better than my old |
Is there a use case where we would want to trigger "quiet mode" on/off programmatically instead of interactively, e.g. in a script or test suite? Also, at what point do we abandon the behemoth that our |
@ecaustin I'm not sure if we would want to change it inside a script, but with a test suite we always have control over the arguments we give to the The By a wrapper executable, do you mean something which would send everything we have as .ghci commands to the main The second one would probably be pretty tricky because we (I think) need to have a GHCi session continuously running so would might need some interprocess communication. If that's the case, I would also wonder how the Windows compatibility would work out. (Also, I figured out a hack to let us toggle quiet mode on and off with a |
Oh, it looks like it actually relies on something in the |
Evan and I discussed this yesterday and I agree with his suggestion of using a global |
I'm reopening this for continued discussion because I think there was some confusion about the comments I made. My suggestion was to initialize a reference in the main thread of the program and pass it around either explicitly or implicitly using a monad. I agree that the output behavior of the old shell was preferable, so I've removed your changes and redefined I've simultaneously switched If we want to make the behavior of By the way, this is in no way an indictment of you or the code you wrote. |
@ecaustin Haha, that's understandable. I'm not a big fan of It looks like it still prints all the output though, currently. Is that the expected behavior for the moment? |
Now it's my turn to have misunderstood things. If we want to silence the intermediate output from running scripts then we should transmit them in their entirety instead of step by step, such that the client only gets the final result. I believe this corresponds to @andygill's "deep embedding" version of the remote monad protocol. |
@ecaustin Oh, I see. There's been another miscommunication. I was intending quiet mode to be an optional switch to turn off intermediate output from scripts (which is the original HERMIT's default setting). Also I'm not positive, but I was under the impression that the end goal was to do the deep embedding style thing where we send everything over at the start. @andygill would know for sure. It seems to me that both modes could be useful: seeing intermediate steps could help with debugging scripts and, on the other hand, you might not want to have to print everything when you know that a transformation is working (or if you only want to take a look at the result of the last step without the overhead of printing every other step). |
I think what @ecaustin is getting at is this:
|
Yup, @xich nailed it on the head. |
It would be nice to have a command line switch that makes hermit-shell act more like hermit, by not displaying the result of every command run when it executes a script. When hermit runs a script, it only displays the state at the very end, after it runs every command.
Maybe the quiet mode should be on by default in hermit-shell too.
It looks like this is the line where it is being printed. Maybe we should wrap the existing
Shell
type in aReader
containing these kinds of options.The text was updated successfully, but these errors were encountered: