Idris-dev icon indicating copy to clipboard operation
Idris-dev copied to clipboard

REPL command parse errors are unhelpful

Open trillioneyes opened this issue 12 years ago • 5 comments

In the REPL, the parser does not differentiate in any significant way between commands and ordinary terms to evaluate. This means that when an incorrect command is entered, the REPL then tries to parse it as a term, and gives a term-like error. (As far as I can tell, the error is the same in all cases: "no implicit arguments allowed here, expected: dependent type signature, end of input". Which sounds like it's interpreting the : as the : that appears before a type signature.)

Examples:

:exec main

Shows the above error. :exec is a valid command, and does approximately what someone who wrote :exec main probably wants.

I'll try to edit this with more examples soon, but I don't have a working idris at the moment.

It seems like a nice way to fix this would be to case on the first character of the REPL's input string, before calling any parser:

  1. Is it :? Invoke a specialized parser for repl commands:
    1. Look at the first word (after the :). If it matches any command, use that to look up the parser for the rest of the input line.
    2. If it doesn't match any command, see if it gets close, and offer spelling suggestions.
  2. Otherwise, run the same parser as we have now.

trillioneyes avatar Jul 22 '14 16:07 trillioneyes

I meant to mark this as low-hanging fruit, but I don't see how. If someone can do that after the fact, that would be nice.

trillioneyes avatar Jul 22 '14 16:07 trillioneyes

Done!

david-christiansen avatar Jul 22 '14 17:07 david-christiansen

I'm poking around at this.

tac-tics avatar Sep 03 '14 15:09 tac-tics

Looks like this was already fixed in 8fc9ffd6 if I am not mistaken?

victoredwardocallaghan avatar Oct 10 '14 15:10 victoredwardocallaghan

Yes, I believe this much better in 0.9.19.1 (current master) than @trillioneyes' initial description.

> :exec main
Hello Idris devs!
> :exec m
When checking argument value to function Prelude.Basics.the:
        No such variable m

:help indicates :exec can accept an expression.

:exec :execute  [<expr>]    Compile to an executable and run

Unless there are objections, I think we can close this one.

jmitchell avatar Oct 31 '15 08:10 jmitchell