Published: February 21, 2018
by Tobias Pleyer
Tags: haskell

Haskell Pipes Walkthrough

Intro

Lately I discovered Haskell’s pipes package. It’s a really nice package, but not to grasp so easily. The author, Gabriel Gonzalez, has an execellent knowledge of Haskell. I had a quick look at his other stuff and he always writes crystall clear, well documented and he loves category theory…

I’d like to understand more of the code of the pipes package and how it works. As usual you best learn something when you work with it, so what follows is a complete evaluation of a simple program using pipes.

Note: I have verified that each step does in fact lead to the same results.

Note 2: Simply installing the pipes package and other package dependencies is not enough to run the code snippets below, because functions like _bind and data types like Proxy are not exported by the pipes package (not public). So what I did is download the package sources and then created my own stack project on top of it in which I explicitly export these definitions.

Evaluation in 32 steps

equals…

equals…

equals…

equals…

equals…

equals…

equals…

equals…

equals…

equals…

equals…

equals…

equals…

equals…

equals…

equals…

equals…

equals…

equals…

equals…

equals…

equals…

equals…

equals…

equals…

equals…

equals…

equals…

equals…

equals…

equals…