Skip to content

Alternative instance #3

@polachok

Description

@polachok

Well, it turns out isEmpty is not actually sufficient for my needs (but useful anyway).

  let f xs = isEmpty >>= \b ->
              if b
                 then return xs
                 else (getWord8 7) >>= \x -> f (x:xs)
  in
    not (L.null bs) ==> 
      fromIntegral (length (runGet (runBitGet $ f []) bs)) == (8 * L.length bs `div` 7)

oops, "demandInput: not enough bytes"

I'd be glad to hear suggestions on how to implement Alternative instance for BitGet.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions