The autoexporter package

[ Tags: library, mit, program, utility ] [ Propose Tags ]

Autoexporter automatically re-exports modules.


[Skip to Readme]

Properties

Versions 0.1.0, 0.1.1, 0.1.2, 0.1.4, 0.2.0, 0.2.1, 0.2.2, 0.2.3, 1.0.0, 1.1.0, 1.1.1, 1.1.2 (info)
Change log CHANGELOG.markdown
Dependencies autoexporter, base (>=4.7 && <4.11), Cabal (>=1.22 && <1.25 || ==2.0.*), directory (>=1.2.5 && <1.4), filepath (>=1.3 && <1.5) [details]
License MIT
Author
Maintainer Taylor Fausak
Category Utility
Home page https://github.com/tfausak/autoexporter#readme
Bug tracker https://github.com/tfausak/autoexporter/issues
Source repository head: git clone https://github.com/tfausak/autoexporter
Uploaded Tue Jul 25 12:44:25 UTC 2017 by fozworth
Distributions LTSHaskell:1.1.2, NixOS:1.1.2, Stackage:1.1.2, Tumbleweed:1.0.0
Executables autoexporter
Downloads 4274 total (997 in the last 30 days)
Rating 2.0 (1 ratings) [clear rating]
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2017-07-25 [all 1 reports]
Hackage Matrix CI

Modules

[Index]

Downloads

Maintainer's Corner

For package maintainers and hackage trustees


Readme for autoexporter-1.1.2

[back to package description]

Autoexporter

Version badge Build badge

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 #-}