If you want you can break a module into multiple files and offer a unified
interface.

I can think of two ways to do this.

1. with folders, where you push all the module files into its own folder
and add that folder to the "source-directories" in elm-package.json.
2. with prefixing/suffixing in file names / module names.

In both cases the pattern is the same, you create aliases:

module ModuleName exposing (first, second, third)

import ModuleName.First
import ModuleName.Second
import ModuleName.Third

first = ModuleName.First.first

second = ModuleName.Second.second

third = ModuleName.Third.third


If it helps, you can think about the actual ModuleName as playing the role
of __init__.py in a python module. ;)



On Fri, Jul 8, 2016 at 11:48 AM, Robert Walter <[email protected]>
wrote:

> Hello,
>
> as far as I can tell, it is a requirement that a module names matches its
> file name, which means that one cannot split a module into several files,
> correct?
> I'm curious about the rational behind it? Is it "just" so that the
> compiler has an easier time resolving imports or are there other reasons as
> well?
>
> One could argue that it forces users to keep things that belong together
> logically also physically together and that it encourages you to keep
> modules small. On the other hand, message communication between modules
> seems to be a bit unwieldy which makes me hesitant to create too big of a
> module hierarchy. From a beginner's point of view, I like the idea of
> "partial module" declarations, but I can imagine that there are good
> reasons against that.
>
> best,
> Robert
>
> --
> You received this message because you are subscribed to the Google Groups
> "Elm Discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>



-- 
There is NO FATE, we are the creators.
blog: http://damoc.ro/

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to