Implicit parameter constraints not inferred

Benjamin Franksen benjamin.franksen at
Sat Nov 6 09:02:58 EST 2004

To be fair, the ghc docs do not mention constraint inference for implicit 
parameters. OTOH they do not say that signatures must be given explicitly if 
I use implicit parameters.

However, I always thought that this would be ok:

> main = let ?b = True in use_b

> --use_b :: (?g::Bool) => IO ()
> use_b = print ?b 

It isn't: ghc -fimplicit-params says

    Unbound implicit parameter (?b :: a)
      arising from use of implicit parameter `?b' at TestBug.hs:4
    In the first argument of `print', namely `?b'
    In the definition of `use_b': use_b = print ?b

It works if I uncomment the signature. I also tried

> use_b = print (?b :: Bool)

but to no avail.

Using ghc-6.2.2, btw.

My question: Is this as it should be or is it a bug?


More information about the Glasgow-haskell-users mailing list