[GHC] #771: GHC typing too constrained

GHC trac at galois.com
Mon May 15 06:19:44 EDT 2006


#771: GHC typing too constrained
------------------------------+---------------------------------------------
    Reporter:  guest          |        Owner:         
        Type:  bug            |       Status:  new    
    Priority:  normal         |    Milestone:         
   Component:  Compiler       |      Version:  6.4.1  
    Severity:  normal         |   Resolution:         
    Keywords:  type checking  |   Difficulty:  Unknown
Architecture:  x86            |           Os:  Linux  
------------------------------+---------------------------------------------
Old description:

> 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..

New description:

 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..

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/771>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the Glasgow-haskell-bugs mailing list