[Haskell-cafe] Module visibility of data type constructors

Stefan Holdermans stefan at cs.uu.nl
Sun Nov 5 15:51:24 EST 2006


Slavomir,

> module Foo (Bar) where
> data Bar = Bar
>
> In ghc this allows me to use Bar, the type constructor, in another
> module, although it shouldn't be visible outside Foo. On the other
> hand, if I change Bar's definition as:
>
> data Bar = Baz
>
> Baz isn't visible outside Foo.

On terminology: in

   data T = D

T is called a type constructor and is called a *data* constructor.

Cheers,

   Stefan


More information about the Haskell-Cafe mailing list