I have exactly the same issue as described in this question Re-export qualified?
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.
It was asked 5 years ago, I suppose there might have been some changes since then. Have there been any? If not, there's still no solution for that?
I do not consider Lens for resolving it.
UPDATE:
There can be plenty of the functions foo
in each module (foo1, foo2, etc) and I want to use them from both modules. There can also be data
s with the same member names in each module, after all.
So hiding isn't a solution.
There is no new solution, but there is still a solution.
First you, as only one foo
can be exported you have to decide which one you want to export as the bare foo
. Then you just need to hide and alias the other one.
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
Ok, it's not really elegant but it's a workaround if you really have to.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With