[Haskell-Cafe] Parsing bytestream
Ozgur Akgun
ozgurakgun at gmail.com
Tue Nov 9 05:23:33 EST 2010
If we change the code a bit,
data MyAction = A1 Word8 | A2 Word16
a,b :: Get MyAction
>
> a = A1 <$> getWord8
> b = A2 <$> getWord16be
listOfActions :: [Get MyAction]
listOfActions = [a,b,a]
Now, we know how to execute the list of actions, and get the output as list.
Using the following guys:
sequence :: Monad m => [m a] -> m [a]
runGet :: Get a -> ByteString -> a
Best,
Ozgur
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20101109/28330850/attachment.html
More information about the Haskell-Cafe
mailing list