Skip to content

Bad error message: <no location info> for a known main module

Summary

When main-is file contains module header declaring module name other than Main, a user gest misleading message:

<no location info>: error:
    output was redirected with -o, but no output will be generated
because there is no Main module.
  1. The real cause is the wrong main module name.
  2. Location info presents — it's known from main-is.

Steps to reproduce

-- foo.cabal
executable foo
  main-is: Foo.hs
-- Foo.hs
module Foo where

Expected behavior

An error message like:

main-is directive does not match module name:
Saw: ‘Foo’
Expected: ‘Main’

Environment

  • GHC version used: 8.8.3, 8.10.1
Edited by Yuriy Syrovetskiy
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information