Hi Erik,
Hi all,
I have a list of entries for a directory (FilePaths) and I'd like to
partition them into files and directories using Data.List.partition:
partition :: [a] -> ([a], [a])
Now, one solution is to use unsafePerformIO:
splitDirFile :: [FilePath] -> ([FilePath], [FilePath])
splitDirFile paths = do
partition (\p -> unsafePerformIO (doesDirectoryExist p)) paths
Two questions:
a) Is it possible to do this without invoking unsafePerformIO? Ie with
a function signature of say:
partition :: [FilePath] -> IO ([FilePath], [FilePath])
b) Exactly how unsafe is the unsafePerformIO version?
Erik
--
-----------------------------------------------------------------
Erik de Castro Lopo
-----------------------------------------------------------------
The main confusion about C++ is that its practitioners think
it is simultaneously a high and low level language when in
reality it is good at neither.
_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://www.haskell.org/mailman/listinfo/beginners