[Haskell-cafe] printing a list of directories which don't exist

Henning Thielemann lemming at henning-thielemann.de
Wed May 14 11:54:20 EDT 2008


On Wed, 14 May 2008, Mike Jarmy wrote:

> Newbie question:  Given a list of type '[FilePath]', how do I create a list
> of all those directories which do not actually exist, and then print the
> list?  I've figured out how to extract the ones which *do* exist, like so:
>
> module Main where
>
> import Control.Monad (filterM)
> import System.Directory (doesDirectoryExist)
> import System.Environment (getArgs)
>
> main :: IO ()
> main = do
>    dirs <- getArgs
>    let existing = filterM doesDirectoryExist dirs

should be

>    existing <- filterM doesDirectoryExist dirs

I think.


More information about the Haskell-Cafe mailing list