#3309: getArgs should return Unicode on Unix
-----------------------------+----------------------------------------------
Reporter: YitzGale | Owner:
Type: bug | Status: new
Priority: normal | Milestone: 6.14.1
Component: libraries/base | Version: 6.11
Resolution: | Keywords: unicode
Difficulty: Unknown | Os: Unknown/Multiple
Testcase: | Architecture: Unknown/Multiple
Failure: None/Unknown |
-----------------------------+----------------------------------------------
Changes (by slyfox):
* failure: => None/Unknown
Comment:
Replying to [ticket:3309 YitzGale]:
> The raw bytes of args should be decoded according to the current locale.
>
> An additional function should be added:
> {{{
> getArgsBytes :: IO [Word8]
> }}}
s/\[Word8\]/\[\[Word\]\]/ :]
> to provide access to the raw bytes.
>
> This change needs to be coordinated with #3007 so that it will still
> work to read a file name from the command line args and use it
> to access a file.
>
> This change should also be made on Windows: #3008
>
> See the discussion at http://www.haskell.org/pipermail/haskell-
cafe/2009-June/062795.html
Or, maybe, make '''getArgs'''/'''readFile''' and friends polymorphic like
'''Text.Printf printf''' does?
{{{
Text.Printf printf :: PrintfType r => String -> r
instance (IsChar c) => PrintfType [c] -- Defined in Text.Printf
instance PrintfType (IO a) -- Defined in Text.Printf
instance (PrintfArg a, PrintfType r) => PrintfType (a -> r)
}}}
In our case it would be something like
{{{
getArgs :: StringAlike s => IO [s]
and usage would look like:
foo = getArgs :: [[Word8]] -- raw bytes
foo = getArgs :: [ByteString] -- raw bytes in fast bytestring
foo = getArgs :: [String] -- locale encoded
-- maybe, anothers?
}}}
Thanks!
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3309#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs