Another question wrt hiding imports

Wolfgang Lux wlux@uni-muenster.de
Thu, 12 Jul 2001 15:51:42 +0200


"Simon Peyton-Jones" wrote

> | For instance if a have
> | 
> |   module A where
> |     data T = A | B
> | 
> | which entities are imported when I include the declaration
> | 
> |   import A hiding(T)
> | 
> | in a module? The report is not clear about this but I would 
> | expect that 
> | this imports data constructors A and B into the current 
> | module but not 
> | the type constructor T 
> 
> Yes, that's right.  Why is the report not clear?  More precisely, how
> could I improve it?

I find it a little bit counterintuitive to be able to hide a type 
constructor but not its data constructors (in particular) because one 
cannot import a data constructor by simply giving its name in an import 
specification. Maybe a single sentence which explicates the fact that 
hiding(T) only hides the type constructor T but not any of the data 
constructors of T (except if T is also a data constructor in this or any 
another data type) is sufficient to make this clear. (But maybe I was 
particularly dumb in this case).

Wolfgang


--
Wolfgang Lux				  Phone: +49-251-83-38263
Institut fuer Wirtschaftinformatik	    FAX: +49-251-83-38259
Universitaet Muenster		      Email: wlux@uni-muenster.de