Abstract

The aim of this note is to present an alternative definition of the zipWith family in the Haskell Library Report [5]. Because of the difficulties in defining a well-typed function with a variable number of arguments, [5] presents a family of zipWith functions. It provides zip functions zipWith 2 ; zipWith 3 ; : : : ; zipWith 7 . For each n, zipWith n zips n lists with a n-ary function. Defining a single zipWith function with a variable number of arguments seems to require dependent types. We show, however, how to define such a function in Haskell by means of a binary operator for grouping its arguments. For comparison, we also give definitions of zipWith in languages with dependent types. 1 zipWith in the Haskell library The Haskell library [5] supplies the programmer with a family of functions zipWith 2 , zipWith 3 , . . . , zipWith 7 indexed by the number of lists to which it applies. For instance, zipWith 4 is defined as follows. zipWith4 :: (a-?b-?c-?d-?e) -? [a]-?[b]-?[c]-?[d]...