Skip to content

Instantly share code, notes, and snippets.

@yuga
Created August 30, 2012 05:28
Show Gist options
  • Save yuga/3522778 to your computer and use it in GitHub Desktop.
Save yuga/3522778 to your computer and use it in GitHub Desktop.
Data.Binary.Strict.BitGet starts to read bit from the position having the greatest value of a byte.
$ ghci
GHCi, version 7.4.1: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Prelude> import Data.Binary.Strict.BitGet
Prelude Data.Binary.Strict.BitGet> import Data.ByteString
Prelude Data.Binary.Strict.BitGet Data.ByteString> let a = pack [0x80,0x00]
Loading package bytestring-0.9.2.1 ... linking ... done.
Prelude Data.Binary.Strict.BitGet Data.ByteString> let r = runBitGet a $ getBit
Loading package array-0.4.0.0 ... linking ... done.
Loading package deepseq-1.3.0.0 ... linking ... done.
Loading package containers-0.4.2.1 ... linking ... done.
Loading package transformers-0.3.0.0 ... linking ... done.
Loading package mtl-2.1.1 ... linking ... done.
Loading package binary-strict-0.4.8 ... linking ... done.
Prelude Data.Binary.Strict.BitGet Data.ByteString> r
Right True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment