inferred type doesn't type-check (using type families)

Roland Zumkeller roland.zumkeller at gmail.com
Tue Nov 3 13:28:55 EST 2009


Hi,

Compiling

> class WithT a where
>   type T a

> f :: T a -> a -> T a
> f = undefined

> g x = f x 42

with -XTypeFamilies -fwarn-missing-signatures gives:

             Inferred type: g :: forall a. (Num a) => T a -> T a

Adding

> g :: Num a => T a -> T a

results in:

    Couldn't match expected type `T a' against inferred type `T a1'
    In the first argument of `f', namely `x'

Is the inferred type not the right one? Is g typeable?

Best,

Roland

-- 
http://alacave.net/~roland/


More information about the Glasgow-haskell-users mailing list