[Haskell-cafe] Testing and module export lists

Magnus Therning magnus at therning.org
Wed Feb 24 06:01:38 EST 2010

On Wed, Feb 24, 2010 at 10:41, Arnaud Bailly <arnaud.oqube at gmail.com> wrote:
> Maybe you just want to test what's in your export list which
> represents the public interface of your code. And if you cannot write
> a test that exercise private implementation through the public
> interface, then maybe there is a design problem...


The specific case I have is a module for parsing a small language.
The module exports a single function, a function that takes a string
and returns a tree.  Of course the parser is built using parser
combinators.  I'd like to test each combinator I've built, but I don't
want to export them all.  The only way I see of achieving this is to
split each module in two, one public and one internal, where the
public one just re-exports the relevant pieces of the internal one.
That's workable, but hardly aesthetically pleasing ;-)


Magnus Therning                        (OpenPGP: 0xAB4DFBA4)
magnus@therning.org          Jabber: magnus@therning.org
http://therning.org/magnus         identi.ca|twitter: magthe

More information about the Haskell-Cafe mailing list