Qualified re-export - how to solve it now, any solution?

I have exactly the same problem as described in this Re-export qualified question ?

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 these modules, you will get a name clash.

It was asked 5 years ago, I suppose, since then, some changes may have occurred. Have they been? If not, is there no solution yet?

I do not consider the Lens to resolve it.

UPDATE

Each module (foo1, foo2, etc.) can have many foo functions, and I want to use them from both modules. In the end, there may also be data with the same member names in each module.

So hiding is not a solution.

+5
source share
1 answer

There is no new solution, but the solution still remains. At first you can export only one foo , you need to decide which one you want to export as naked foo . Then you just need to hide and hide the other.

 module Foo ( module Foo.A , module Foo.B , bFoo ) where import Foo.A import Foo.B hiding (foo) import qualified B as B bFoo = B.foo 

Well, this is not very elegant, but it is a workaround if you really need to.

+2
source

All Articles