DanielG/cabal-helper

Non-exaustive Pattern Match

JorisBlanken opened this issue · 4 comments

Looks like there is a non-exhaustive pattern match here:
https://github.com/DanielG/cabal-helper/blob/master/lib/Distribution/Helper.hs#L603

This is causing the following error for me using HIE through the Haskell Language Server extension in vscode:
hie-wrapper: user error (Pattern match failure in do expression at lib\Distribution\Helper.hs:603:7-22)

The error is preceeded by the following, which might be the cause of an empty list.

'stty' is not recognized as an internal or external command,
operable program or batch file.

Full HIE log:

2020-01-04 21:37:03.1001694 [ThreadId 3] - run entered for hie-wrapper(hie-wrapper) Version 1.0.0.0, Git revision a8c156b8a12d03c9eb4a23174eaac1eb9725eff1 (3539 commits) x86_64 ghc-8.6.5
2020-01-04 21:37:03.1021712 [ThreadId 3] - Current directory:d:\source\demo-project
2020-01-04 21:37:03.1021712 [ThreadId 3] - Operating system:mingw32
2020-01-04 21:37:03.1031721 [ThreadId 3] - Cabal-Helper found these projects: ["ProjLocStackYaml {plStackYaml = \"d:\\\\source\\\\demo-project\\\\stack.yaml\"}"]
2020-01-04 21:37:03.1041732 [ThreadId 3] - These projects have the build tools installed: ["ProjLocStackYaml {plStackYaml = \"d:\\\\source\\\\demo-project\\\\stack.yaml\"}"]
2020-01-04 21:37:03.1041732 [ThreadId 3] - Cabal-Helper dirs: ["d:\\source\\demo-project","d:\\source\\demo-project\\File.hs"]
'stty' is not recognized as an internal or external command,
operable program or batch file.
'stty' is not recognized as an internal or external command,
operable program or batch file.
hie-wrapper: user error (Pattern match failure in do expression at lib\Distribution\Helper.hs:603:7-22)
[Error - 9:37:04 PM] Connection to server got closed. Server will not be restarted.

I realize that this issue might stem from HIE, but I wanted to make you aware of the ungraceful exit due to the failed pattern matching.

Looks like there is a non-exhaustive pattern match here:

This isn't technically a non-exhaustive pattern, it's syntax sugar for MonadFail.

Looks like there is a non-exhaustive pattern match here:

This isn't technically a non-exhaustive pattern, it's syntax sugar for MonadFail.

Good point, so is this something that should be fixed on hie-wrapper's end then?

I suppose at the very least the error handling here could be better. listPackageCabalFiles should really just return a NonEmpty and produce a nice error message when no cabal files are returned by stack.

This is causing the following error for me using HIE through the Haskell Language Server extension in vscode:
hie-wrapper: user error (Pattern match failure in do expression at lib\Distribution\Helper.hs:603:7-22)

I got this problem, too. So how do i fix this?
Follows are my error message:

2020-02-25 15:50:23.528457926 [ThreadId 4] - run entered for hie-wrapper(hie-wrapper) Version 1.1, Git revision 91422e95459130633905ab619772150860b2da2d (3793 commits) x86_64 ghc-8.8.2
2020-02-25 15:50:23.528668252 [ThreadId 4] - Current directory:/home/hypnoes/source/repos/devoke
2020-02-25 15:50:23.528888129 [ThreadId 4] - Operating system:linux
2020-02-25 15:50:23.528938775 [ThreadId 4] - args:["--lsp"]
2020-02-25 15:50:23.529891149 [ThreadId 4] - Cabal-Helper decided to use: ProjLocStackYaml {plStackYaml = "/home/hypnoes/source/repos/devoke/stack.yaml"}
Stack has not been tested with GHC versions above 8.6, and using 8.8.2, this may fail
Stack has not been tested with Cabal versions above 2.4, but version 3.0.1.0 was found, this may fail
Stack has not been tested with GHC versions above 8.6, and using 8.8.2, this may fail
Stack has not been tested with Cabal versions above 2.4, but version 3.0.1.0 was found, this may fail
hie-wrapper: user error (Pattern match failure in do expression at lib/Distribution/Helper.hs:603:7-22)
[Info  - 3:50:24 PM] Connection to server got closed. Server will restart.