Newtype wrappers

Johan Tibell johan.tibell at
Tue Jan 15 00:42:43 CET 2013

On Mon, Jan 14, 2013 at 3:40 PM, Evan Laforge <qdunkan at> wrote:
> Wait, what's the runtime error?  Do you mean messing up Set's invariants?


> 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.

More information about the Glasgow-haskell-users mailing list