pipes-ordered-zip: merge two ordered Producers into a new Producer

[ bioinformatics, bsd3, library ] [ Propose Tags ]

provides a simple function to merge two Pipes-Producers into a new Producer that yields pairs of values of the original producers, but using Maybes to indicate values that are only present in the first, second or both producers. Useful to perform Left-Joins, Right-Joins and Inner-Joins on the fly using Haskell Pipes.

[Skip to Readme]


Maintainer's Corner

For package maintainers and hackage trustees


Versions [RSS], 1.0.1, 1.1.0, 1.2.0, 1.2.1
Change log Changelog.md
Dependencies base (>=4.7 && <5), pipes (>=4.3.11), pipes-safe (>=2.3.1) [details]
License BSD-3-Clause
Copyright 2019 Stephan Schiffels
Author Stephan Schiffels
Maintainer stephan_schiffels@mac.com
Category Bioinformatics
Home page https://github.com/githubuser/pipes-ordered-zip#readme
Uploaded by stephan_schiffels at 2019-09-04T15:54:48Z
Distributions LTSHaskell:1.2.1, NixOS:1.2.1, Stackage:1.2.1
Downloads 1512 total (22 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2019-09-04 [all 1 reports]

Readme for pipes-ordered-zip-1.1.0

[back to package description]


A function to tie together two sorted Haskell Iterators (Producers from the pipes library).


import Pipes (runEffect, (>->), each)
import qualified Pipes.Prelude as P
import Pipes.OrderedZip (orderedZip)

main = do
    let a = each [1,3,4,6,8] -- has to be ordered
        b = each [2,3,4,5,8] -- has to be ordered
    let mergedProd = orderedZip compare a b
    _ <- runEffect $ mergedProd >-> P.print
    return ()


(Just 1,Nothing)
(Nothing,Just 2)
(Just 3,Just 3)
(Just 4,Just 4)
(Nothing,Just 5)
(Just 6,Nothing)
(Just 8,Just 8)