Type syntax =>for typeclasses .
When you say f :: (Something a) => a, you do not say what ais Something, you say that it is a type of "in group" Something.
For example, Numis a class that includes types such as Intand Float. However, there is no type Num, so I can’t say
f :: Num -> Num
f x = x + 5
However i could say
f :: Int -> Int
f x = x + 5
or
f :: (Num a) => a -> a
f x = x + 5
source
share