[Haskell-cafe] Design your modules for qualified import

Sebastian Sylvan sebastian.sylvan at gmail.com
Sat Jun 14 10:28:21 EDT 2008


On 6/14/08, Henning Thielemann <lemming at henning-thielemann.de> wrote:
>
>
> On Mon, 9 Jun 2008, Sebastian Sylvan wrote:
>
>  Another BIG reason: It's impossible to export a whole hierarchy qualified.
>> I.e it would be neat if the user could write:
>>
>> import Graphics.UI.Gtk
>>
>> And then have Gtk re-export sub-modules qualified, so you could write
>> "Button.new", "Window.new" etc. etc. As it stands you have two options:
>> prefix all the "new" functions with the kind of widget they create
>> (buttonNew, windowNew), or force the user to add a gazillion qualified
>> imports.
>>
>
> The problem would be again that no one knows, where "Window" comes from.
> Better would be
>
I really don't see how this is a big problem. Lots of languages do
hierarchical import (e.g. .Net languages) and I don't think I've ever heard
anyone complain about this particular aspect of it. The worst case scenario
is that you need a little bit of tool support to help you sort it out. Plus,
it's not like you can't just qualify the import to make it easier to see
where it comes from if you really think it's a problem:

import qualified Graphics.UI.GTK as GTK

and then use GTK.Button.new etc.


-- 
Sebastian Sylvan
+44(0)7857-300802
UIN: 44640862
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20080614/67d473e5/attachment.htm


More information about the Haskell-Cafe mailing list