I've recently started trying to learn Haskell by reading LearnYouAHaskell and random articles from the internet.
I'm having hard time understanding more sophisticated function types.
Some examples that I understand.
> :t map
map :: (a -> b) -> [a] -> [b]
It takes in a function (which takes a and gives out b, i.e a and b can be of different types) and a list of a's and return a list of b's.
> :t fst
fst :: (a, b) -> a
Takes in a tuple of 2 elements (allows different types) and returns the first one.
> :t any
At a higher level, I understand any. It takes in a function and a list and returns true if any of the list entries return true for that particular function. I've used it in Python and JavaScript as well.
Questions
I don't understand how does
any :: Foldable t => (a -> Bool) -> t a -> Booltranslate to the above.(a -> Bool)is the predicate. Takes in an argument and returns true or false.t a -> BoolBool is the end result of any. According to my understanding t and a represent the predicate and the list. Why aren't they separated by a->
How to go about understanding type signatures in general and how to dig deeper so that I can approach them myself?