provide more helpful error message when run
ning an improperly-typed term
#1814
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.
Overview
Endeavoring to fix #1747 - see the output of the new transcript for what the new error message is and when it is shown.
Implementation notes
Instead of
HandleInput.addRunMain
just returning aMaybe
(I could do it, or I couldn't), it now returns a type that disambiguates whether it couldn't due to not being able to find the term, or whether the term has a bad type. That new case is subsequently handled in the error reporting moduleOutputMessages.hs
to produce the new error message.Interesting/controversial decisions
Test coverage
I've included a new transcript
run.md
that attempts torun
properly-typed, improperly-typed, and nonexistent terms to show the differences in behavior / error messages.Loose ends
run
- fails to find the function to run #1800, and I've confirmed that without my changes thatrunnable
function still fails to be found. I wanted to put this PR up optimistically to gather feedback while that issue is resolved.Execute.hs
to provide this distinction (partly due to my lack of familiarity of what experience that file is part of..)In general, this being my first contribution, I'm not confident at all that the changes I've provided are idiomatic / sufficient. I'd be more than happy to add tests, move code, rename types. Thank you!