map -package:Cabal -package:base -package:case-insensitive -package:bytestring -package:blaze-html -package:containers -package:aeson -package:hedgehog -package:regex-tdfa package:utility-ht

This function combines every pair of neighbour elements in a list with a certain function.
>>> mapAdjacent (<=) ""

>>> mapAdjacent (<=) "a"

>>> mapAdjacent (<=) "aba"

>>> mapAdjacent (,) "abc"
\x xs -> mapAdjacent subtract (scanl (+) x xs) == (xs::[Integer])
>>> let f x y z = [x,y]++show(z::Int) in mapAdjacent1 f 'a' [('b',1), ('c',2), ('d',3)]
Cf. (***). Apply two functions on corresponding values in a pair, where the pattern match on the pair constructor is lazy. This is crucial in recursions such as the one of partition. One the other hand there are applications where strict application is crucial, e.g. mapSnd f ab where the left pair member is a large lazy list. With the lazy mapSnd we make the application of f depend on the whole pair ab. See Data.Tuple.Example for two examples where one variant is definitely better than the other one.