Error when ($) is used, but no error without

Robin Bate Boerop robin_bb at acm.org
Thu Apr 27 00:01:16 EDT 2006


This code compiles properly (with -fglasgow-exts on GHC 6.4.1):

class CC a
type C x = CC a => a x
f, g :: C a -> Int
f _ = 3
g x = f x

But, this code:

class CC a
type C x = CC a => a x
f, g :: C a -> Int
f _ = 3
g x = f $ x  -- the only change

gives this error:

     Inferred type is less polymorphic than expected
       Quantified type variable `a' escapes
       Expected type: a a1 -> b
       Inferred type: C a1 -> Int
     In the first argument of `($)', namely `f'
     In the definition of `g': g x = f $ x

What's going on here?

-- 
Robin Bate Boerop





More information about the Glasgow-haskell-users mailing list