Opened 9 years ago

Closed 9 years ago

#771 closed bug (invalid)

GHC typing too constrained

Reported by: guest Owned by:
Priority: normal Milestone:
Component: Compiler Version: 6.4.1
Keywords: type checking Cc:
Operating System: Linux Architecture: x86
Type of failure: Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):

Description (last modified by simonpj)

for the following program:

  module Bug where

  f :: Maybe Bool
  f = g ()

  g () = do { f; error "bug?" }

If I ask ghci (version: 6.4.1) what the type of g is, it says:

*Bug> :t g
g :: () -> Maybe Bool

However, I think it should be:

Bug> :t g
g :: () -> Maybe a

as reported by Hugs (version: March 2005).

I first thought this was a monomorphism-restriction gotcha, but g is obviously a function, not a constant. And Hugs reports the more general expected type anyhow.

I'm curious to see if this is a real bug or some weird interaction with ghci..

Change History (3)

comment:1 Changed 9 years ago by simonpj

  • Description modified (diff)

comment:2 Changed 9 years ago by simonpj

  • Description modified (diff)

comment:3 Changed 9 years ago by simonmar

  • Resolution set to invalid
  • Status changed from new to closed

This isn't a bug; Hugs is implementing an extension to Haskell 98 called "relaxed dependency analysis", see

GHC 6.4.x doesn't implement this extension, but GHC 6.6 will (note that you need -fglasgow-exts).

Note: See TracTickets for help on using tickets.