[Haskell-cafe] Extending constraints

Andres Löh andres at well-typed.com
Tue Jun 5 18:28:14 CEST 2012

What you want seems a bit tricky.

> p :: ProxyWrapper Num
> p = ProxyWrapper (Proxy :: Proxy Int)

At this point, all you know about p is that it is a Num. You don't
know that it is Typeable, because you choose to forget about that. You
could give p the type 'ProxyWrapper (Ext Typeable Num)' and it would

> then the following would give a type error:
> oops :: TypeRep
> oops = typeOfInnerProxy p

Yes, and correctly so. Because Typeable isn't even a superclass of
Num. So there's no way to know that p actually contains a Typeable


Andres Löh, Haskell Consultant
Well-Typed LLP, http://www.well-typed.com

More information about the Haskell-Cafe mailing list