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]
Versions [faq],,,
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 Wed Dec 19 20:22:56 UTC 2018
Distributions NixOS:
Downloads 654 total (50 in the last 30 days)
Rating (no votes yet) [estimated by rule of succession]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs available [build log]
Last success reported on 2018-12-19 [all 1 reports]


[Index] [Quick Jump]


Maintainer's Corner

For package maintainers and hackage trustees

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') : _