[[project @ 2002-10-11 16:56:09 by simonpj] simonpj**20021011165609 Document infix type constructors ] { hunk ./ghc/docs/users_guide/glasgow_exts.sgml 422 + + + Infix type constructors + +GHC supports infix type constructors, much as it supports infix data constructors. For example: + + infixl 5 :+: + + data a :+: b = Inl a | Inr b + + f :: a `Either` b -> a :+: b + f (Left x) = Inl x + + +The lexical +syntax of an infix type constructor is just like that of an infix data constructor: either +it's an operator beginning with ":", or it is an ordinary (alphabetic) type constructor enclosed in +back-quotes. + + +When you give a fixity declaration, the fixity applies to both the data constructor and the +type constructor with the specified name. You cannot give different fixities to the type constructor T +and the data constructor T. + + + + }