Ticket #7765 (new bug)

Opened 3 months ago

Last modified 2 months ago

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

Reported by: isaacdupree Owned by: igloo
Priority: normal Milestone: 7.8.1
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

Changed 3 months ago by simonpj

  • owner set to igloo
  • difficulty set to Unknown

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

Changed 3 months ago by igloo

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

Changed 3 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

Changed 2 months ago by igloo

  • milestone set to 7.8.1
Note: See TracTickets for help on using tickets.