Working through tutorials etc. in ghci - so far so good. I'm so completely missing something though : my function builds an IO [FilePath] "thing". In ghci it comes out like this:
["xml","velocity.log.1","velocity.log"] (list truncated for brevity)
I see that the function is doing what I want. Next step is I want to "print" that out myself.
Nothing I do lets me print the result. I don't want to perpetuate my Java/C#/Python habits in Haskell - no point in that. I believe there's a good reason for Haskell doing things differently, but I can't see how to get the (limited) value out of this function.
module Main (
main
) where
import RecursiveContents
main = do putStrLn "this"
getRecursiveContents "/home/xyz/myDir"
This works. But what if I want main to print the result of getRecursiveContents "/home/xyz/myDir" ?
In ghci I can just type/paste getRecursiveContents "/home/xyz/myDir" and the stuff spews out - what do I have to do to print it myself?
If I do :
let xyz = getRecursiveContents "/home/xyz/myDir" in ghci, the only thing I can do with xyz is type:
xyz <enter> and see the result.
I cannot do head, tail, etc. etc.. I know that IO [FilePath] is something special and not a the same as array or list [a] - but nothing I do is helping me to understand getting past this.
I must be missing something - something I can't find in Learn You a Haskell, or Real World Haskell. Am I not rtfm-ing in the right place?
Any feedback or dope-slaps appreciated.