I came across a Haskell function that tells you if a list is sorted, and it's hard for me to figure out how this works.
The code in question
f = zipWith (<=) <*> tail
which, as I understand it, is equivalent (in exact style) to
f' xs = zipWith (<=) xs (tail xs)
and as an example returns
f [4, 5, 1] == [True,False]
I suppose this has something to do with the monad list and sequential application, but it would be appreciated if someone could make the meaning more clear to me. What does <*> do here?
source share