[Haskell-cafe] Check a lack of a constraint?

Henning Thielemann lemming at henning-thielemann.de
Mon Jul 12 19:30:11 UTC 2021


On Mon, 12 Jul 2021, Lana Black wrote:

> Hello cafe,
>
> Is it possible in Haskell to check a lack of a certain constraint?
>
> For example,
>
> ```
> foo :: C => a
> foo = undefined
>
> ```
>
> Here `foo` can only be compiled if called with C satisfied. How do I write the 
> opposite, so that `foo` is only possible to use when C is not satisfied?

Do you mean "C a"?

Is it sensible to want this? Any instance that you import transitively 
will reduce the applicability of 'foo'.


More information about the Haskell-Cafe mailing list