Closed EduardSergeev closed 10 months ago
Huh, weird. Stack and Cabal must call GHC with different paths. Here's what I see from stack ghci --ghci-options -ddump-json
:
{
"doc": "• Couldn't match expected type ‘a’ with actual type ‘()’\n ‘a’ is a rigid type variable bound by\n the type signature for:\n oh_no :: forall a. a\n at /workspaces/scratch/library/Scratch.hs:3:1-10\n• In the expression: ()\n In an equation for ‘oh_no’: oh_no = ()\n• Relevant bindings include\n oh_no :: a (bound at /workspaces/scratch/library/Scratch.hs:4:1)",
"messageClass": "MCDiagnostic SevError ErrorWithoutFlag Just GHC-25897",
"span": {
"endCol": 11,
"endLine": 4,
"file": "/workspaces/scratch/library/Scratch.hs",
"startCol": 9,
"startLine": 4
}
}
Note that the file path is absolute.
And here's what I see from cabal repl --repl-options -ddump-json
:
{
"doc": "• Couldn't match expected type ‘a’ with actual type ‘()’\n ‘a’ is a rigid type variable bound by\n the type signature for:\n oh_no :: forall a. a\n at library/Scratch.hs:3:1-10\n• In the expression: ()\n In an equation for ‘oh_no’: oh_no = ()\n• Relevant bindings include\n oh_no :: a (bound at library/Scratch.hs:4:1)",
"messageClass": "MCDiagnostic SevError ErrorWithoutFlag Just GHC-25897",
"span": {
"endCol": 11,
"endLine": 4,
"file": "library/Scratch.hs",
"startCol": 9,
"startLine": 4
}
}
Note that the file path is relative.
When a default "Stack + Cabal" project (i.e. created via
stack new --bare kurt
command) is opened using the followingpurple-yolk.haskell.interpreter.command
command:the errors do get correctly reported in VSCode
Problems
tab however if you click on the actual error in VSCodeProblems
tab it then tries to open corresponding file using invalid path which results in the following error message in VSCode:Logs show that GHCi does report a correct path for the file with error, e.g.:
but this extension tried to open this file using the following invalid path instead: