A previous question discussed how the type of Haskell expression ap zip tail
can be translated into the type of \x -> zip x (tail x)
. It was enlightening, but neither the question nor answer there dealt with why the former expression gives the same results as the latter expression, only that their types are equivalent. For all I know it could've meant \x -> zip x (tail (tail x))
instead.
I tried reading the documentation for ap but got nowhere. How does one read ap
to get the understanding that ap zip tail
gives the same results as \x -> zip x (tail x)
?