[Haskell-beginners] Doing IO in terms of Arrow
freizl at gmail.com
Mon Jun 27 09:53:34 CEST 2011
I'm wondering if it is possible doing IO in terms of Arrow.
I got a function search all files under directory recursively and I'd like
to refartoring using Arrow terms.
I tried to define a function like below but failed.
isDirExist = Kleisli doesDirectoryExist
Do I need to define a instance for IO to be Arrow? Or is there any
I'm a newbie of Haskell and thanks your help.
getFilesInDir :: FilePath -> IO [FilePath]
getFilesInDir inp = do
isDir <- doesDirectoryExist inp
files <- if isDir then
names <- getDirectoryContents inp
forM [ inp </> x | x <- names, isNotSpecialDir x ]
else return [[inp]]
return $ concat files
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Beginners