Implicit Parameter Bug?

Ashley Yakeley ashley@semantic.org
Sun, 3 Feb 2002 18:22:56 -0800


What's wrong with this?

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

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

    h :: a -> a
    h = f g

'ghci -fglasgow-exts' (5.02) gives this error:

    Could not deduce (?param :: a) from the context ()
    Probable fix:
        Add (?param :: a) to the type signature(s) for h
    arising from use of `g' at Implicit.hs:10
    In the first argument of `f', namely `g'
    In the definition of `h': f g

'hugs -98' (Feb 2000) gets as far as this:

Reading file "/usr/share/hugs98/lib/Prelude.hs":
Reading file "Implicit.hs":
Type checking      

...and spins there.

There's a workaround for ghci, but it doesn't help hugs:

    h :: a -> a
    h = f (g with ?param = ?param)

This is very odd, as surely the type of (g with ?param = ?param) is the 
same as the type of g?

-- 
Ashley Yakeley, Seattle WA