On 17 December 2010 13:59, Jacek Generowicz <jacek.generowicz@cern.ch> wrote:
What are some interesting, idiomatic ways of writing something similar to the following
 
λ> :m + Safe
λ> let getValidatedInteger = getLine >>= maybe (do putStrLn "That doesn't seem to be an integer. Try again."; getValidatedInteger) return . readMay :: IO Integer
Loading package safe-0.3 ... linking ... done.
λ> getValidatedInteger
a
That doesn't seem to be an integer. Try again.
1
1
λ>