[Haskell] System.FilePath survey
Ben Rudiak-Gould
Benjamin.Rudiak-Gould at cl.cam.ac.uk
Wed Feb 8 16:21:09 EST 2006
Einar Karttunen wrote:
> Just define:
>
> getArgsAdt :: IO [ADT]
> getArgsAdt = ...
>
> getArgs :: IO [String]
> getArgs = fmap ADT.toString getArgsAdt
My only problem with this is that I'm afraid people will then write code like
main = do
[x] <- getArgs
y <- readFile x -- assuming readFile :: Path a => a -> IO String
...
which will fail on filenames whose encoding doesn't match the locale. A
naively-written C program will have no trouble with such files, and I think
a naively-written Haskell program should be at least as robust. I'm not sure
a pathname ADT is the best approach here (maybe the '\0' hack would be
better) but if an ADT is used I'd like the right thing to be easier than the
wrong thing.
-- Ben
More information about the Libraries
mailing list