-
Notifications
You must be signed in to change notification settings - Fork 722
Description
Describe the bug
I'm doing some iterative development, things are stubbed out and I'm filling things in a couple definitions at a time. Later definitions often depend on earlier ones so I prefer working through compilation errors in order but without scrolling up through all the output every time.
-freverse-errors should be good enough for now. But I'm unable to make it work with cabal-install, cabal --ghc-option -freverse-errors run test:Course has no effect.
To Reproduce
Steps to reproduce the behavior:
I ran cabal init and stuck with defaults as much as possible to set up a minimally reproducing example (I think these two are the only necessary files, let me know if you need more, I have a cabal.project because I nested this inside another project and otherwise cabal-install picks that up):
==> MRE.cabal <==
cabal-version: 3.0
name: MRE
version: 0.1.0.0
-- synopsis:
-- description:
license: BSD-2-Clause
license-file: LICENSE
author: toonn
maintainer: [email protected]
-- copyright:
category: Testing
build-type: Simple
extra-doc-files: CHANGELOG.md
-- extra-source-files:
common warnings
ghc-options: -Wall
executable MRE
import: warnings
main-is: Main.hs
-- other-modules:
-- other-extensions:
build-depends: base ^>=4.18.2.1
hs-source-dirs: app
default-language: Haskell2010
==> app/Main.hs <==
module Main where
a :: a -> a
a _ = "(Probably) not type a"
b :: [a] -> [a]
b x y = x ++ y
main :: IO ()
main = do
putStrLn ("First error: " ++ a 1)
putStrLn ("Second error: " ++ show (b [1] [2]))
$ cabal --ghc-option -freverse-errors run exe:MRE
Expected behavior
I expected similar output to GHC when this option is passed:
[1 of 2] Compiling Main ( app/Main.hs, app/Main.o )
app/Main.hs:12:39: error: [GHC-83865]
• Couldn't match expected type: [a2] -> a0
with actual type: [a1]
• The function ‘b’ is applied to two value arguments,
but its type ‘[a1] -> [a1]’ has only one
In the first argument of ‘show’, namely ‘(b [1] [2])’
In the second argument of ‘(++)’, namely ‘show (b [1] [2])’
|
12 | putStrLn ("Second error: " ++ show (b [1] [2]))
| ^^^^^^^^^
app/Main.hs:7:1: error: [GHC-83865]
• Couldn't match expected type: [a]
with actual type: [a] -> [a]
• The equation for ‘b’ has two value arguments,
but its type ‘[a] -> [a]’ has only one
• Relevant bindings include
b :: [a] -> [a] (bound at app/Main.hs:7:1)
|
7 | b x y = x ++ y
| ^^^^^^^^^^^^^^
app/Main.hs:4:7: error: [GHC-25897]
• Couldn't match expected type ‘a’ with actual type ‘String’
‘a’ is a rigid type variable bound by
the type signature for:
a :: forall a. a -> a
at app/Main.hs:3:1-11
• In the expression: "(Probably) not type a"
In an equation for ‘a’: a _ = "(Probably) not type a"
• Relevant bindings include a :: a -> a (bound at app/Main.hs:4:1)
|
4 | a _ = "(Probably) not type a"
| ^^^^^^^^^^^^^^^^^^^^^^^
However, cabal-install seems to ignore the option altogether:
Build profile: -w ghc-9.6.5 -O1
In order, the following will be built (use -v for more details):
- MRE-0.1.0.0 (exe:MRE) (first run)
Preprocessing executable 'MRE' for MRE-0.1.0.0..
Building executable 'MRE' for MRE-0.1.0.0..
[1 of 1] Compiling Main ( app/Main.hs, /home/toonn/src/Data61-fp-course/MRE/dist-newstyle/build/x86_64-linux/ghc-9.6.5/MRE-0.1.0.0/x/MRE/build/MRE/MRE-tmp/Main.o )
app/Main.hs:4:7: error: [GHC-25897]
• Couldn't match expected type ‘a’ with actual type ‘String’
‘a’ is a rigid type variable bound by
the type signature for:
a :: forall a. a -> a
at app/Main.hs:3:1-11
• In the expression: "(Probably) not type a"
In an equation for ‘a’: a _ = "(Probably) not type a"
• Relevant bindings include a :: a -> a (bound at app/Main.hs:4:1)
|
4 | a _ = "(Probably) not type a"
| ^^^^^^^^^^^^^^^^^^^^^^^
app/Main.hs:7:1: error: [GHC-83865]
• Couldn't match expected type: [a]
with actual type: [a] -> [a]
• The equation for ‘b’ has two value arguments,
but its type ‘[a] -> [a]’ has only one
• Relevant bindings include
b :: [a] -> [a] (bound at app/Main.hs:7:1)
|
7 | b x y = x ++ y
| ^^^^^^^^^^^^^^
app/Main.hs:12:39: error: [GHC-83865]
• Couldn't match expected type: [a2] -> a0
with actual type: [a1]
• The function ‘b’ is applied to two value arguments,
but its type ‘[a1] -> [a1]’ has only one
In the first argument of ‘show’, namely ‘(b [1] [2])’
In the second argument of ‘(++)’, namely ‘show (b [1] [2])’
|
12 | putStrLn ("Second error: " ++ show (b [1] [2]))
| ^^^^^^^^^
System information
- Operating system:
> uname -a
Linux yorp 6.6.52 #1-NixOS SMP PREEMPT_DYNAMIC Wed Sep 18 17:24:10 UTC 2024 x86_64 GNU/Linux
cabal,ghcversions:
> cabal --version; ghc --version
cabal-install version 3.10.3.0
compiled using version 3.10.3.0 of the Cabal library
The Glorious Glasgow Haskell Compilation System, version 9.6.5
Additional context
Add any other context about the problem here.