error-messages icon indicating copy to clipboard operation
error-messages copied to clipboard

`TypeApplications` not suggested when used with function arrow `->`

Open MorrowM opened this issue 3 years ago • 1 comments

GHCi, version 8.10.7: https://www.haskell.org/ghc/  :? for help
Prelude> :t fmap @(Either _)

<interactive>:1:1: error:
    Pattern syntax in expression context: fmap@(Either _)
    Did you mean to enable TypeApplications?
Prelude> :t fmap @((->) _)

<interactive>:1:9: error: parse error on input ‘->’

Enabling -XTypeOperators doesn't help either.

MorrowM avatar Jun 19 '22 17:06 MorrowM

This one will be hard to fix, sadly. The problem is that, without -XTypeApplications, GHC is still parsing a term when it sees the (->). I think the way forward would be to allow GHC to parse the (->) syntax in a term, only to then reject it after the parser. But maybe that's not so bad? Perhaps someone wants to have a go at editing the parser in this way? I don't think it would be difficult.

goldfirere avatar Jul 01 '22 03:07 goldfirere