| I want to use OccName.isSymOcc to test wether a type constructor is an
| operator or not. But it seems to assume that type operators are always
| consyms. I'm wondering if this is a bug, since GHC accepts the following
| code:
|
| newtype Flip (~>) b a = Flip { unFlip :: a ~> b }

I'm not sure what your question is.  Here (~>) belongs to the same name space 
as type variables.  Remember both type contructors and data constructors
        start with a capital letter (e.g T)
        or with a colon (e.g :+:)

Which namespace a OccName is in is determined by its NameSpace flag.  However, 
the defn of isSymOcc looks wrong:
isSymOcc (OccName DataName s)  = isLexConSym s
isSymOcc (OccName TcClsName s) = isLexConSym s
isSymOcc (OccName VarName s)   = isLexSym s
isSymOcc other                 = False

The 'other' case doesn't distinguish operators for TvNames.  It should be
isSymOcc (OccName DataName s)  = isLexConSym s
isSymOcc (OccName TcClsName s) = isLexConSym s
isSymOcc (OccName VarName s)   = isLexSym s
isSymOcc (OccName TvName s)    = isLexSym s


I don't know whether this will fix your problem, but it does seem wrong as it 
is.

Simon
_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to