Re: [GHC] #2442: Heuristics to improve error messages for badly referenced things
#2442: Heuristics to improve error messages for badly referenced things --+- Reporter: batterseapower | Owner: simonpj Type: feature request | Status: closed Priority: high | Milestone: 7.0.2 Component: Compiler |Version: 6.9 Resolution: fixed| Keywords: Testcase: | Blockedby: Difficulty: Unknown | Os: Unknown/Multiple Blocking: | Architecture: Unknown/Multiple Failure: None/Unknown | --+- Changes (by gidyn): * cc: gideon@… (removed) -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2442#comment:20 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler ___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #2442: Heuristics to improve error messages for badly referenced things
#2442: Heuristics to improve error messages for badly referenced things --+- Reporter: batterseapower | Owner: simonpj Type: feature request | Status: closed Priority: high | Milestone: 7.0.2 Component: Compiler |Version: 6.9 Resolution: fixed| Keywords: Testcase: | Blockedby: Difficulty: Unknown | Os: Unknown/Multiple Blocking: | Architecture: Unknown/Multiple Failure: None/Unknown | --+- Changes (by simonpj): * status: patch = closed * resolution: = fixed Comment: Finally done! {{{ Wed Dec 22 17:51:24 GMT 2010 simo...@microsoft.com * Add fuzzyLookup, a variant of fuzzyMatch Plus, I changed quite a bit of layout to make the lines shorter. M ./compiler/utils/Util.lhs -33 +70 Wed Dec 22 17:54:00 GMT 2010 simo...@microsoft.com * Implement fuzzy matching for the Finder ..so that you get a more helpful message when you mis-spell a module name in an 'import'. Validates, but not fully tested. Based on Max's patch in Trac #2442, but heavily refactored. M ./compiler/main/Finder.lhs -45 +59 M ./compiler/main/HeaderInfo.hs -1 +2 M ./compiler/main/HscTypes.lhs -8 +16 M ./compiler/main/Packages.lhs -5 +27 Wed Dec 22 17:53:06 GMT 2010 simo...@microsoft.com * Implement fuzzy matching for the renamer ...so that you get helpful suggestions when you mis-spell a name Based on Max's patch in Trac #2442, but heavily refactored. M ./compiler/main/DynFlags.hs -1 +4 M ./compiler/rename/RnEnv.lhs -47 +176 M ./compiler/typecheck/TcRnMonad.lhs +4 Fri Jan 7 10:28:55 GMT 2011 simo...@microsoft.com * Make fuzzy matching a little less eager for short identifiers For single-character identifiers we now don't make any suggestions See comments in Util.fuzzyLookup M ./compiler/utils/Util.lhs -3 +12 Thu Jan 13 11:12:33 GMT 2011 simo...@microsoft.com * Improve the finder's error messages I'd done all the work to add fuzzy-match suggestions, but they weren't really being used! Here's what you get now module Foo where import Data.Lst Foo.hs:3:1: Failed to load interface for `Data.Lst' Perhaps you meant Data.List (from base) Data.List (needs flag -package haskell2010-1.0.0.0) Data.Int (needs flag -package haskell2010-1.0.0.0) Use -v to see a list of the files searched for. M ./compiler/main/Finder.lhs -7 +28 }}} Thanks to Max for doing most of the real work. Simon -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2442#comment:19 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler ___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #2442: Heuristics to improve error messages for badly referenced things
#2442: Heuristics to improve error messages for badly referenced things -+-- Reporter: batterseapower|Owner: simonpj Type: feature request | Status: patch Priority: high |Milestone: 7.0.1 Component: Compiler | Version: 6.9 Keywords:| Testcase: Blockedby:| Difficulty: Unknown Os: Unknown/Multiple | Blocking: Architecture: Unknown/Multiple | Failure: None/Unknown -+-- Changes (by mitar): * cc: mmi...@… (added) -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2442#comment:17 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler ___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #2442: Heuristics to improve error messages for badly referenced things
#2442: Heuristics to improve error messages for badly referenced things -+-- Reporter: batterseapower|Owner: simonpj Type: feature request | Status: patch Priority: high |Milestone: 7.0.1 Component: Compiler | Version: 6.9 Keywords:| Testcase: Blockedby:| Difficulty: Unknown Os: Unknown/Multiple | Blocking: Architecture: Unknown/Multiple | Failure: None/Unknown -+-- Changes (by gidyn): * cc: gid...@… (added) -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2442#comment:16 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler ___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #2442: Heuristics to improve error messages for badly referenced things
#2442: Heuristics to improve error messages for badly referenced things -+-- Reporter: batterseapower|Owner: simonpj Type: feature request | Status: patch Priority: high |Milestone: 6.14.1 Component: Compiler | Version: 6.9 Keywords:| Difficulty: Unknown Os: Unknown/Multiple | Testcase: Architecture: Unknown/Multiple | Failure: None/Unknown -+-- Changes (by merehap): * cc: mere...@… (added) -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2442#comment:15 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler ___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #2442: Heuristics to improve error messages for badly referenced things
#2442: Heuristics to improve error messages for badly referenced things -+-- Reporter: batterseapower|Owner: simonpj Type: feature request | Status: patch Priority: high |Milestone: 6.14.1 Component: Compiler | Version: 6.9 Keywords:| Difficulty: Unknown Os: Unknown/Multiple | Testcase: Architecture: Unknown/Multiple | Failure: None/Unknown -+-- Changes (by igloo): * status: new = patch * failure: = None/Unknown * milestone: 6.14 branch = 6.14.1 -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2442#comment:14 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler ___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #2442: Heuristics to improve error messages for badly referenced things
#2442: Heuristics to improve error messages for badly referenced things -+-- Reporter: batterseapower|Owner: simonpj Type: feature request | Status: new Priority: high |Milestone: 6.14 branch Component: Compiler | Version: 6.9 Severity: normal| Resolution: Keywords:| Difficulty: Unknown Testcase:| Os: Unknown/Multiple Architecture: Unknown/Multiple | -+-- Changes (by PHO): * cc: p...@cielonegro.org (added) -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2442#comment:13 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #2442: Heuristics to improve error messages for badly referenced things
#2442: Heuristics to improve error messages for badly referenced things -+-- Reporter: batterseapower|Owner: simonpj Type: feature request | Status: new Priority: high |Milestone: 6.14 branch Component: Compiler | Version: 6.9 Severity: normal| Resolution: Keywords:| Difficulty: Unknown Testcase:| Os: Unknown/Multiple Architecture: Unknown/Multiple | -+-- Changes (by simonmar): * milestone: 6.12.1 = 6.14 branch Comment: Ran out of time; still needs review, and there might be some concerns about performance. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2442#comment:12 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #2442: Heuristics to improve error messages for badly referenced things
#2442: Heuristics to improve error messages for badly referenced things -+-- Reporter: batterseapower|Owner: simonpj Type: feature request | Status: new Priority: high |Milestone: 6.12.1 Component: Compiler | Version: 6.9 Severity: normal| Resolution: Keywords:| Difficulty: Unknown Testcase:| Os: Unknown/Multiple Architecture: Unknown/Multiple | -+-- Changes (by simonmar): * owner: = simonpj -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2442#comment:11 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #2442: Heuristics to improve error messages for badly referenced things
#2442: Heuristics to improve error messages for badly referenced things -+-- Reporter: batterseapower|Owner: Type: feature request | Status: new Priority: high |Milestone: 6.12.1 Component: Compiler | Version: 6.9 Severity: normal| Resolution: Keywords:| Difficulty: Unknown Testcase:| Os: Unknown/Multiple Architecture: Unknown/Multiple | -+-- Comment (by igloo): See also #3209. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2442#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #2442: Heuristics to improve error messages for badly referenced things
#2442: Heuristics to improve error messages for badly referenced things -+-- Reporter: batterseapower|Owner: Type: feature request | Status: new Priority: high |Milestone: 6.12.1 Component: Compiler | Version: 6.9 Severity: normal| Resolution: Keywords:| Difficulty: Unknown Testcase:| Os: Unknown/Multiple Architecture: Unknown/Multiple | -+-- Changes (by igloo): * milestone: 6.12 branch = 6.12.1 -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2442#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #2442: Heuristics to improve error messages for badly referenced things
#2442: Heuristics to improve error messages for badly referenced things -+-- Reporter: batterseapower | Owner: Type: feature request | Status: new Priority: high | Milestone: 6.12 branch Component: Compiler |Version: 6.9 Severity: normal | Resolution: Keywords: | Difficulty: Unknown Testcase: | Architecture: Unknown Os: Unknown | -+-- Changes (by igloo): * priority: normal = high * milestone: = 6.12 branch Comment: I don't think we'll look at this in time for 6.10, but we should make a decision early in 6.12 to avoid collecting any more conflicts than necessary (although I guess it'll be in the wrong VCS by then; ug). -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2442#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #2442: Heuristics to improve error messages for badly referenced things
#2442: Heuristics to improve error messages for badly referenced things +--- Reporter: batterseapower | Owner: Type: proposal| Status: new Priority: normal | Milestone: Component: Compiler|Version: 6.9 Severity: normal | Resolution: Keywords: | Difficulty: Unknown Testcase: | Architecture: Unknown Os: Unknown | +--- Comment (by guest): I've solved the performance problem purely by making use of an edit- distance algorithm based on bit-vectors. This is /very fast/. For future reference, I've actually released it's implementation (plus some other edit distances, QuickCheck tests for it all etc) on Hackage (http://hackage.haskell.org/cgi-bin/hackage-scripts/package/edit- distance). My stress test was compiling GHC.hs with the Module import commented out. This generates a number of unbound name errors, each of which has to do a full scan of the (huge) imported name set. This takes 1 second on my modified GHC compared with 0.3 seconds on an unmodified one. If this is not an acceptable speed I can pursue the other performance-improving possibilities above. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2442#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #2442: Heuristics to improve error messages for badly referenced things
#2442: Heuristics to improve error messages for badly referenced things +--- Reporter: batterseapower | Owner: Type: proposal| Status: new Priority: normal | Milestone: Component: Compiler|Version: 6.9 Severity: normal | Resolution: Keywords: | Difficulty: Unknown Testcase: | Architecture: Unknown Os: Unknown | +--- Changes (by simonpj): * difficulty: = Unknown Comment: Looks splendid. I'd like to review the patch when I get back from holiday, but in principle thumbs-up from me. Thank you! Simon -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2442#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #2442: Heuristics to improve error messages for badly referenced things
#2442: Heuristics to improve error messages for badly referenced things +--- Reporter: batterseapower | Owner: Type: proposal| Status: new Priority: normal | Milestone: Component: Compiler|Version: 6.9 Severity: normal | Resolution: Keywords: | Difficulty: Unknown Testcase: | Architecture: Unknown Os: Unknown | +--- Comment (by batterseapower): Great! For posterity, the accompanying thread on Haskell-Cafe is at http://www.haskell.org/pipermail/haskell-cafe/2008-July/045175.html That thread also discusses what would be a cool improvement: searching all installed packages for the unbound name. However, that would require an actual index and as such is a bit of a heavier-weight solution. As a practical matter, I've been developing GHC using a stage1 compiler with this patch compiled into it and there is a noticable delay when displaying unbound name error messages if there are many things in scope. This is because I have made no attempt to optimize the code yet, and this needs to be resolved. Notes for me, when I get time to look at it: * Cache global reader environment elements between unbound name error messages (I'm guessing eltsUniqFM is fairly expensive) * Revert to the Levenshtein distance (http://en.wikipedia.org/wiki/Levenshtein_distance) rather than one that attempts to account for transpositions too, as the associated algorithm is considerably simpler. Unbox it to the hilt * Possibly adapt the distance metric so it operates in conjunction with a threshold distance it should bail out after -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2442#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #2442: Heuristics to improve error messages for badly referenced things
#2442: Heuristics to improve error messages for badly referenced things ---+ Reporter: batterseapower |Owner: Type: proposal| Status: new Priority: normal |Milestone: Component: Compiler| Version: 6.9 Severity: normal | Resolution: Keywords: | Testcase: Architecture: Unknown | Os: Unknown ---+ Comment (by batterseapower): I've played with this a bit more and there is a small bug in the part of the patch that suggests qualified alternatives. If you are interested in merging the patch, let me know and I will take the time to fix it. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2442#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs