Haskell export current module with additional imported module

Wojciech Danilo picture Wojciech Danilo · Aug 3, 2013 · Viewed 14.6k times · Source

Is it possible to write a module in Haskell, which re-exports a module in addition to exporting everything visible inside?

Lets consider following module:

module Test where
import A

f x = x

This module exports everything defined inside, so it exports f but does not re-export anything imported from A.

On the other hand, if I want to re-export the module A:

module Test (
    module A,
    f
) where
import A

f x = x

Is there a way to re-export A and export everything defined in Test without needing to explicitly write every function defined within Test?

Answer

Thomas M. DuBuisson picture Thomas M. DuBuisson · Aug 3, 2013

There is a simple solution, just export the module from the module:

module Test
    ( module Test
    , module A
    ) where

import Prelude()
import A
f x = x