[Haskell-cafe] Module visibility of data type constructors

Matthias Fischmann fis at wiwi.hu-berlin.de
Sat Nov 4 15:35:10 EST 2006


On Sat, Nov 04, 2006 at 09:39:39PM +0200, Slavomir Kaslev wrote:
> To: haskell-cafe at haskell.org
> From: Slavomir Kaslev <slavomir.kaslev at gmail.com>
> Date: Sat, 4 Nov 2006 21:39:39 +0200
> Subject: [Haskell-cafe] Module visibility of data type constructors
> 
> Hello. I have a simple question for data type constructors visibility.
> Take a look:
> 
> 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.
> 
> Is this the correct behavior or is it bug in ghc?

It's not the correct behavior.  The question is whether the bug is in
your code or in ghc (with me it's usually the former :-).

I can't reproduce this with my ghc 6.4.  Which version are you using?
Can you post the other module you are talking about?


matthias

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20061104/3e87740f/attachment.bin


More information about the Haskell-Cafe mailing list