Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a clause for an operator does not work #185

Closed
justjoheinz opened this issue Aug 19, 2017 · 5 comments · Fixed by #212
Closed

Adding a clause for an operator does not work #185

justjoheinz opened this issue Aug 19, 2017 · 5 comments · Fixed by #212
Labels

Comments

@justjoheinz
Copy link
Contributor

Given

infixl 5 :|:
(:|:) : Nat -> Nat

and trying to add a clause with the cursor inside the brackets results in

Idris Error: does not understand
@justjoheinz
Copy link
Contributor Author

@david-christiansen Could you help me here please? If I just send :|: to idris I get the Idris Error: does not understand reply, but when I send (:|:) idris replies with ((:|:)) k = ?op_rhs

In emacs everything works as expected, but I can't imagine that the emacs mode strips unrequired parantheses from the response.

justjoheinz pushed a commit to justjoheinz/atom-language-idris that referenced this issue Sep 7, 2018
…ckets

unwrap the word again when we get the response.
This fixes idris-hackers#185
@justjoheinz
Copy link
Contributor Author

@david-christiansen I tried my outlined approach with this PR and it seems to work, but I really would like to have other developers opinion on this. It feels weird.
@archaeron , please feel free to have a look as well.

@david-christiansen
Copy link
Member

I wonder why this isn't working... the Emacs mode doesn't do it this way.

Here's a bit of a log from an add-clause command in the Emacs mode:

module whatever

data Foo = MkFoo Integer

infixr 8 ++++

(++++) : Nat -> Nat -> Nat

I then issue add-clause with the cursor on the operator, and Emacs sends this:

((:add-clause 7 "++++") 18)

Idris replies with this:

(:return (:ok "(++++) k j = ?op_rhs") 18)

Your example works fine too:

09:17:31 -> ((:add-clause 12 ":|:")
 23)
09:17:31 <- (:return
 (:ok "(:|:) k = ?op_rhs")
 23)

So I'm not sure why it would need that. Can you post a log of the message being sent?

@justjoheinz
Copy link
Contributor Author

Your ++++ example works without my PR.
the :|: example works like this:

000018((:add-clause 4 :|:) 6)
(:return (:error "did not understand") 6)

So from what I gather the difference is that emacs quotes the ":|:" (which seems correct) and atom doesn't. So my fix is futile, and it would be sufficient to quote the word.
Thank you very much!

@david-christiansen
Copy link
Member

david-christiansen commented Sep 7, 2018 via email

justjoheinz pushed a commit to justjoheinz/atom-language-idris that referenced this issue Sep 7, 2018
The underlying bug is in the sexp-formatter which
always treats strings starting with : as symbol.
This breaks clauses like ":|:" since they are
not being quoted

This fixes idris-hackers#185
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants