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 ...
It means that
a
andb
have to be instances ofBorked
for(a, b)
to be an instance ofBorked
. So when you try to call one ofBorked
's methods on a tuple, that's only allowed if the tuple's elements are also instances ofBorked
. This allows you to useBorked
's methods on the elements of the tuple in the instance definition.