Cannot put (.) or (!) type operators into an export list
Thanks to recent work in GHC HEAD, it is now possible to define type operators named (.) and (!):
type (f . g) x = f (g x)
type x ! f = f x
However, I was surprised to discover that it's not possible to put them in an export list! That is to say, this program doesn't parse:
{-# LANGUAGE TypeOperators #-}
module Bug (type (.), type (!)) where
type (f . g) x = f (g x)
type x ! f = f x
$ ~/Software/ghc4/inplace/bin/ghc-stage2 --interactive Bug.hs
GHCi, version 8.7.20190219: https://www.haskell.org/ghc/ :? for help
Loaded GHCi configuration from /home/rgscott/.ghci
Bug.hs:2:19: error: parse error on input ‘.’
|
2 | module Bug (type (.), type (!)) where
| ^
This problem appears to be specific to the (.) and (!) type operators, since any other type operator will work in its place:
{-# LANGUAGE TypeOperators #-}
module Works (type (&)) where
type (f & g) x = f (g x)
Trac metadata
| Trac field | Value |
|---|---|
| Version | 8.7 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler (Parser) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | int-index |
| Operating system | |
| Architecture |
Edited by Ryan Scott