Type family constraints

Richard Eisenberg rae at cs.brynmawr.edu
Mon Apr 23 14:29:28 UTC 2018



> On Apr 23, 2018, at 6:56 AM, Alan & Kim Zimmerman <alan.zimm at gmail.com> wrote:
> 
> Is there any way to express that `pass` must be valid for each value of `Pass` in the following instance head?
> 

No, there isn't. And for good reason: whatever you're trying to do likely requires some runtime decision-making, and that's impossible with just type-level information. (Even without that motivation, there's this: any way of doing this would likely break type soundness. See #7259 and #14420.)

My recommendation is to have

> class ValidPass p
> instance ValidPass Parsed
> instance ValidPass Renamed
> instance ValidPass Typechecked

My guess is that you'll need to add a method to ValidPass, anyway.

Richard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20180423/d31bfbab/attachment.html>


More information about the ghc-devs mailing list