[Haskell-cafe] newtype and access control
leiva.steven at gmail.com
Mon Oct 30 01:09:50 UTC 2017
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.
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>
>> 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
> allbery.b at gmail.com
> ballbery at sinenomine.net
> unix, openafs, kerberos, infrastructure, xmonad
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe