A diff is up at https://phabricator.haskell.org/D1427
On Sat, Oct 24, 2015 at 1:14 PM, Evan Laforge <qdun...@gmail.com> wrote: > Ok, ticket created. I'll go see how much I can figure out on my own. > > https://ghc.haskell.org/trac/ghc/ticket/11014 > > WRT the "bound at" bits in "relevant bindings", I have no strong opinion. > What about omitting them if they are in the same file as the main error? Or > maybe they always are? I'm not totally clear how it chooses which bindings > are relevant. > > On Sat, Oct 24, 2015 at 12:50 PM, Simon Peyton Jones <simo...@microsoft.com> > wrote: >> >> I’m all for it. Can advise. (Make a ticket.) >> >> >> >> Thanks! >> >> >> >> Simon >> >> >> >> From: Glasgow-haskell-users >> [mailto:glasgow-haskell-users-boun...@haskell.org] On Behalf Of Evan Laforge >> Sent: 24 October 2015 03:48 >> To: GHC users >> Subject: type error formatting >> >> >> >> 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@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users