Skip to content

Instantly share code, notes, and snippets.

@gelisam
gelisam / UnderstandingPipes.md
Last active May 16, 2019 13:48
Understanding the Pipes library

In response to this reddit post about failing to understand the Pipes library after a couple of hours. I wanted to show how an experienced haskeller does it, but I'm afraid it also took me quite a few hours, which is why the following list of steps goes on and on.

After all those hours, my opinion is that Pipes is not at all an easy library. I don't know if Conduit is any easier, but otherwise I side with your friend in advising to use something else (perhaps ordinary lazy IO?) instead of Pipes.

Anyway, here is the full brain dump of my steps as I tried to get your three snippets to fit together.

  • Since you say that you have a hard time combining the snippets, I assume that they must have complicated types. So my first goal is to figure out the type of your first snippet.
  • hoogle for parseUrl, withManager, etc. No results.
  • Google for haskell runEffect, find that it's a method from Pipes.Core,
(require 'util)
(require 'flycheck)
(require 'evil-leader)
;;; Code:
(add-to-list 'exec-path "~/.cabal/bin/")
(add-to-list 'exec-path "~/Library/Haskell/current/bin/")
(install-and-require #'haskell-mode)