Open Abhiroop opened 6 years ago
@Abhiroop This seems like an issue within idris itself. idris-mode itself does not know how to typecheck Idris and interacts with a background idris process. But I agree this is kind of odd...
When I do :t Main.hole
at the command-line it shows:
:t Main.hole
k : Nat
j : Nat
_rewrite_rule : plus k j = plus j k
--------------------------------------
Main.hole : S (plus j k) = plus j (S k)
So it seems something happens in the communication between idris-mode and the idris interpreter process. When tracing communication with idris process, it definitely returns a term with unapplied function.
The issue seems to be at the idris-load-file
method (https://github.com/idris-hackers/idris-mode/blob/0a5a165a0dd7be7bbc4f5c9533dc21acfc811a4e/idris-commands.el#L177).
Because the idris-type-at-point
binding returns the correct applied result as well.
This is going to be part of the Idris IDE protocol server. It probably needs updating - the command-line REPL also used to do this.
In the meantime, you can right-click the expression and click "Normalize" to reduce it.
@david-christiansen I tracked this to the runIdeModeCommand
function called with command Metavariables
in REPL.hs
which is pretty daunting. I was unable to understand why the application is not properly reduced. Should we add a call to TermNormalise
on the emacs side?
Also just came across this, I've been using idris-type-at-point
(C-c C-t) which displays the normalized type. I don't know why the unapplied form should ever be displayed
For example,
I am attempting this basic example:
Here when I typecheck
plus_commutes_S
, when I expectedit is being inferred as
I am using Idris 1.2 and spacemacs idris layer (which I assume pulls the latest version of idris mode)