I understand "." (dot) as function composition. I understand "|" (pipe) as "or," guard introduction syntax (from here ), but I saw an answer on http-conduits using ".|" that makes use of this operator in a way I do not understand.
The other references for conduits I have found, such as:
...suggest syntax like "$$", "$=", "=$=", "=$" for combining conduits in data flows.
What should I call this ".|" this operator and how does it work?
Predictably, googling for ".| haskell" or "'dot pipe' haskell" or "'dot pipe' haskell operator conduits" were not very successful.
This is just the (recent) new syntax that conduit
uses for fusion. The author wrote a blog-post about this not long ago. To quote from the post, he proposed (and eventually did this) to
Replace the
$=
,=$
, and=$=
operators - which are all synonyms of each other - with the.|
operator. This borrows intuition from the Unix shell, where the pipe operator denotes piping data from one process to another. The analogy holds really well for conduit, so why not borrow it? (We call all of these operators "fusion.")
As an aside, if you ever need to look up operators, Hayoo and Hoogle are the places to go. There is also Stackage Hoogle (thanks @duplode) which lets you look up operators for particular resolvers (which is especially useful here since this is a recent change).
.|
is introduced by the Conduit library and is a synonym to fuse
.
fuse
:: Monad m => Conduit a m b -> ConduitM b c m r -> ConduitM a c m r
fuse
is used for composition of conduit
s the same way as .
operator is used for composition of functions.
Finally, .|
is a new syntax to replace $=
, =$
, and =$=
, which were synonyms anyway.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With