Hello,

So I've been trying to print some information in a file. I have two versions of the same function: one of them doesn't work and I don't understand why.
Here are the functions:

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 

-- This one works as intended when called from ghci
renderTrackInfosToFile :: FilePath -> String -> IO [TrackInfos] -> IO ()
renderTrackInfosToFile filename sep ls = do nls <- ls
                                                                writeFile filename (intercalate "\n" $ map (renderTrackInfo sep) nls)
                                                                return ()

-- This one does nothing when called from ghci
renderTrackInfosToFile2 :: FilePath -> String -> [TrackInfos] -> IO ()
renderTrackInfosToFile2 filename sep ls = writeFile filename (intercalate "\n" $ map (renderTrackInfo sep) ls)


renderTrackInfo :: String -> TrackInfos -> String

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 

Both functions load in ghci, and the following commands are issued:

> -- c :: IO [TrackInfos]
> liftM (renderTrackInfosToFile2 "blabla.txt" "|")  c -- this command seems to do absolutely nothing
> renderTrackInfosToFile "blabla.txt" "|"  c -- this one works as intended

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 

And this is not the first time I have this sort of problem using liftM. I now that I'm missing something important here,
can anyone explain me my mistake?

Much thanks,

Guillaume Basse