[Haskell-cafe] Bing/Copilot Answer: "->", has highest precedence for type construction but in general has nuanced precedence order

Olaf Klinke olf at aatal-apotheke.de
Sun Mar 17 19:59:46 UTC 2024


Next time ask GHCi first. (Perhaps you did, but wanted to learn
Copilot's  opinion anyways):

ghci> :info (->)
data (->) (a :: TYPE q) (b :: TYPE r) 	-- Defined in ‘GHC.Prim’
infixr -1 ->


ghci> :type (->)
<interactive>:1:2: error: parse error on input ‘->’

So while (->) as a type-level function is an infix operator with a
precedence, there is no such operator on the term level, otherwise the
:type query would have shown it. That the term-level -> is not an
operator arguably makes it a lot harder to obtain proper information
about. The relevant part of the language documentation I think is this:
https://www.haskell.org/onlinereport/exps.html

Olaf



More information about the Haskell-Cafe mailing list