Skip to content

willGuimont/pipeline

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pipeline

Some transforms utilities based on Arrows from Haskell.

Installation

Add the following line in your requirements.txt:

git+https://github.com/willGuimont/pipeline

Usage

import pipeline as pp

input_value = 7
transform = pp.Compose([
    pp.Tee(),
    pp.First(lambda x: x + 1),
    pp.Second(lambda x: x - 1),
    pp.Both(lambda x: x * 2),
    pp.Bifunctor(lambda x: x // 3, lambda x: x * 2),
    pp.Both(str),
    pp.Lambda(lambda x: ''.join(x))
])

output = transform(input_value)
print(output)
assert output == "524"

Releases

No releases published

Packages

No packages published

Languages