[Haskell-cafe] Define a module in multiple files

Ozgur Akgun ozgurakgun at gmail.com
Mon Nov 30 12:27:48 EST 2009


Nice idea, but this way you still need to modify the single module which
glues them alltogether.
I wanted to allow the users of the module add some functionality to the
module itself.

Thanks for the perspective though,

-- Ozgur

2009/11/30 Roel van Dijk <vandijk.roel at gmail.com>

> On Mon, Nov 30, 2009 at 5:15 PM, Ozgur Akgun <ozgurakgun at gmail.com> wrote:
> > Is there a way of splitting the definition of a module into multiple
> files?
>
> Let's say you have some module A which introduces 3 symbols:
>
> module A (a, b, c) where
> a = 1
> b = 2
> c = 3
>
> Now we will split it in 3 modules:
>
> module B ( b ) where
> b = 2
>
> module C ( c ) where
> c = 3
>
> module A (a, b, c) where
> import B ( b )
> import C ( c )
> a = 1
>
> You can also do the inverse: create a single module of which parts are
> exported in multiple other modules. This can be useful to avoid
> circular dependencies while still presenting a nice interface to your
> library users.
>



-- 
Ozgur Akgun
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20091130/7cd2f958/attachment.html


More information about the Haskell-Cafe mailing list