Adding a way to reduce type families in type errors

Jakob Brünker jakob.bruenker at gmail.com
Mon Nov 23 04:01:11 UTC 2020


Ah, the result produced by !4149 does indeed look good. Thanks!

Jakob

On Mon, Nov 23, 2020 at 4:54 AM Richard Eisenberg <rae at richarde.dev> wrote:

>
>
> > On Nov 21, 2020, at 10:38 PM, Jakob Brünker <jakob.bruenker at gmail.com>
> wrote:
> >
> > Three questions:
> >  - Is there already a way to do this that I'm missing?
>
> Not that I'm aware of. GHC sometimes expands type families and sometimes
> doesn't. The general philosophy has been that expanding type families is
> usually good and expanding type synonyms is usually bad. But it wouldn't
> surprise me in the slightest if GHC is inconsistent about this.
>
> >  - Are there reasons for why this would be a bad idea?
>
> If we did it unconditionally, I imagine some error messages would get
> worse. Adding a new flag would make the interface to GHC more complex, but
> perhaps it's worth it.
>
> >  - Would a proposal be necessary for this?
>
> For me, it would depend on the invasiveness of the change; however, making
> type families expand is already what we try to do, so probably not.
>
> But before blazing ahead, you may want to know that my !4149 already
> prints what you want. Testing your example yields
>
> Scratch.hs:32:52: error:
>     • Couldn't match kind ‘()’ with ‘Maybe String’
>       Expected kind ‘Maybe (Foo Int)’, but ‘'()’ has kind ‘()’
>     • In the type ‘'()’
>       In the type family declaration for ‘Bar’
>
> which I imagine is acceptable.
>
> Richard
>
>
>
> >
> > Thanks,
> > Jakob
> > _______________________________________________
> > ghc-devs mailing list
> > ghc-devs at haskell.org
> > http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20201123/505c91bf/attachment.html>


More information about the ghc-devs mailing list