[Haskell-cafe] newtype and access control

Steven Leiva leiva.steven at gmail.com
Mon Oct 30 01:09:50 UTC 2017

Hi Brandon,

I think that exporting the data constructor was a simple oversight. I can
definitely see how, if you don't export the data constructors, other
modules can't pattern match on the newtype value and therefore can't "get
at" the WithDBConn a value.

Thank you!

On Oct 29, 2017 7:58 PM, "Brandon Allbery" <allbery.b at gmail.com> wrote:

> On Sun, Oct 29, 2017 at 7:52 PM, Steven Leiva <leiva.steven at gmail.com>
> wrote:
>> Out of necessity, the speaker has to assume a certain level of Haskell
>> knowledge that I don't have, because I am confused as to what language
>> principles would allow for *inDBTrans* to be used for access control.
> As presented, that doesn't seem to be true. If the module exported only
> the type constructor, then it would be impossible for other modules to
> pattern match it and access the wrapped value. But the module has no export
> list, so it exports everything including the data constructor and modules
> can pattern match to unwrap it; the only other way to get that kind of
> isolation is for the wrapped data type to not be in scope, but that also
> doesn't seem to be the case.
> --
> 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://mail.haskell.org/pipermail/haskell-cafe/attachments/20171029/fcd965df/attachment.html>

More information about the Haskell-Cafe mailing list