Newtype wrappers

Evan Laforge qdunkan at gmail.com
Tue Jan 15 00:18:07 CET 2013


On Mon, Jan 14, 2013 at 3:11 PM, Johan Tibell <johan.tibell at gmail.com> wrote:
> On Mon, Jan 14, 2013 at 2:57 PM, Roman Cheplyaka <roma at ro-che.info> wrote:
>> It's described here:
>> http://hackage.haskell.org/trac/ghc/wiki/NewtypeWrappers
>
> We seem to be talking past each other. There's a specific problem
> related to type classes and invariants on data types mentioned earlier
> on this thread. Simon's solution here seems to be that we only coerce
> a structure from one newtype to the base type if the constructors are
> exposed, hence my question if the code changes semantics due to adding
> imports.

I assume it would change from "doesn't compile" to "works" if you add
the required import.  It's the same as the FFI thing, right?  If you
don't import M (T(..)), then 'foreign ... :: T -> IO ()' gives an
error, but import it and coerces T to its underlying type (hopefully
that's a C type).



More information about the Glasgow-haskell-users mailing list