integer - Haskell ByteString readInt return type issue -


i trying understand how handle return type of `maybe (int, bytestring)' function data.bytestring.char8.readint, have removed maybe type checking not understand how further deal type have of '(int, bytestring)'. feel missing obvious , hoping 1 point me in right direction. appreciated!

readint designed writing loops pattern matching very efficient. e.g. sum file of numbers in ascii format:

import qualified data.bytestring.lazy.char8 s  main = print . go 0 =<< s.getcontents       go !n !s = case s.readint s of -- lazily reads current line                     nothing     -> n                     (k,t)  -> go (n+k) (s.tail t) 

Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -