Question

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.
Was it helpful?

Solution

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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top