[Haskell-cafe] Converting a Constraint to Bool

Ivan Lazar Miljenovic ivan.miljenovic at gmail.com
Fri Oct 17 00:26:30 UTC 2014


On 17 October 2014 05:12, Richard Eisenberg <eir at cis.upenn.edu> wrote:
> 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.
>

Oh, because any such conversions would be done at compile time of the
module that defined such behaviour and won't take into account any
more instances or classes?  Didn't think about that...

> 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



-- 
Ivan Lazar Miljenovic
Ivan.Miljenovic at gmail.com
http://IvanMiljenovic.wordpress.com


More information about the Haskell-Cafe mailing list