
On 08/03/07, Simon Peyton-Jones
NB that infix type constructors must start with ":", just like infix data constructors.
Now that's just not true.
{-# OPTIONS_GHC -fglasgow-exts #-}
type a $ b = a b
data Foo a = Foo a deriving (Show) data Bar = Bar (Foo $ Int) deriving (Show)
main = print (Bar (Foo 4))
GHCi session: Prelude> :load "/home/david/hs/sandbox/infix-tycons.hs" [1 of 1] Compiling Main ( /home/david/hs/sandbox/infix-tycons.hs, interpreted ) Ok, modules loaded: Main. *Main> main Bar (Foo 4) *Main> ---------------------------- There would be no reason for this restriction. The only reason to start infix data constructors with ':' would be to seperate them lexically from infix functions -- just as a leading capital serves to seperate prefix data constructors from prefix functions. There is no such clash with type constructors as there are no type functions. Hence the classic example: class Arrow (~>) where ... -- -David House, dmhouse@gmail.com