2007/6/22, Hugo Pacheco <[EMAIL PROTECTED]>:
class Functor f => C f a b | f a -> b where
   ftest :: f a -> b

I want to write some function

test :: (C f a b) => (a -> b)
test = ftest . undefined

I'm not sure whether this is what you want, but the "obvious" way to
make this type-check would seem to be to add a functional dependency
and a type signature for 'undefined,' like this:

class Functor f => C f a b | f a -> b, a b -> f where
   ftest :: f a -> b

test :: (C f a b) => (a -> b)
test = ftest . (undefined :: a -> f a)

- Benja
_______________________________________________
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to