autoexporter

Automatically re-export modules.

Version on this page:2.0.0.2
LTS Haskell 22.39:2.0.0.12
Stackage Nightly 2024-10-31:2.0.0.12
Latest on Hackage:2.0.0.12

See all snapshots autoexporter appears in

MIT licensed
Maintained by Taylor Fausak
This version can be pinned in stack with:autoexporter-2.0.0.2@sha256:c5dcbf9fe9d619352a9f00a01e26abd7c320b81df39cb9c605b3c64b669d63e1,1504

Module documentation for 2.0.0.2

Used by 1 package in nightly-2022-11-21(full list with versions):

Autoexporter

CI Hackage Stackage

Autoexporter automatically re-exports Haskell modules.

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 that looks like this:

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

Autoexporter will generally behave as you’d expect, but there are a couple things to look out for:

  • You cannot selectively include or exclude any modules.

  • By default, only immediate children will be re-exported. If you use this in some module M, it won’t pull in M.A.B. If you need deep re-exporting, please pass --deep to Autoexporter like this:

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

Changes

Change log

Autoexporter follows the Package Versioning Policy. You can find release notes on GitHub.