-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
Because of how GHC works, bytesmith always boxes the result of parse. This is normally fine. The result of a parse is typically some kind of boxed data that can live happily on the heap. However, in several different projects, I've ended up needed to define
decodeWord64 :: Bytes -> Maybe Word64
decodeWord64 = Parser.parseBytesMaybe (Latin.decWord64 ())
It's sad to have to allocate for the W# data constructor. I've been avoiding adding Char8/Ascii/Latin module to this library, but I think that Data.Bytes.Latin would be a good place for these:
decWord64 :: Bytes -> Maybe Word64
splitDecWord64 :: Bytes -> Maybe (Word64, Bytes)
The second variant allows extra bytes to be leftover. The first does not.
Metadata
Metadata
Assignees
Labels
No labels