[Haskell-cafe] Dynamic types through unsafeCoerce

Alfonso Acosta alfonso.acosta at gmail.com
Tue Dec 12 12:49:50 EST 2006


> > > Sure it is. The type you gave (MyType Int Char -> MyType a b) can
> > > easily crash your program.
> >
> > Ok I see. Why would that happen? I'm (maybe wrongly) taking as granted
> > that the compiler/interpreter uses the same internal representation
> > for both types. But that makes me think it shouldn't be that dangerous
> > if nothing is later assumed about the type parameters "a" and "b".
>
> If the parameters aren't used, why not create a new data type without them?

They are used, but no monomorphic type is assumed.


More information about the Haskell-Cafe mailing list