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]
Versions [faq], 1.0.1, 1.1.0
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 NixOS:1.1.0
Downloads 994 total (5 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs available [build log]
Last success reported on 2019-09-04 [all 1 reports]


[Index] [Quick Jump]


Maintainer's Corner

For package maintainers and hackage trustees

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)