<div dir="ltr"><br><br><div class="gmail_quote">On Sun, May 15, 2011 at 2:56 PM, aditya siram <span dir="ltr">&lt;<a href="mailto:aditya.siram@gmail.com">aditya.siram@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;">

You can also try the applicative way:<br>(&lt;$&gt;) :: (a -&gt; b) -&gt; f a -&gt; f b<br><br>import Control.Applicative<br>-- Think of the &lt;$&gt; as a monadic version of $<br>main = putStrLn &lt;$&gt; readFile &quot;contents.txt&quot;<br>


<br></blockquote><div>Actually, &lt;$&gt; is just a synonym for fmap, so this will have the same problems as the fmap approach.</div><div><br></div><div>Michael</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

Or if you want to chain the functions and not worry about the &quot;contents.txt&quot; argument:<br><br>import Control.Monad<br>main= (readFile &gt;=&gt; putStrLn) &quot;contents.txt&quot;<br><br>-deech<br><br><div class="gmail_quote">

<div class="im">
On Sun, May 15, 2011 at 1:27 AM, Christopher Howard <span dir="ltr">&lt;<a href="mailto:christopher.howard@frigidcode.com" target="_blank">christopher.howard@frigidcode.com</a>&gt;</span> wrote:<br></div><div><div></div>

<div class="h5"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I understand that one can bind the unwrapped results of IO functions to<br>
variables, and pass them to functions, like so:<br>
<br>
main = do filecontents &lt;- readFile &quot;data.txt&quot;<br>
          putStrLn filecontents<br>
<br>
But does the syntax allow you to cut out the middle man, so to speak,<br>
and bind the results directly to the parameter? Like<br>
<br>
-- Tried this and it didn&#39;t work.<br>
main = do putStrLn (&lt;- readFile &quot;data.txt&quot;)<br>
<font color="#888888"><br>
--<br>
<a href="http://frigidcode.com" target="_blank">frigidcode.com</a><br>
<a href="http://theologia.indicium.us" target="_blank">theologia.indicium.us</a><br>
<br>
_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org" target="_blank">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>
</font></blockquote></div></div></div><br>
<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>