<div dir="ltr"><div><div>The reason is because the operator $= puts together a source and a conduit and returns a new source.<br><br></div>The operator =$= is used to combine two conduits into another conduit.<br><br></div>
With $= if you try to put two conduits together, the underlying types just won&#39;t match up.  They don&#39;t match up specifically to tell you that you are not quite doing it correctly.  It is trying to match the first argument to a source, which has its input type restricted to ().  Since you have a string there, then it complains.<br>
<br>So try display = CL.iterM putStrLn =$= CL.iterM putStrLn  which does exactly what you were looking for.<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Apr 9, 2013 at 6:34 PM, Ovidiu D <span dir="ltr">&lt;<a href="mailto:ovidiudeac@gmail.com" target="_blank">ovidiudeac@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Given the following works as expected (i.e. prints the value twice):<br><br>main = <br>    Conduit.sourceList [1..14] <br>
</div>    $= Conduit.map show<br><div>    $= Conduit.iterM putStrLn<br>    $= Conduit.iterM putStrLn <br>
    $$ Conduit.sinkNull<br><br>I would expect the following to work as well:<br>main = <br>    Conduit.sourceList [1..14] <br>    $= Conduit.map show <br>    $= display <br>    $$ Conduit.sinkNull<br><br>display = Conduit.iterM putStrLn $= Conduit.iterM putStrLn<br>

<br></div><div>...but I get the compilation error:<br>Couldn&#39;t match expected type `String&#39; with actual type `()&#39;<br>    Expected type: Conduit.Conduit String m0 a0<br>      Actual type: Conduit.Source IO ()<br>

    In the second argument of `($=)&#39;, namely `display&#39;<br>    In the first argument of `($$)&#39;, namely<br>      `Conduit.sourceList [1 .. 14] $= Conduit.map show $= display&#39;<br><br></div><div>I don&#39;t understand why the type of display is inferred to a Conduit.Source. Can somebody please explain? <br>

<br>What I want is to have readable names for certain segments in my pipe. Is that possible?<br></div><div><br></div><div>Thanks,<br>ovidiu<br></div><div><br></div></div>
<br>_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org">Beginners@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/beginners" target="_blank">http://www.haskell.org/mailman/listinfo/beginners</a><br>
<br></blockquote></div><br></div>