Giter Club home page Giter Club logo

Comments (6)

gracjan avatar gracjan commented on May 18, 2024

Important part of error message is the cross referencing information point to related files and lines of code. gcc and clang always put file name and line number as first information in output line:

file.cpp:12: ambiguous symbol 'xxx'
file.h:12: from a file included here
header.h:444: from a file included here

Sadly GHC likes to put paths to source files inside sentences so we have to discover where is the cross referencing information.

from haskell-ide-engine.

mgsloan avatar mgsloan commented on May 18, 2024

It would be great to have -fdefer-type-errors prepend something to the warnings which are outputted for errors (maybe "Error: "). I'd like to have -fdefer-type-errors be a default, but still present the messages as if they were errors.

from haskell-ide-engine.

alanz avatar alanz commented on May 18, 2024

I think there has been a change to prepend "error", will be in 8.0.1, may
be in 7.10.2 already

On Tue, Oct 27, 2015 at 12:41 AM, Michael Sloan [email protected]
wrote:

It would be great to have -fdefer-type-errors prepend something to the
warnings which are outputted for errors (maybe "Error: "). I'd like to have
-fdefer-type-errors be a default, but still present the messages as if
they were errors.


Reply to this email directly or view it on GitHub
#7 (comment).

from haskell-ide-engine.

cocreature avatar cocreature commented on May 18, 2024

One thing that I keep stumbling upon is the fact that suggestions to enable pragmas always have slightly different formats causing tools which try to parse them such as haskell-mode to not recognize them in a lot of cases.

from haskell-ide-engine.

nponeccop avatar nponeccop commented on May 18, 2024

What about .cabal errors? Now there are errors which are returned without any file position information, so we can't put them as diagnostics.

from haskell-ide-engine.

jneira avatar jneira commented on May 18, 2024

As pointed by @mpickering there are a ghc proposal to implement structured errors: https://github.com/bgamari/ghc-proposals/blob/rich-errors-proposal/proposals/0000-rich-errors-proposal.rst. It is pretty recent (3 months).

To fix some bugs for windows i had to add more cases in parsing human readable ghc errors:

let prefixes = [ "Could not load module `Data.Text'" -- Windows && GHC >= 8.6
, "Could not find module `Data.Text'" -- Windows
, "Could not load module ‘Data.Text’" -- GHC >= 8.6
, "Could not find module ‘Data.Text’"
]

or

extractTerm prefix symTy =
importMsg
>>= T.stripPrefix prefix
>>= \name -> Just (name, Import symTy)
extractType b =
extractTerm ("Not in scope: type constructor or class " <> b) Type
extractedTerm = asum
[ extractTerm "Variable not in scope: " Symbol
, extractType ""
, extractType "`" -- Needed for windows
, extractTerm "Data constructor not in scope: " Constructor]

from haskell-ide-engine.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.