ku-fpg / hermit-shell

HERMIT with GHCi shell
BSD 3-Clause "New" or "Revised" License
2 stars 0 forks source link

`stopScript` not working #20

Closed roboguy13 closed 9 years ago

roboguy13 commented 9 years ago

This would be pretty useful when debugging examples. I've often found that it helps to comment everything out after a certain place in the code, so that I can look at the state at that point. This isn't the nicest solution though and it can be tricky with the scoping effects (especially since most of the scoping uses scope $ do ...).

It looks like this is what stopScript should do, but it isn't working currently. It is running the command for the old shell on the server-side while it probably should be an action that terminates the execution of the script on the client side.

I wonder if you could implement it by putting a MaybeT into Shell somewhere (something like, under the hood, newtype Shell a = Shell (MaybeT ShellAsItIsNow a)). If not, it might be a bit trickier (might need ContT).

roboguy13 commented 9 years ago

So, the easiest way to go about this would be to define

stopScript :: Shell ()
stopScript = Fail "<stopScript>"

I just tried that implementation and got some useful information by stopping a script with it. I'm not sure if this is how we want it to work though, since it ends up interpreting this as an error (although the REPL doesn't stop). Maybe we should add a StopScript constructor to Shell?

roboguy13 commented 9 years ago

I'm going to close this because at this point I've used this workaround for stopScript as a debugging tool a lot and I haven't run into any issues with it.

We can reopen the issue if we want to rework the implementation at some point.