
Just curious -- how can this be done in Arrows instead of Manad/T? Or can it?
On Dec 26, 2007 6:42 AM, Benja Fallenstein
On Dec 23, 2007 1:44 PM, Isaac Dupree
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 Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe