I want to use something like "type class variable".

Suppose I have a value of type "Either Int Double" and I want to double

it's content and get back the value wrapped back into that Either. I can

write a function that can work on all types that belongs to the Num class,

i.e. "Num a => a -> a". Both Int and Double are members of the Num class,

so I can apply this function to any of those.

Now replace the "Num" class to a variable, in my example "tc" (short for

"type class"), as long as the function I'm trying to apply rely only on

functions defined by the type class "tc" and both sides of Either belongs

to the class "tc", then I can apply that function to it.

That's what I'm trying to express.

2013/10/9 Kim-Ee Yeoh <ky3 at atamo.com>

>

> On Thu, Oct 10, 2013 at 1:28 AM, Thiago Negri <evohunz at gmail.com> wrote:

>

>> foo :: (tc a, tc b) => (forall c. tc c => c -> c) -> Either a b -> Either

>> a b

>

>

> Aren't type classes supposed to be Capitalized?

>

> -- Kim-Ee

>

> _______________________________________________

> Beginners mailing list

> Beginners at haskell.org

>

http://www.haskell.org/mailman/listinfo/beginners>

>

-------------- next part --------------

An HTML attachment was scrubbed...

URL: <

http://www.haskell.org/pipermail/beginners/attachments/20131009/a09c508a/attachment.htm>