[Haskell-cafe] Extending constraints

Bas van Dijk v.dijk.bas at gmail.com
Tue Jun 5 17:57:25 CEST 2012


On 5 June 2012 17:52, Andres Löh <andres at well-typed.com> wrote:
> Hi Bas.
>
> I haven't thought about this for long, but ...
>
>> data ProxyWrapper constraint =
>>    forall a. constraint a => ProxyWrapper (Proxy a)
>
> I'm assuming adding Typable a in ProxyWrapper is not an option for you?

No, I would rather keep that type as unconstrained as possible.

> So then what about:
>
> class (c1 a, c2 a) => Ext c1 c2 a
> instance (c1 a, c2 a) => Ext c1 c2 a
>
> typeOfInnerProxy :: ProxyWrapper (Ext Typeable constraint) -> TypeRep
> typeOfInnerProxy (ProxyWrapper p) = typeOfArg p
>
> This will certainly require all sorts of undecidable instances :) But
> does it work for you?

It works. Thanks a lot!

Cheers,

Bas



More information about the Haskell-Cafe mailing list