
Hi, I"m having trouble getting the System.Directory module in ghci on a Windows XP machine. Whenever I call a function like getCurrentDirectory or getDirectoryContents I get no results back. I was wondering if anyone knows why this is happening, or if someone can point me to a module that works on Windows. Here's an example of what I get: ___ ___ _ / _ \ /\ /\/ __(_) / /_\// /_/ / / | | GHC Interactive, version 6.4.2, for Haskell 98. / /_\\/ __ / /___| | http://www.haskell.org/ghc/ \____/\/ /_/\____/|_| Type :? for help. Loading package base-1.0 ... linking ... done. Prelude> :module System.Directory Prelude System.Directory> getCurrentDirectory Prelude System.Directory> getDirectoryContents "." Prelude System.Directory> getDirectoryContents "c:\\perl" Prelude System.Directory>

Could you try a recent version of GHC and let us know if you still have trouble? -- Jason Dusek

Am Donnerstag 05 November 2009 01:14:59 schrieb Patrick Larrivee-Woods:
With 6.10.4 it works fine. Thanks for your help, I hadn't even realized I was using an older version.
Cheers, Patrick
Just to explain: getDirectoryContents "." is an IO action producing a String. In newer GHC releases (I don't remember whther that change came with 6.6 or 6.8), when you invoke an IO action from the ghci-prompt, if the value returned from the action has not type (), by default it is bound to the variable 'it' and printed out (since it's not unconditionally a good thing to do that - consider readFile "HUGEFile.txt" - it can be disabled via ghci> :set -fno-print-bind-result - re-enable with -fprint-bind-result). Before, the action was simply run and its result not printed out, to use the result of an IO action, you had to use ghci> res <- getDirectoryContents "." ghci> print res or ghci> getDirectoryContents "." >>= mapM_ putStrLn or whatever. If you still have 6.4.2 installed, you can try it out (but do your real work with the newer, it produces better code).
Jason Dusek wrote:
Could you try a recent version of GHC and let us know if you still have trouble?
-- Jason Dusek
participants (3)
-
Daniel Fischer
-
Jason Dusek
-
Patrick Larrivee-Woods