On Sat, 21 Jun 2008, Xiao-Yong Jin wrote:

Hi,

I'm wondering how usually you parse command line arguments
list safely.  If the given argument is wrong, the program
can still print out some error information instead of giving
something like

Prelude.read: no parse

It's generally not a good idea to call 'read' on user data. 'read' expects well-formed input. Calling 'read' with other input is a programming _error_. If the user enters garbage, this is an _exception_ and this must be handled with 'reads' or 'maybeRead' as others suggested.
 http://www.haskell.org/haskellwiki/Error
 http://www.haskell.org/haskellwiki/Exception

_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to