Another Implicit Parameter Infelicity

Ashley Yakeley ashley@semantic.org
Sun, 3 Feb 2002 19:09:08 -0800


Neither ghci nor hugs like this:

    g :: (?param :: a) => a
    g = ?param

    p :: Maybe ((?param :: a) => a)
    p = return g;

'ghci -fglasgow-exts' (5.02) says:

    Illegal constraint ?param :: a
    In the type: forall a. Maybe ({?param :: a} => a)
    While checking the type signature for `p'

'hugs -98' (Feb 2000) says:

ERROR "Implicit.hs" (line 12): Syntax error in type expression 
(unexpected implicit parameter "?param")

Not only that, but they both complain about this:

    q :: b -> ((?param :: a) => a)
    q b = g

...even though it can only mean this:

    q :: (?param :: a) => b -> a
    q b = g

(which works fine with both).

However, this _does_ work, but only in ghci:

   f :: ((?param :: a) => b) -> a -> b
   f foo a = foo with ?param=a

Hugs just spins trying to do 'Type checking'.


-- 
Ashley Yakeley, Seattle WA