type error formatting
Ryan Trinkle
ryan.trinkle at gmail.com
Sat Oct 24 15:30:42 UTC 2015
This looks like an improvement to me. I love the idea of a visual
demarcation between sections, too; the bullets seem like a good choice
there (the horizontal lines seem like they'd take up more space).
Ryan
On Sat, Oct 24, 2015 at 6:07 AM, Roman Cheplyaka <roma at ro-che.info> wrote:
> I have the same issue with the current error messages. I think these are
> all good ideas.
>
> On 10/24/2015 05:48 AM, Evan Laforge wrote:
> > Here's a typical simple type error from GHC:
> >
> > Derive/Call/India/Pakhawaj.hs:142:62:
> > Couldn't match type ‘Text’ with ‘(a1, Syllable)’
> > Expected type: [([(a1, Syllable)], [Sequence Bol])]
> > Actual type: [([Syllable], [Sequence Bol])]
> > Relevant bindings include
> > syllables :: [(a1, Syllable)]
> > (bound at Derive/Call/India/Pakhawaj.hs:141:16)
> > best_match :: [(a1, Syllable)]
> > -> Maybe (Int, ([(a1, Syllable)], [(a1, Sequence
> Bol)]))
> > (bound at Derive/Call/India/Pakhawaj.hs:141:5)
> > In the second argument of ‘mapMaybe’, namely ‘all_bols’
> > In the second argument of ‘($)’, namely
> > ‘mapMaybe (match_bols syllables) all_bols’
> >
> > I've been having more trouble than usual reading GHC's errors, and I
> > finally spent some time to think about it. The problem is that this new
> > "relevant bindings include" section gets in between the expected and
> > actual types (I still don't like that wording but I've gotten used to
> > it), which is the most critical part, and the location context, which is
> > second most critical. Notice the same effect in the previous sentence
> > :) After I see a type error the next thing I want to see is the where
> > it happened, so I have to skip over the bindings, which can be long and
> > complicated. Then I usually know what to do, and only look into the
> > bindings if something more complicated is going on, like wonky
> > inference. So how about reordering the message:
> >
> > Derive/Call/India/Pakhawaj.hs:142:62:
> > Couldn't match type ‘Text’ with ‘(a1, Syllable)’
> > Expected type: [([(a1, Syllable)], [Sequence Bol])]
> > Actual type: [([Syllable], [Sequence Bol])]
> > In the second argument of ‘mapMaybe’, namely ‘all_bols’
> > In the second argument of ‘($)’, namely
> > ‘mapMaybe (match_bols syllables) all_bols’
> > Relevant bindings include
> > syllables :: [(a1, Syllable)]
> > (bound at Derive/Call/India/Pakhawaj.hs:141:16)
> > best_match :: [(a1, Syllable)]
> > -> Maybe (Int, ([(a1, Syllable)], [(a1, Sequence
> Bol)]))
> > (bound at Derive/Call/India/Pakhawaj.hs:141:5)
> >
> > After this, why not go one step further and set off the various sections
> > visibly to make it easier to scan. The context section can also be
> > really long if it gets an entire do block or record:
> >
> > Derive/Call/India/Pakhawaj.hs:142:62:
> > * Couldn't match type ‘Text’ with ‘(a1, Syllable)’
> > Expected type: [([(a1, Syllable)], [Sequence Bol])]
> > Actual type: [([Syllable], [Sequence Bol])]
> > * In the second argument of ‘mapMaybe’, namely ‘all_bols’
> > In the second argument of ‘($)’, namely
> > ‘mapMaybe (match_bols syllables) all_bols’
> > * Relevant bindings include
> > syllables :: [(a1, Syllable)]
> > (bound at Derive/Call/India/Pakhawaj.hs:141:16)
> > best_match :: [(a1, Syllable)]
> > -> Maybe (Int, ([(a1, Syllable)], [(a1, Sequence
> Bol)]))
> > (bound at Derive/Call/India/Pakhawaj.hs:141:5)
> >
> > Or alternately, taking up a bit more vertical space:
> >
> > Derive/Call/India/Pakhawaj.hs:142:62:
> > Couldn't match type ‘Text’ with ‘(a1, Syllable)’
> > Expected type: [([(a1, Syllable)], [Sequence Bol])]
> > Actual type: [([Syllable], [Sequence Bol])]
> > -----------------------------
> > In the second argument of ‘mapMaybe’, namely ‘all_bols’
> > In the second argument of ‘($)’, namely
> > ‘mapMaybe (match_bols syllables) all_bols’
> > -----------------------------
> > Relevant bindings include
> > syllables :: [(a1, Syllable)]
> > (bound at Derive/Call/India/Pakhawaj.hs:141:16)
> > best_match :: [(a1, Syllable)]
> > -> Maybe (Int, ([(a1, Syllable)], [(a1, Sequence
> Bol)]))
> > (bound at Derive/Call/India/Pakhawaj.hs:141:5)
> >
> > Thoughts? It seems simple enough that I could do myself, but of course
> > not without buy-in.
>
>
>
> _______________________________________________
> Glasgow-haskell-users mailing list
> Glasgow-haskell-users at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/glasgow-haskell-users/attachments/20151024/b7683f31/attachment.html>
More information about the Glasgow-haskell-users
mailing list