Skip to content

Add support for -ferror-spans #151

Closed
@hvr

Description

@hvr

A nice feature of the next-error facility is to highlight the region the error/warning message applies to. GHC by default only emits the line-no and the starting column-index, e.g.

testoverloaded.hs:6:17:
    Couldn't match expected type `B8.ByteString'
                with actual type `[Char]'
    In the first argument of `B8.putStrLn', namely `bar'
    In a stmt of a 'do' block: B8.putStrLn bar
    In the expression: do { B8.putStrLn bar }
Failed, modules loaded: none.

This way, Emacs has to highlight from column-index 17 till end-of-line, even though the expression affected may not extend that far. However, GHC supports -ferror-spans which provides a column-index span, thus allowing to pinpoint the expression better, e.g.

testoverloaded.hs:6:17-19:
    Couldn't match expected type `B8.ByteString'
                with actual type `[Char]'
    In the first argument of `B8.putStrLn', namely `bar'
    In a stmt of a 'do' block: B8.putStrLn bar
    In the expression: do { B8.putStrLn bar }
Failed, modules loaded: none.

For haskell-interactive-mode support for this depends on #62 (as highlighting comes for free when integrating with the next-error framework)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions