On Dec 23, 2007 1:44 PM, Isaac Dupree <[EMAIL PROTECTED]> wrote:
> parseHeader3 :: BS.ByteString -> Maybe (Int, Int)
> parseHeader3 bs = do
>    (x, rest) <- BS.readInt $ BS.dropWhile (not . isDigit) bs
>    (y, _) <- BS.readInt $ BS.dropWhile (not . isDigit) rest
>    return (x, y)

But that version still itches! :-)

This is what it sounds like to me:

parseHeader :: BS.ByteString -> Maybe (Int,Int)
parseHeader = evalStateT $ liftM2 (,) parseInt parseInt where
    parseInt = StateT $ BS.readInt . BS.dropWhile (not . isDigit)

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

Reply via email to