Newtype wrappers
Johan Tibell
johan.tibell at gmail.com
Tue Jan 15 00:28:15 CET 2013
On Mon, Jan 14, 2013 at 3:18 PM, Evan Laforge <qdunkan at gmail.com> wrote:
> 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).
This is what I thought Simon meant. If so, I don't think it's a good
idea, as adding the import removes a compiler error in favor of a
runtime error. If the programmer really wanted to do something this
unsafe, she should use unsafeCoerce.
More information about the Glasgow-haskell-users
mailing list