Re: Can I coerce type constructors to Any?

Tom Ellis <[email protected]> Thu, 22 Jan 2026 13:54:41 +0000
Newsgroups gmane.comp.lang.haskell.cafe
Message-ID <aXIsIUCi8Wv0Ml50@cloudinit-builder>
On Wed, Jan 21, 2026 at 11:14:49PM +0000, Tom Ellis wrote:
> could I coerce `f x` to `Any x`? (assuming f maps lifted types to
> lifted types)

Coincidentally, Andreas Klebinger posted something today on a
ghc-proposals discussion:

> It's also worth pointing out that GHC gives no guarantees that
> unsafeCoerce is safe for anything beyond casting from/to `Any`

Maybe that's evidence that casting from/to `Any x` is *not* OK?

(I don't think what Andreas said can *literally* be correct, because
surely it's safe to unsafeCoerce from a to b when `Coercible a b` is
in scope?)

Tom
_______________________________________________
Haskell-Cafe mailing list -- [email protected]
To (un)subscribe, modify options or view archives go to:
Only members subscribed via the mailman list are allowed to post.