Thanks Ozgur and Felipe,

Could you also show how I could actually use it to parse a bytestring please?


import qualified Data.ByteString.Lazy as BS
import Control.Applicative ((<$>))
import Data.Word
import Data.Binary.Get

data MyAction = A1 Word8 | A2 Word16

a,b :: Get MyAction
a = A1 <$> getWord8
b = A2 <$> getWord16be

listOfActions :: [Get MyAction]
listOfActions = [a,b,a]

--sequence :: Monad m => [m a] -> m [a]
--runGet :: Get a -> ByteString -> a

bs = BS.pack [1,0,2]

How exactly can I get back a list of integers from bs?

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

Reply via email to