[Haskell-cafe] Trouble splitting up source into multiple files, when using data abstraction.

Luke Clifton ltclifton at gmail.com
Sun Apr 13 14:02:39 UTC 2014

Hi David,

I think you can do something like providing a LogTree.Internal module which
you use internally and which exports everything you need, and making your
LogTree module which re-exports only the safe subset which "unknown" code
would then import. I don't think there is a way of stopping anyone from
importing your LogTree.Internal module though.

On Sun, Apr 13, 2014 at 9:42 PM, David Banas <capn.freako at gmail.com> wrote:

> Hi all,
> I’ve defined a typeclass, *LogTree*, and would like to put each instance
> definition in its own source file, in order that *LogTree.hs *not grow to
> a ridiculous length.
> I’m attempting to use data abstraction, in order to future-proof the user
> interface to this class.
> So, for instance, I don’t make all of the data constructors defined in
> LogTree accessible, via the module export list, but rather force the user
> to use certain “helper” functions, instead.
> However, the individual instance definitions *do* need access to these
> data constructors, but they’re in a different source file.
> *Is this possible? That is, is it possible to provide different export
> lists to “friendly” vs. “unknown” client code?*
> Thanks,
> -db
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20140413/c3306b14/attachment.html>

More information about the Haskell-Cafe mailing list