haskell / haskell/haskell-mode

Orphan instances detection in haskell-process-trigger-suggestions is outdated

Open
#1,110 8 comments 0 reactions 1 assignee Claimed by @geraldus View on GitHub
Dominant language
Emacs Lisp
Stars
1.4k
Forks
354
Avg merge
5d 10h
Merged PRs (30d)
2

Description

I can't be certain, but it looks like orphan instance warning have changed in recent versions of GHC. Currently `haskell-process-trigger-suggestions` function uses following regex to detect orphan instance warnings in compiler response `"Warning: orphan instance: "` [[1](https://github.com/haskell/haskell-mode/blob/322782edfb3603911431e75d171fad9a9dfe6ff4/haskell-load.el#L153)], while GHC 7.10.3 gives a bit different formatting:

```
/Users/oman/dev/haskell/sol/solitaire/src/Solitaire.hs:12:10: Warning:
Orphan instance: instance Show Layer
To avoid this
move the instance declaration to the module of the class or of the type, or
wrap the type with a newtype and declare the instance on the new type.
```

As a result, `haskell-process-trigger-suggestions` does not suggest to add OPTIONS pragma as intended.

@gracjan I know we need tests for this function, it's quite big and good test suite should rely on genuine GHC response, what will you say?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.