Hi
You can translate this step by step.
main = do dc - getDirectoryContents ./foo/
mapM_ putStrLn dc
Translating out the do notation
(http://www.haskell.org/haskellwiki/Keywords#do):
main = getDirectoryContents = \dc -
mapM_ putStrLn dc
Then we can chop out the dc argument,
Paul Keir [EMAIL PROTECTED] writes:
module Main where
import System.Directory (getDirectoryContents)
main = do dc - getDirectoryContents ./foo/
mapM_ putStrLn dc
mapM_ putStrLn (getDirectoryContents ./foo/)
Couldn't match expected type `[String]'
mapM_ putStrLn needs a
main = do dc - getDirectoryContents ./foo/
mapM_ putStrLn dc
Translating out the do notation
(http://www.haskell.org/haskellwiki/Keywords#do):
main = getDirectoryContents = \dc -
mapM_ putStrLn dc
Woops, I lost ./foo/ here, but it should be fairly easy to insert
through
; haskell-cafe@haskell.org
Subject: RE: [Haskell-cafe] One liner?
Hi
You can translate this step by step.
main = do dc - getDirectoryContents ./foo/
mapM_ putStrLn dc
Translating out the do notation
(http://www.haskell.org/haskellwiki/Keywords#do):
main = getDirectoryContents = \dc