Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Previously, in some places
error
andexitFailure
were used to handle errors, so the whole program terminated.Now the parsing uses
Either
(which was much simpler than I thought) and in case of an uncaught exception, the continuation is aborted.To obtain the terminating continuation, we have to use callCC inside the
Interpreter
monad, which means it can no be set in the initial state. I'm not really happy with that solution, but can't think of anything more elegant at the moment.The nice thing is, the REPL now doesn't close itself when encountering a parsing error or uncaught exception. It just ignores the current line, like the regular Python REPL.
This is the first time I'm working with monad transformer stacks, so it takes some time to grasp all the details, but it's fun and I already learned a lot. I want to do 1 or 2 more small fixes, then I am going to tackle generators.
Matthias