[Haskell-cafe] Foo.Bar.hs filenames poll
MarLinn
monkleyon at googlemail.com
Mon Dec 19 00:20:41 UTC 2016
> You may know this already (and I suspect there are those in your
> audience who know as well), but this is how Python works, except that
> your 'hs' files are called '__init__.py' and they're generally
> required for every directory with Python modules in it (mostly you
> will find empty ones littered throughout Python projects).
>
No, I did not know this! But now that you mention it I am reminded of
the magic files you can use to add package-level comments (but only
those, no code) in java. It's interesting that there is more prior art
like this. However now I am even more convinced that this topic is quite
orthogonal to the original question.
Speaking of orthogonal issues:
> For an extended example, if these were Python modules and you wrote:
>
> "from bar.baz.internals import some_function"
>
> The python interpreter would evaluate the top-level declarations
> within the __init__.py in each directory in order (1. bar, 2.baz)
> before finally importing from the internals module (at which point it
> would also execute all top-level declarations there as well.
>
That sounds like something that might be easy to add to Haskell via a
syntax extension: whenever an import contains two dots in a row (or a
dot and a question mark, or what have you), special handling like this
could kick in from that point on downwards. Maybe require an explicit
import list in this case? This is only the engineer in me speaking
though, I very much suspect this to be a solution without a problem in
our world. Neat thing to ponder though.
Cheers,
MarLinn
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20161219/365d7995/attachment.html>
More information about the Haskell-Cafe
mailing list