I am trying to print the elements of my list onto new lines, but i cant get it to work;
printElements :: [String] -> IO()
printElements (x:xs) = print x
Your function is:
printElements :: [String] -> IO()
printElements [] = return ()
printElements (x:xs) = do putStrLn x
printElements xs
If you already know about monads, you can use mapM_ function:
printElements :: [String] -> IO()
printElements = mapM_ putStrLn
Note: maybe you would have to read the chapter 8 of lyah.