Undocumented infelicity: imported type operators can be used parenthesized with no `NoTypeOperators`
Summary
The Bug & Infelicities section of GHC user's guide doesn't hint at this little expansion of Haskell 2010 syntax:
{-# LANGUAGE Haskell2010, NoTypeOperators #-}
import Data.Type.Equality ((:~:))
type T1 a b = (:~:) a b
type T2 a b = a :~: b
The infelicity is that the T1
type declaration is accepted even though the TypeOperators
extension is turned off. This doesn't match the syntax of Haskell 2010, which doesn't allow type operators whether parenthesized or not. The T2
declaration is correctly rejected by GHC.
Proposed improvements or changes
This is technically a bug but it's not a new one -- GHC 8.4 behaves the same -- so I'm not suggesting we should change this behaviour, only document it in the Infelicities section.
The section on the TypeOperators language extension could also use a bit of clarification. It currently states that
The language
TypeOperators
allows you to use infix operators in types.
which is not quite true, because you can use an infix operator without the extension as long as it's in prefix position, parenthesized.
Environment
- GHC version used (if appropriate): 6.2