The pairs function needs to do something like this:
pairs [1, 2, 3, 4] -> [(1, 2), (2, 3), (3, 4)]
Call to the Aztec god of consecutive numbers:
import Control.Monad (ap) import Control.Monad.Instances() -- for Monad ((->) a) foo = zip`ap`tail $ [1,2,3,4]