I'm a a newbie to Haskell and sometimes Haskell type declarations confuse me, too.
It's easy to get lost at first because the tutorial says that the Capitalization
naming convention is usually for type declaration and the camelCase
naming convention is usually for variable.
Actually, this belongs to a higher technique in Haskell, may be polymorphism. Just think of f
, a
and b
as some kind type variables - variables that handle type. And class
in Haskell is not for Object like OOP but for type
. So Functor f
means that type f
belongs to class Functor
and so on.
If you replace these letter a
, b
, c
with some type - called instance
- for example String
Int
Char
. It will make sense:
(.) :: (Int -> Char) -> (String -> Int) -> String -> Char
(<$>) :: Functor Maybe => (String -> Int) -> Maybe String -> Maybe Int -- type `Maybe` belongs to class `Functor`
...