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

[ data, library, public-domain ] [ Propose Tags ] [ Report a vulnerability ]

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]

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 0.1.0.0, 0.1.0.1, 0.1.0.2, 0.1.0.3
Dependencies base (>=4.7 && <4.13) [details]
License LicenseRef-PublicDomain
Author Moritz Bruder
Maintainer muesli4@gmail.com
Category Data
Source repo head: git clone https://github.com/muesli4/list-zip-def.git -b master
Uploaded by muesli4 at 2018-12-19T20:22:56Z
Distributions
Reverse Dependencies 1 direct, 0 indirect [details]
Downloads 2508 total (4 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-0.1.0.3

[back to package description]

list-zip-def

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"
[(1,'a')(2,'x')(3,'x')]

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