
8 Feb
2006
8 Feb
'06
4:21 p.m.
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