{      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyzNone{|}~(c) Claude Heiland-Allen 2012BSD3claude@mathr.co.ukunstableportableNone &The type of mutable bit arrays in the  monad.!The type of immutable bit arrays.:Create a new array filled with unspecified initial values.Get the bounds of a bit array.*Snapshot the array into an immutable form.bSnapshot the array into an immutable form. Unsafe when the source array can be modified later.%Convert an array from immutable form.rConvert an array from immutable form. Unsafe to modify the result unless the source array is never used later.Copy an array.bounds  (c) Claude Heiland-Allen 2012BSD3claude@mathr.co.ukunstableportable Safe-Inferred .Lift a boolean constant to a bitwise constant. 6Lift a unary boolean operation to a bitwise operation.mThe implementation is by exhaustive input/output case analysis: thus the operation provided must be total. 7Lift a binary boolean operation to a bitwise operation.mThe implementation is by exhaustive input/output case analysis: thus the operation provided must be total. True when any bit is set. True when all bits are set.,True when the predicate is true for any bit.-True when the predicate is true for all bits.Determine if a  is all 1s, all 0s, or neither.-A mask with count least significant bits set.TSplit a word into (lsb, msb). Ensures lsb has no set bits above the split point.WJoin lsb with msb to make a word. Assumes lsb has no set bits above the join point.-Pack bits into a byte in little-endian order.*Pack bits into a byte in big-endian order.4Extract the bits from a byte in little-endian order.1Extract the bits from a byte in big-endian order.The least significant bit.(Convert a little-endian list of bits to . Convert a  (with a defined /) to a list of bits, in little-endian order.%Convert a big-endian list of bits to . Convert a  (with a defined ,) to a list of bits, in big-endian order.  operation  operation  predicate  predicate count  split point word  (lsb, msb)  join point least significant bits most significant bits word least significant bit most significant bit most significant bit least significant bit 3(least significant bit, ..., most significant bit) 3(most significant bit, ..., least significant bit) 3[least significant bit, ..., most significant bit] 3[least significant bit, ..., most significant bit] 3[most significant bit, ..., least significant bit] 3[most significant bit, ..., least significant bit]    (c) Claude Heiland-Allen 2012BSD3claude@mathr.co.ukunstableportableNone0Create a new array filled with an initial value.2Create a new array filled with values from a list.Read from an array at an index. @Read from an array at an index without bounds checking. Unsafe.!Write to an array at an index." Alias for ,.#+Create a new array by reading from another.$'Get a list of all elements of an array.%_Get a list of all elements of an array. Unsafe when the source array can be modified later.&)Get a list of all (index, element) pairs.'#Fill an array with a uniform value.(;Short-circuit bitwise reduction: True when any bit is True.)=Short-circuit bitwise reduction: False when any bit is False.*!Short-circuit bitwise reduction:  when any bits differ,  when all bits are the same.+aBitwise reduction with an associative commutative boolean operator. Implementation lifts from  to BitsQ and folds large chunks at a time. Each bit is used as a source exactly once.,(Bitwise map. Implementation lifts from  to Bits$ and maps large chunks at a time.-,Bitwise zipWith. Implementation lifts from  to Bits( and combines large chunks at a time.2The bounds of the source arrays must be identical.bounds initial value bounds elems  !"# new bounds index transformation  source array $%&'()*+ operator ,- !"#$%&'()*+,-!"#$&'()*+,- % !"#$%&'()*+,-(c) Claude Heiland-Allen 2012BSD3claude@mathr.co.ukunstableuses STNone.The type of mutable bit arrays./Get the bounds of a bit array.00Create a new array filled with an initial value.18Create a new array filled with a default initial value ().22Create a new array filled with values from a list.3Read from an array at an index.4@Read from an array at an index without bounds checking. Unsafe.5Write to an array at an index.6 Alias for E.7+Create a new array by reading from another.8'Get a list of all elements of an array.9oGet a list of all elements of an array without copying. Unsafe when the source array can be modified later.:)Get a list of all (index, element) pairs.;*Snapshot the array into an immutable form.<bSnapshot the array into an immutable form. Unsafe when the source array can be modified later.=%Convert an array from immutable form.>rConvert an array from immutable form. Unsafe to modify the result unless the source array is never used later.?Copy an array.@#Fill an array with a uniform value.A;Short-circuit bitwise reduction: True when any bit is True.B=Short-circuit bitwise reduction: False when any bit is False.C!Short-circuit bitwise reduction:  when any bits differ,  when all bits are the same.DaBitwise reduction with an associative commutative boolean operator. Implementation lifts from  to BitsQ and folds large chunks at a time. Each bit is used as a source exactly once.E(Bitwise map. Implementation lifts from  to Bits$ and maps large chunks at a time.F,Bitwise zipWith. Implementation lifts from  to Bits( and combines large chunks at a time.2The bounds of the source arrays must be identical../0bounds initial value 1bounds 2bounds elems 34567 new bounds index transformation  source array 89:;<=>?@ABCD operator EF./0123456789:;<=>?@ABCDEF./01235678:;=?@ABCDEF49<>./0123456789:;<=>?@ABCDEF(c) Claude Heiland-Allen 2012BSD3claude@mathr.co.ukunstableportableNoneGThe bounds of an array.H6Create an array from a list of (index, element) pairs.I(Create an array from a list of elements.JjCreate an array by accumulating a list of (index, operand) pairs from a default seed with an operation.KBit array indexing.L4Bit array indexing without bounds checking. Unsafe.M/A list of all the valid indices for this array.N%A list of the elements in this array.O3A list of the (index, element) pairs in this array.P8A new array with updated values at the supplied indices.Q<Accumulate with an operation and a list of (index, operand).R Alias for \.S;Create a new array by mapping indices into a source array..TA uniform array of bits.UA uniform array of .VA uniform array of .W-Bounds checking combined with array indexing.X9Short-circuit bitwise reduction: True if any bit is True.Y;Short-circuit bitwise reduction: False if any bit is False.Z<Short-circuit bitwise reduction: Nothing if any bits differ.[aBitwise reduction with an associative commutative boolean operator. Implementation lifts from  to BitsQ and folds large chunks at a time. Each bit is used as a source exactly once.\(Bitwise map. Implementation lifts from  to Bits$ and maps large chunks at a time.],Bitwise zipWith. Implementation lifts from  to Bits( and combines large chunks at a time.2The bounds of the source arrays must be identical.GHbounds assocs Ibounds elems J operation default bounds assocs KLMNOP new assocs Q operation source assocs RS new bounds index transformation  source array Tbounds Ubounds Vbounds WXYZ[\]GHIJKLMNOPQRSTUVWXYZ[\]GHIJKMNOPQRSTUVXYZ[\]WLGHIJKLMNOPQRSTUVWXYZ[\](c) Claude Heiland-Allen 2012BSD3claude@mathr.co.ukunstableportableNone^Copy to a ByteString. The most significant bits of the last byte are padded with 0 unless the array was a multiple of 8 bits in size._#Copy from a ByteString. Much like  listArray but with packed bits.`Copy to a ByteString. The most significant bits of the last byte are padded with 0 unless the array was a multiple of 8 bits in size.a#Copy from a ByteString. Much like  newListArray but with packed bits.^_bounds  packed elems `abounds  packed elems ^_`a^_`a^_`a(c) Claude Heiland-Allen 2012BSD3claude@mathr.co.ukunstableportableNonebBPossible reasons for decoding to fail, with the input that failed.c)There weren't enough bytes of pixel data.d2Parsing failed at the space before the pixel data.e4The height could not be parsed, or was non-positive.f3The width could not be parsed, or was non-positive.g1Second character was not 4 (binary) or 1 (plain).hFirst character was not P.i&Possible reasons for encoding to fail.j&image width is larger than array widthk+image width is too smaller than array widthl'array width is not a multiple of 8 bitsnA decoded PBM image. p. must be less or equal to the width of the qh array (which has its first index in Y and the second in X, with lowest coordinates at the top left).JFalse pixels are white, True pixels are black. Pixels to the right of pb are don't care padding bits. However, these padding bits are likely to invalidate aggregrate   operations. See y.rTEncode a binary PBM (P4) image, padding rows to multiples of 8 bits as necessary.sEncode a plain PBM (P1) image.^No restrictions on pixels array size, but the file format is exceedingly wasteful of space.tEncode a pre-padded n to a binary PBM (P4) image.The pixels array must have a multiple of 8 bits per row. The image width may be less than the pixel array width, with up to 7 padding bits at the end of each row.uDecode a binary PBM (P4) image.v,Decode a sequence of binary PBM (P4) images.5Keeps decoding until end of input (in which case the  of the result is ) or an error occurred.wDecode a plain PBM (P1) image.fNote that the pixel array size is kept as-is (with the width not necessarily a multiple of 8 bits).xAdd padding bits at the end of each row to make the array width a multiple of 8 bits, required for binary PBM (P4) encoding.y$Trim any padding bits, required for fold* operations to give meaningful results.Fails for invalid n+ with image width greater than array width.zTrim then pad. The resulting ng (if any) is suitable for encoding to binary PBM (P4), moreover its padding bits will be cleared.#Reverse the bit order of all bytes.qPBM specifies that the most significant bit is leftmost, which is opposite to the convention used by BitArray.>Fast reversal of the bit order of a byte using a lookup table.&A lookup table for bit order reversal. A slow way to reverse bit order.;White space characters as defined by the PBM specification.bcdefghijklmnopqrpixels spixels tuvwxyzbcdefghijklmnopqrstuvwxyznopqrsilkjmmmtbhgfedcuwvxyzbhgfedcilkjmmmnopqrstuvwxyz     !"#$%&'()*+,-./01 2 ' ()*+,-./01 3456789:;<=>?1@AB CDEFGHIJKLMNOPQRSSTUVWXYZ[\]^_`abcdbcebfghijklmnop_qr_qs_tu_tvhiwxyz{hi|}hi~_bitwise-0.1.0.2Data.Array.BitArray.IOData.Array.BitArrayData.Bits.BitwiseData.Array.BitArray.STData.Array.BitArray.ByteStringCodec.Image.PBMCompatData.Array.BitArray.InternalBitArrayfold IOBitArray newArray_ getBoundsfreeze unsafeFreezethaw unsafeThawcopyrepeatmapzipWithorandanyall isUniformmasksplitAtjoinAt packWord8LE packWord8BE unpackWord8LE unpackWord8BEfromBool fromListLEtoListLE fromListBEtoListBEnewArray newListArray readArrayunsafeReadArray writeArraymapArray mapIndicesgetElemsunsafeGetElems getAssocsfill STBitArrayboundsarray listArray accumArray!!!!indiceselemsassocs//accumamapixmapfalsetrue!? toByteStringfromByteStringtoByteStringIOfromByteStringIO DecodeError BadPixelsBadSpace BadHeightBadWidth BadMagicN BadMagicP EncodeError BadLargeWidth BadSmallWidth BadPixelWidth encErrPBMPBMpbmWidth pbmPixels encodePBMencodePlainPBM encodePBM' decodePBM decodePBMsdecodePlainPBMpadPBMtrimPBMrepadPBMbaseGHC.IO unsafeIOToSTbytestring-0.10.4.0Data.ByteStringpackCStringLenunconsData.ByteString.UnsafeunsafeUseAsCStringLenghc-prim GHC.TypesIOIOB iobBoundLo iobBoundHiiobBytesiobDataB Data.BitsBitsbitSize Data.MaybeNothingJustBool readArrayRawinterleavedMapMThenTouchmapTo zipWithToFalseSTBTrue Data.TuplesndreverseByteBits reverseBits bitReversed bitReversepbmSpace