
On Dec 24, 2007 11:55 AM, Paulo J. Matos
On Dec 23, 2007 12:44 PM, Isaac Dupree
wrote: -- this should work too parseHeader3 :: BS.ByteString -> Maybe (Int, Int) --note accurate type signature, which helps us use Maybe failure-monad, --although losing your separate error messages
Oh gee, I just noticed that my type sig is in fact not correct. How come GHC doesn't complain?
parseHeader3 bs = do (x, rest) <- BS.readInt $ BS.dropWhile (not . isDigit) bs (y, _) <- BS.readInt $ BS.dropWhile (not . isDigit) rest return (x, y)
What happens then if the first BS.readInt return Nothing???
Ok, got it, I'm not returning a maybe. That's it then. Still, the first question remains... what happens to (x, rest) if BS.readInt returns Nothing. -- Paulo Jorge Matos - pocm at soton.ac.uk http://www.personal.soton.ac.uk/pocm PhD Student @ ECS University of Southampton, UK