Newtype wrappers
Edward Kmett
ekmett at gmail.com
Tue Jan 15 00:49:15 CET 2013
No magic coercing is present in the proposal. You need to use explicit newtype wrap and newtype unwrap expressions.
Sent from my iPad
On Jan 14, 2013, at 6:42 PM, Johan Tibell <johan.tibell at gmail.com> wrote:
> On Mon, Jan 14, 2013 at 3:40 PM, Evan Laforge <qdunkan at gmail.com> wrote:
>> Wait, what's the runtime error? Do you mean messing up Set's invariants?
>
> Yes.
>
>> If you as the library writer don't want to allow unsafe things, then
>> don't export the constructor. Then no one can break your invariants,
>> even with newtype malarky. If you as the the library user go and
>> explicitly import the bare Set constructor from (theoretical)
>> Data.Set.Unsafe, then you are in the position to break Set's internal
>> invariants anyway, and have already accepted the great power / great
>> responsibility tradeoff.
>
> If it's explicit that this is what you're doing I'm fine with it. I
> just don't want magic coercing depending on what's in scope.
>
> _______________________________________________
> Glasgow-haskell-users mailing list
> Glasgow-haskell-users at haskell.org
> http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
More information about the Glasgow-haskell-users
mailing list