Skip to content

-j parameter in batch mode causes different error reporting

Test case:

-- A.hs
module A where

a :: Int
a = "asdf"

-- B.hs
module B where

b :: Int
b = blah

-- Main.hs
import A
import B

main = print (a + b + c)

If I build Main.hs without a -j parameter or with -j1 I only get the error in A.hs. Any other -j parameter (e.g. -j2) generates errors in both A.hs and B.hs.

From a UX point of view I think number of threads used should not make a difference in number of errors reported, or the order of errors.

Between the two behaviors:

  • Stop after the first error (as in the case with -j1)
  • Report as many errors as possible (as in the case with -j2 and above)

I think the second is a better from UX point of view, as that makes development in an IDE better when using ghcid or similar.

Note that if I add one more module, C.hs, with -j2 I get three errors, not two. So it seems like once parallelism is enabled I get all the errors, and the compiler takes a different code path in with -j1 that stops after the first error.

(Same behavior exists in GHCi too)

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information