list-zip-def: Provides zips with default values.

[ data, library, public-domain ] [ Propose Tags ]

Typical zip functions like zip, zipWith, and zipWith3 will stop with the shortest list exhausted. Consequently information is lost. This library solves this issue by inserting default values. The these package serves a similar purpose but allows more than just lists to be zipped with the Align type class. However, zipping several lists and using defaults is not as easy.

[Skip to Readme]


[Index] [Quick Jump]


Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


Versions [RSS],,,
Dependencies base (>=4.7 && <4.13) [details]
License LicenseRef-PublicDomain
Author Moritz Bruder
Category Data
Source repo head: git clone -b master
Uploaded by muesli4 at 2018-12-19T20:22:56Z
Reverse Dependencies 1 direct, 0 indirect [details]
Downloads 2413 total (8 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2018-12-19 [all 1 reports]

Readme for list-zip-def-

[back to package description]


Provides zip functions that use a given default value, whenever one list is exhausted, but not all.

Prelude> import Data.List.Zip
Prelude Data.List.Zip> zipDef 0 'x' [1, 2, 3] "a"

The resulting list spine is also lazy:

Prelude Data.List.Zip> let xs = zipDef 0 'x' [1, 2, 3 :: Int] "a"
Prelude Data.List.Zip> :sprint xs
xs = _
Prelude Data.List.Zip> import Data.Maybe
Prelude Data.List.Zip Data.Maybe> listToMaybe xs 
Just (1,'a')
Prelude Data.List.Zip Data.Maybe> :sprint xs
xs = (1,'a') : _