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

Brandon Allbery allbery.b at gmail.com
Sun Apr 13 14:03:57 UTC 2014


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

> *Is this possible? That is, is it possible to provide different export
> lists to “friendly” vs. “unknown” client code?*
>

Not directly. The usual convention is you put all your definitions in a
.Internal module which is understood to be intended only for restricted
use, although there is currently no way to enforce this; the public
module(s) then imports that and re-exports the public interface.

It might be interesting to have some way to enforce this, possibly by a
generalization of the Safe mechanism. It's not clear how well this can be
enforced, in any case; if it's available across modules at all, there will
be some way for "untrusted" code to get at it. I'm not sure anyone wants to
pay the costs of complexity (in particular of cross-platform, which is
already somewhat dicey at times) or limited flexibility to provide harder
guarantees; in particular, there are times when you really do need access
to another package's internals, with the result that some packages that
used to hide their internals completely are now starting to export
Internals modules.

-- 
brandon s allbery kf8nh                               sine nomine associates
allbery.b at gmail.com                                  ballbery at sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20140413/2e475bf2/attachment.html>


More information about the Haskell-Cafe mailing list