Newtype wrappers

Herbert Valerio Riedel hvr at gnu.org
Mon Jan 14 19:54:54 CET 2013


Simon Peyton-Jones <simonpj at microsoft.com> writes:

[...]

> x1 :: [Int]
>
> x2 :: Char -> Int
>
> x3 :: T Int
>
> x4 :: S IO Int
>
> Can we convert these into the corresponding forms where the Int is
> replaced by Age? Alas, not easily, and certainly not without overhead

Maybe a stupid question: Can unsafeCoerce accomplish (albeit in an
unsafe way) the desired Int-to-Age type conversion for x1,x2,x3,x4
already now? How does unsafeCoerce relate to the proposal at hand?

Cheers,
  hvr



More information about the Glasgow-haskell-users mailing list