How does the constraints package work?

前端 未结 1 738
慢半拍i
慢半拍i 2021-02-13 13:04

The idea behind Data.Constraint.Forall, as I understand it, is to use coercion in the implementation, but ensure safety using the type system. I have two questions regarding the

相关标签:
1条回答
  • It is possible with an MPTC and functional dependency to identify the Skolem when it is a single variable, by using a constraint parameterized on a constraint. The trick I used to do that doesn't work when there are two.

    From the perspective of code written outside of this module, the variables are Skolemized. They are effectively a 'fresh' type constructor.

    But given that you can't refer explicitly to these types outside of the module since they aren't exported, any instance that covers these Skolems has to be universally quantified.

    This is how I upgrade from an existential to a universal. The 'sign flip' comes from their unexported nature, not technically from their role as Skolems.

    0 讨论(0)
提交回复
热议问题