@@ -9,7 +9,8 @@
9-- Parsers for binary encoded basic Haskell data types.
9-- Parsers for binary encoded basic Haskell data types.
11module Streamly.Internal.Serialize.FromBytes
11module Streamly.Internal.Serialize.FromBytes
14 , ordering
15 , ordering
15 , eqWord8 -- XXX rename to word8Eq
16 , eqWord8 -- XXX rename to word8Eq
@@ -278,3 +279,11 @@ word64le = PRD.toParserK word64leD
278word64host :: MonadIO m => Parser Word8 m Word64
279word64host :: MonadIO m => Parser Word8 m Word64
279word64host =
280word64host =
280 fmap (A.unsafeIndex 0 . A.castUnsafe) $ PR.takeEQ 8 (A.writeN 8)
281 fmap (A.unsafeIndex 0 . A.castUnsafe) $ PR.takeEQ 8 (A.writeN 8)
283+-------------------------------------------------------------------------------
285+-------------------------------------------------------------------------------
287+class FromBytes a where
288+ -- | Decode a byte stream to a Haskell type.
289+ fromBytes :: Parser Word8 m a