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 0.1.0.0, 0.1.0.1, 0.1.0.2
Dependencies base (>=4.7 && <4.12) [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 Wed Sep 5 04:40:50 UTC 2018
Distributions NixOS:0.1.0.2
Downloads 531 total (14 in the last 30 days)
Rating (no votes yet) [estimated by rule of succession]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2018-09-05 [all 1 reports]
Hackage Matrix CI

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

For package maintainers and hackage trustees


Readme for list-zip-def-0.1.0.2

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