[Haskell-Cafe] Parsing bytestream

C K Kashyap ckkashyap at gmail.com
Tue Nov 9 10:07:07 EST 2010


Oops .. I made a mistake .. I had gone with Felipe's solution -
>>
>> getActions :: [MyAction Get] -> Get [MyAction Id]
>> getActions = mapM getAction
>
> --
> Felipe.
>

Felpe, could you please confirm if

> bs = BS.pack [1,0,2,4]
>
> toVal (A1 (Id v)) = fromIntegral v :: Int
> toVal (A2 (Id v)) = fromIntegral v :: Int

> abc = map toVal $ runGet (getActions listOfActions) bs

is the right way of getting the values out?

-- 
Regards,
Kashyap


More information about the Haskell-Cafe mailing list