[Haskell-cafe] Converting a Constraint to Bool

Richard Eisenberg eir at cis.upenn.edu
Thu Oct 16 18:12:03 UTC 2014


On Oct 16, 2014, at 6:58 AM, Ivan Lazar Miljenovic <ivan.miljenovic at gmail.com> wrote:
> Using the Constraint type and the ConstraintKinds extension, is there
> any way we can determine if a Constraint is satisfied (i.e. a
> type-level function of type Constraint -> Bool using DataKinds)?

No, for precisely this reason:

On Oct 16, 2014, at 7:06 AM, Miguel Mitrofanov <miguelimo38 at yandex.ru> wrote:
> See, even if a constraint is not satisfied, there is no reason why it can't be satisfied later, in another module. So, inclusion of another module might change the behaviour of the code that was already compiled.

But I disagree here:

> 
> I'm sure that after some oleging you'd find something that is more or less similar to what you want, but it's still a bad idea.

If you figure out some way to encode the feature you're after (converting a Constraint to a Bool like this), you've broken the type system. Please submit a bug report!

Thanks,
Richard


More information about the Haskell-Cafe mailing list