Haskell export current module with additional imported module

HaskellModuleExport

Haskell Problem Overview


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?

Haskell Solutions


Solution 1 - Haskell

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionWojciech DaniloView Question on Stackoverflow
Solution 1 - HaskellThomas M. DuBuissonView Answer on Stackoverflow