Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Re-export qualified?

suppose you have two modules like

module Foo.A where  foo = 42 

and

module Foo.B where  foo = 12 

and you want to write a super module

module Foo (       module Foo.A     , module Foo.B     ) where  import Foo.A import Foo.B 

which re-exports those modules, you would get a name clash.

Is there a solution for this?

like image 961
LennyStackOverflow Avatar asked Dec 08 '10 07:12

LennyStackOverflow


People also ask

What is the procedure for re-export?

(b) Copy of Bill of Entry or any other prescribed document against which goods were cleared on importation. (c) Import invoice. (d) Evidence of payment of duty paid at the time of importation of the goods. (e) Permission from Reserve Bank of India for re-export of goods, wherever necessary.

What is the meaning of re exporting?

Definition of reexport transitive verb. : to export (goods) after importing from a different location The fish were shipped here [China] for processing before being reexported to Japan, South Korea, and the U.S.— Brook Larmer.

What is the difference between export and re-export?

In simple terms, exports mean export of domestic goods moved out to a foreign country. Re-exports means export of foreign goods which already imported to the country from a foreign country.

What is re-export certificate?

Re-export certificates - application to be used when the animals or plants originate from a foreign country and were brought into Canada with a foreign Convention on International Trade in Endangered Species of Wild Fauna and Flora (CITES) permit.


2 Answers

Basically, no. This has been a long-standing feature request by people like the authors of Gtk2hs. Gtk2hs has a very broad module hierarchy where it might make sense to both:

  • Use the same name in several different modules (e.g. newButton in both Graphics.UI.Gtk.Buttons.Button and Graphics.UI.Gtk.Buttons.CheckButton)
  • Provide the convenience to the user of importing all these modules with a single import statement

For now, if you want to reexport several modules together all you can do is:

  • Avoid reusing names in the modules you wish to reexport
  • Where appropriate, use type classes to allow the same name to be used for several different purposes
like image 119
Max Bolingbroke Avatar answered Oct 08 '22 13:10

Max Bolingbroke


Good question. The Haskell Report addresses this:

Exports lists are cumulative: the set of entities exported by an export list is the union of the entities exported by the individual items of the list.

[...]

The unqualified names of the entities exported by a module must all be distinct (within their respective namespace).

According to my limited Haskell knowledge I'd say it's not possible.

like image 37
musiKk Avatar answered Oct 08 '22 14:10

musiKk