Skip to content

Guard haskell-process-do-try-info from non-strings #601

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

Conversation

deviant-logic
Copy link
Contributor

haskell-process-do-try-info will break process interaction if it isn't passed
a string. This can happen when using haskell-mode-contextual-space and
typing a space after ::. At least, it happened to me when I did it.

@gracjan
Copy link
Contributor

gracjan commented Apr 25, 2015

@deviant-logic: In elisp the usual protocol agreement is that functions are not called with arguments falling outside of their domain.

So the proper solution is to fix haskell-mode-contextual-space or even better is to fix the source of this problem that is described in issue #334.

So I would gladly merge changes to either haskell-mode-contextual-space or haskell-ident-at-point.

Can you create such a pull request?

@gracjan gracjan changed the title guard haskell-process-do-try-info from non-strings Guard haskell-process-do-try-info from non-strings Apr 25, 2015
@deviant-logic
Copy link
Contributor Author

@gracjan: I can fix haskell-mode-contextual-space tomorrow; I'm up way
past my bedtime at the moment. Having haskell-process-do-try-info be
defensive may be justified here regardless, though, as its failure-mode
breaks process interaction. I'm ambivalent. Since
haskell-ident-at-point is documented to return nil when it can't find
an identifier, mucking with that function strikes me as inappropriate here.

On Sat, Apr 25, 2015 at 12:49 AM gracjan notifications@github.com wrote:

@deviant-logic https://github.com/deviant-logic: In elisp the usual
protocol agreement is that functions are not called with arguments
falling outside of their domain.

So the proper solution is to fix haskell-mode-contextual-space or even
better is to fix the source of this problem that is described in issue
#334 #334.

So I would gladly merge changes to either haskell-mode-contextual-space
or haskell-ident-at-point.

Can you create such a pull request?


Reply to this email directly or view it on GitHub
#601 (comment).

@gracjan
Copy link
Contributor

gracjan commented Apr 25, 2015 via email

@antalsz
Copy link
Contributor

antalsz commented Apr 25, 2015

@gracjan: haskell-ident-at-point now follows its own documentation (it returns nil when there isn't an identifier), but haskell-ident-pos-at-point does not (it still returns a pair of the form (n . n)) – I can fix that. Perversely, however, there seems to be plenty of code which assumes that haskell-ident-at-point does not follow its own documentation and returns "" (including possibly the root cause of the haskell-process-do-try-info bug).

I can try to fix this, but I'm not sure where I should put that commit – a new PR, here, on #602?

Also, a +1 for fixing the crash bug in haskell-process-do-try-{info,type} regardless (either @deviant-logic's fix or mine), because it renders the GHCi buffer completely unusable unless you kill the session. (But yes, fixing the root cause is better.)

@gracjan
Copy link
Contributor

gracjan commented Apr 25, 2015

I would prefer another pull request that fixes everything about mishandling of haskell-ident-at-point and haskell-ident-pos-at-point.

After that is done we will look again on #601 and #602.

@gracjan
Copy link
Contributor

gracjan commented Apr 25, 2015

Also note that haskell-ident-at-point has a testsuite and tests for haskell-ident-pos-at-point should also get a mention in the test suite.

antalsz referenced this pull request in antalsz/haskell-mode Apr 25, 2015
The documentation mandates that `haskell-ident-at-point` return nil when
there is no identifier at point; however, apparently, it instead
returned `""` in that case at some point, and so some code made faulty
assumptions based on that.
@antalsz
Copy link
Contributor

antalsz commented Apr 25, 2015

@gracjan, @deviant-logic: I submitted pull request #603, which fixes the behavior around haskell-ident-at-point, thereby fixing haskell-contextual-space and the problem here.

Thinking again about whether haskell-do-try-info ought to be defensive: perhaps the real issue is that an error inside the :go callback of make-haskell-command completely fouls up process interaction permanently. Maybe that's what really ought to be fixed?

@gracjan
Copy link
Contributor

gracjan commented Apr 25, 2015

If I understand correctly this was subsumed by #603, right?

@gracjan gracjan closed this Apr 25, 2015
@gracjan
Copy link
Contributor

gracjan commented Apr 25, 2015

@antalsz: About :go being unprotected. This is something we should definitely look into. Chris rolled about home grown async/await kind of functionality probably because there was no such thing available when he did it. I guess that there should be something like that now and we should find something working out-of-the-box.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants