[GHC] #3743: type checker fails to infer an implicit parameter
constraint in the presence of existential types.
GHC
trac at galois.com
Thu Dec 10 14:17:52 EST 2009
#3743: type checker fails to infer an implicit parameter constraint in the
presence of existential types.
---------------------------------+------------------------------------------
Reporter: int-e | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 6.13
Keywords: | Difficulty:
Os: Unknown/Multiple | Testcase:
Architecture: Unknown/Multiple | Failure: None/Unknown
---------------------------------+------------------------------------------
In this code,
{{{
{-# LANGUAGE ImplicitParams, GADTs #-}
class Foo a
data M where M :: Foo a => a -> M
x :: (?x :: ()) => ()
x = undefined
-- foo :: (?x :: ()) => M -> ()
foo y = case y of
M _ -> x
}}}
I'd expect ghc to infer the commented out type for {{{foo}}}. However, it
fails to do that:
{{{
foo.hs:12:12:
Unbound implicit parameter (?x::())
arising from a use of `x' at foo.hs:12:12
In the expression: x
In a case alternative: M _ -> x
In the expression: case y of { M _ -> x }
}}}
Is this a bug or an expected shortcoming of the type checker? The program
compiles fine with the explicit type signature. (In the original program
the type signature was big and completely unenlightening, so I'd rather
not have to write it.)
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3743>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list