MIT licensed
Maintained by Taylor Fausak
This version can be pinned in stack with:autoexporter-0.2.3@sha256:c59272110c17cad8c1ae7c5c8e854c4a3290c41a042db2b28b599364d36289d5,1154

Module documentation for 0.2.3

Used by 1 package in lts-7.24(full list with versions):


Autoexporter automatically re-exports Haskell modules.

Version badge Build badge


  1. Install Stack.

  2. stack install autoexporter


Let’s say you have a module M that just exports some other modules. It might look like this:

module M
    ( module M.A
    , module M.B
    ) where

import M.A
import M.B

This code is error-prone. If you add a new module, say M.C, you have to remember to come back to this file and re-export it. And this code is tedious to write. You have to list each module twice. You can do a little better, but not much.

module M (module X) where
import M.A as X
import M.B as X

Now you don’t have to write every module twice, but you still have to remember to re-export everything. And the generated documentation for this module doesn’t include anything about the exported modules.

Autoexporter handles this for you. Instead of either of the above approaches, simply drop this into the M module:

{-# OPTIONS_GHC -F -pgmF autoexporter #-}

That will generate code like the first example. A couple caveats:

  • Only immediate children will be re-exported. If you use this in some module M, it won’t pull in M.A.B.

  • You cannot selectively leave out any modules. You also cannot selectively exclude any imports from any of the modules.

    • This could be allowed via -optF. I will happily accept patches for this as well.


Change log

Autoexporter uses Semantic Versioning. The change log is available through the releases on GitHub.