From: simonpj Date: Fri, 11 Oct 2002 16:56:09 +0000 (+0000) Subject: [project @ 2002-10-11 16:56:09 by simonpj] X-Git-Tag: Approx_11550_changesets_converted~1559 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=d3b0b334c261f982390edf37213edc35c5992e30;p=ghc-hetmet.git [project @ 2002-10-11 16:56:09 by simonpj] Document infix type constructors --- diff --git a/ghc/docs/users_guide/glasgow_exts.sgml b/ghc/docs/users_guide/glasgow_exts.sgml index cbfe208..5c3e74e 100644 --- a/ghc/docs/users_guide/glasgow_exts.sgml +++ b/ghc/docs/users_guide/glasgow_exts.sgml @@ -420,6 +420,33 @@ contains up to date information on recursive monadic bindings. + + 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. + + + + +