What is the arrow in this instance declaration for?

111 Views Asked by At

I'm reading Real World Haskell and I came across an example wherein a => arrow is used something like this,

class Borked a where ...

instance (Borked a, Borked b) => Borked (a, b) where ...

How is this different from

instance Borked (a, b) where ...
1

There are 1 best solutions below

0
On BEST ANSWER

It means that a and b have to be instances of Borked for (a, b) to be an instance of Borked. So when you try to call one of Borked's methods on a tuple, that's only allowed if the tuple's elements are also instances of Borked. This allows you to use Borked's methods on the elements of the tuple in the instance definition.