[Haskell-cafe] Testing and module export lists

Don Stewart dons at galois.com
Wed Feb 24 19:24:58 EST 2010

> On 24 February 2010 20:17, Magnus Therning <magnus at therning.org> wrote:
> > I often find that I do want an export list to reduce clutter in the
> > finished code, but for testing I'd like to expose everything in a
> > module.  Is there a nice way to deal with this (using the C
> > pre-processor would not qualify as "nice" ;-)?
> > Maybe there's a switch that causes GHC to simply ignore the export
> > list of a module and export everything?
> If you start a function name with an underscore, it is "implicitly
> exported" by GHC (I can't find the actual documentation page at the
> moment however).  Whilst it may not appear in the export list, you are
> still able to call it from outside the module.

Seriously?? Doesn't that break the module system?

So this should work?

    module Z () where
    _secret = "10"

    import Z
    main = print _secret

$ runhaskell M.hs
M.hs:3:14: Not in scope: `_secret'

More information about the Haskell-Cafe mailing list