
On Thursday 15 March 2007 19:43, Neil Mitchell wrote:
What would the warning say?
"Haskell currently does not work when reading files or accessing command line arguments on Unix. Until such time as this is fixed please avoid opening files, or allowing the user to pass command line flags. The workaround is to either use Windows or Perl." :-)
At least this would be a starting point... ;-)
Do you have a concrete proposal for what FilePath's should look like in Haskell'? "FilePath = String" is currently the least broken design, since no one has put forward a better one.
Of course I can't come up with an elaborate proposal in 5 minutes, but I think the main points should be: * FilePath is abstract, perhaps even constructed from FilePathElements (there are pros and cons for introducing the latter, I'm not totally sure about all implications). * Explicit operations for constructing and accessing a FilePath are provided. * Operations like the ones in your proposal are provided. Before one can make a concrete proposal, a proposal for a general encoding framework is needed and should be standardized, because we need a "fit" here. Another option would be handling things exactly the other way round: FilePath could be a synonym for ByteString, so things could look like the following (assuming functions from our imaginary encoding framework) : ... entries1 <- getDirectoryContents (encode utf8 "blah") mapM_ (putStrLn . decode utf8) entries1 entries2 <- getDirectoryContents myByteString ... But in general, I have a bad feeling about type synonyms for such cases... Cheers, S.