Re-export qualified?

后端 未结 2 2000
盖世英雄少女心
盖世英雄少女心 2020-12-29 20:54

suppose you have two modules like

module Foo.A where

foo = 42

and

module Foo.B where

foo = 12

and you w

2条回答
  •  一向
    一向 (楼主)
    2020-12-29 21:41

    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

提交回复
热议问题