Anon Imous
Anon Imous

Reputation: 415

Module, that exports another ones

Is there a way to create a module that will export other modules?

For example, I have a list of modules: A, B, C. And I want them to be imported to module D.

So, I have to write:

import A
import B
import C

It works. But may be not very convenient sometimes.

Is there a way to create a Collection module that exports the content of A, B and C?

With this feature, instead of previous instructions, I'd only have to write:

import Collection -- Importing A, B, C.

Upvotes: 8

Views: 93

Answers (1)

Tom Savage
Tom Savage

Reputation: 3182

Yes, but you need to use an explicit export list, specifying all functions, types, classes and modules to export from this module.

module Foo (module A, module B, myid) where

import A
import B

myid :: a -> a  -- For example

Upvotes: 9

Related Questions