Opened 14 months ago

Last modified 9 months ago

#7765 new bug

Odd error message for `runghc` with missing `main` function.

Reported by: isaacdupree Owned by:
Priority: normal Milestone: 7.8.3
Component: Compiler Version: 7.6.1
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

Description

% cat what.hs
module Main where {}

% runghc what.hs
what.hs:1:33:
    Not in scope: `main'
    Perhaps you meant `min' (imported from Prelude)

'ghc what.hs' gives a rather more sensible message.

Change History (5)

comment:1 Changed 14 months ago by simonpj

  • Difficulty set to Unknown
  • Owner set to igloo

Nothing to do with runghc really; its the -e mode:

ghc -e wombat what.hs
<interactive>:1:1: Not in scope: ‛womab’

But really it should say

what.hs:1:33:
    Not in scope: `main'
    Perhaps you meant `min' (imported from Prelude)

I'm not sure where the -e processing happens, and couldn't find it with a quick look. Ian, you've been refactoring the pipeline recently, might you look?

Simon

comment:2 Changed 14 months ago by igloo

I'm confused - doesn't it already say that?

comment:3 Changed 14 months ago by simonpj

Oh, sorry, I meant that it should say

what.hs:1:1: The function `main' is not defined in module `Main'

If instead it was

module What2 where
foo = True

and you said

ght -e bar What2.hs

then a "not in scope" message would make more sense. But in the common case of 'main' (which is what happens with runghc), the No main in Main message is better

Simon

comment:4 Changed 12 months ago by igloo

  • Milestone set to 7.8.1

comment:5 Changed 9 months ago by igloo

  • Owner igloo deleted
Note: See TracTickets for help on using tickets.