Re: [Haskell] Class type constraining?

2007-06-22 Thread Hugo Pacheco
That doesn't help in any sense, my problem is that I need to use the class method, but I take the context from granted, but the compiler still needs a "general" instance for any functor f. hugo ___ Haskell mailing list Haskell@haskell.org http://www.hask

Re: [Haskell] Class type constraining?

2007-06-22 Thread Benja Fallenstein
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 se

[Haskell] Class type constraining?

2007-06-22 Thread Hugo Pacheco
Hi, I have a set of functor definitions with corresponding instances newtype Id a = Ident {unIdent :: a} deriving Eq newtype K b a = Const {unConst :: b} deriving Eq instance Functor Id where fmap f (Ident x) = Ident $ f x instance Functor (K a) where fmap f (Const x) = Const x