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

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain] [Publish]

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]

Properties

Versions 0.1.0.0, 0.1.0.1, 0.1.0.2, 0.1.0.3, 0.1.0.3
Change log None available
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:23Z

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


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