Hello,<div><br></div><div>So I&#39;ve been trying to print some information in a file. I have two versions of the same function: one of them doesn&#39;t work and I don&#39;t understand why.</div><div>Here are the functions:</div>
<div><br></div><div># # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # </div><div><br></div><div>-- This one works as intended when called from ghci</div><div><div>renderTrackInfosToFile :: FilePath -&gt; String -&gt; IO [TrackInfos] -&gt; IO ()</div>
<div>renderTrackInfosToFile filename sep ls = do nls &lt;- ls</div><div>                                                                writeFile filename (intercalate &quot;\n&quot; $ map (renderTrackInfo sep) nls)</div>
<div>                                                                return ()</div></div><div><br></div><div>-- This one does nothing when called from ghci</div><div><div>renderTrackInfosToFile2 :: FilePath -&gt; String -&gt; [TrackInfos] -&gt; IO ()</div>
<div>renderTrackInfosToFile2 filename sep ls = writeFile filename (intercalate &quot;\n&quot; $ map (renderTrackInfo sep) ls)</div></div><div><br></div><div><br></div><div>renderTrackInfo :: String -&gt; TrackInfos -&gt; String</div>
<div><br></div><div># # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # </div><div><br></div><div>Both functions load in ghci, and the following commands are issued:</div><div><br></div><div>&gt; -- c :: IO [TrackInfos]</div>
<div>&gt; liftM (renderTrackInfosToFile2 &quot;blabla.txt&quot; &quot;|&quot;)  c -- this command seems to do absolutely nothing</div><div>&gt; renderTrackInfosToFile &quot;blabla.txt&quot; &quot;|&quot;  c -- this one works as intended</div>
<div><br></div><div># # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # </div><div><br></div><div>And this is not the first time I have this sort of problem using liftM. I now that I&#39;m missing something important here,</div>
<div>can anyone explain me my mistake?</div><div><br></div><div>Much thanks,</div><div><br></div><div>Guillaume Basse</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div>