summaryrefslogtreecommitdiff
path: root/ghc/compiler/tests/deSugar/ds005.hs
blob: 505d500e3f640728e2e7c9c60f386fbc3effc8eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
--!!! ds005 -- mappairs from SLPJ Ch 5'
--
-- this simply tests a "typical" example

module MapPairs where

-- from SLPJ, p 78
mappairs f []     ys     = []
mappairs f (x:xs) []     = []
mappairs f (x:xs) (y:ys) = f x y : mappairs f xs ys

-- from p 80
mappairs' f []     ys     = []
mappairs' f x      []     = []
mappairs' f (x:xs) (y:ys) = f x y : mappairs' f xs ys