From d3b0b334c261f982390edf37213edc35c5992e30 Mon Sep 17 00:00:00 2001 From: simonpj Date: Fri, 11 Oct 2002 16:56:09 +0000 Subject: [PATCH] [project @ 2002-10-11 16:56:09 by simonpj] Document infix type constructors --- ghc/docs/users_guide/glasgow_exts.sgml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) 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. + + + + + -- 1.7.10.4