~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~(c) Claude Heiland-Allen 2012BSD3claude@mathr.co.ukunstableportableSafe &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.ukunstableportableSafe.O .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 . to a list of bits, in little-endian order.%Convert a big-endian list of bits to . Convert a + 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) 0least significant bit, ..., most significant bit 0least significant bit, ..., most significant bit 0most significant bit, ..., least significant bit 0most significant bit, ..., least significant bit   "(c) Claude Heiland-Allen 2012,2018BSD3claude@mathr.co.ukunstableportableNoneF0Create 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.+$Look up index of first matching bit.BNote that the index type is limited to Int because there is no unindex method in the  class.,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./Count set bits.bounds initial value bounds elems # new bounds index transformation  source array , operator  !"#$%&'()*+,-./!"#$&'()*+,-./ %"(c) Claude Heiland-Allen 2012,2018BSD3claude@mathr.co.ukunstableuses STNonef0The type of mutable bit arrays.1Get the bounds of a bit array.20Create a new array filled with an initial value.38Create a new array filled with a default initial value ().42Create a new array filled with values from a list.5Read from an array at an index.6@Read from an array at an index without bounds checking. Unsafe.7Write to an array at an index.8 Alias for H.9+Create a new array by reading from another.:'Get a list of all elements of an array.;oGet 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.ACopy an array.B#Fill an array with a uniform value.C;Short-circuit bitwise reduction: True when any bit is True.D=Short-circuit bitwise reduction: False when any bit is False.E!Short-circuit bitwise reduction:  when any bits differ,  when all bits are the same.F$Look up index of first matching bit.BNote that the index type is limited to Int because there is no unindex method in the  class.GaBitwise 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.H(Bitwise map. Implementation lifts from  to Bits$ and maps large chunks at a time.I,Bitwise zipWith. Implementation lifts from  to Bits( and combines large chunks at a time.2The bounds of the source arrays must be identical.JCount set bits.2bounds initial value 3bounds 4bounds elems 9 new bounds index transformation  source array G operator 0123456789:;<=>?@ABCDEFGHIJ012345789:<=?ABCDEFGHIJ6;>@0(c) Claude Heiland-Allen 2012BSD3claude@mathr.co.ukunstableportableNone3KThe bounds of an array.L6Create an array from a list of (index, element) pairs.M(Create an array from a list of elements.NjCreate an array by accumulating a list of (index, operand) pairs from a default seed with an operation.OBit array indexing.P4Bit array indexing without bounds checking. Unsafe.Q/A list of all the valid indices for this array.R%A list of the elements in this array.S3A list of the (index, element) pairs in this array.T8A new array with updated values at the supplied indices.U<Accumulate with an operation and a list of (index, operand).V Alias for a.W;Create a new array by mapping indices into a source array..XA uniform array of bits.YA uniform array of .ZA uniform array of .[-Bounds checking combined with array indexing.\9Short-circuit bitwise reduction: True if any bit is True.];Short-circuit bitwise reduction: False if any bit is False.^<Short-circuit bitwise reduction: Nothing if any bits differ._$Look up index of first matching bit.BNote that the index type is limited to Int because there is no unindex method in the  class.`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.a(Bitwise map. Implementation lifts from  to Bits$ and maps large chunks at a time.b,Bitwise zipWith. Implementation lifts from  to Bits( and combines large chunks at a time.2The bounds of the source arrays must be identical.cCount set bits. Lbounds assocs Mbounds elems N operation default bounds assocs T new assocs U operation source assocs W new bounds index transformation  source array Xbounds Ybounds Zbounds KLMNOPQRSTUVWXYZ[\]^_`abcKLMNOQRSTUVWXYZ\]^_`abc[P"(c) Claude Heiland-Allen 2012,2018BSD3claude@mathr.co.ukunstableportableNonedCopy 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.e#Copy from a ByteString. Much like  listArray but with packed bits.fCopy 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.g#Copy from a ByteString. Much like  newListArray but with packed bits.ebounds  packed elems gbounds  packed elems defgdefg"(c) Claude Heiland-Allen 2012,2018BSD3claude@mathr.co.ukunstableportableNone]hBPossible reasons for decoding to fail, with the input that failed.iFirst character was not P.j1Second character was not 4 (binary) or 1 (plain).k3The width could not be parsed, or was non-positive.l4The height could not be parsed, or was non-positive.m2Parsing failed at the space before the pixel data.n)There weren't enough bytes of pixel data.o&Possible reasons for encoding to fail.p'array width is not a multiple of 8 bitsq+image width is too smaller than array widthr&image width is larger than array widthtA decoded PBM image. v. must be less or equal to the width of the wh 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 vb are don't care padding bits. However, these padding bits are likely to invalidate aggregrate   operations. See .xTEncode a binary PBM (P4) image, padding rows to multiples of 8 bits as necessary.yEncode a plain PBM (P1) image.^No restrictions on pixels array size, but the file format is exceedingly wasteful of space.zEncode a pre-padded t 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.{Decode a binary PBM (P4) image.|,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.}Decode 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).~Add padding bits at the end of each row to make the array width a multiple of 8 bits, required for binary PBM (P4) encoding.$Trim any padding bits, required for fold* operations to give meaningful results.Fails for invalid t+ with image width greater than array width.Trim then pad. The resulting tg (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.xpixels ypixels hijklmnopqrstuvwxyz{|}~tuvwxyopqrssszhijklmn{}|~hijklmnopqrssstuvw     !"#$%&'()*+,-./01 23 & '()*+,-./ 01 2456789:;<=>?@0ABC1 2DEFGHIJKLMNOPQRSTTUVWXYZ[\]^_`abcdefghijklmnomnpmqrmqsmtudevdewxdeymz{|}~&bitwise-1.0.0.1-FKwYCW8cInL9tfSdfV8cioData.Array.BitArray.IOData.Array.BitArrayData.Bits.BitwiseData.Array.BitArray.STData.Array.BitArray.ByteStringCodec.Image.PBMData.Array.BitArray.InternalBitArrayfold IOBitArray newArray_ getBoundsfreeze unsafeFreezethaw unsafeThawcopyrepeatmapzipWithorandanyall isUniformmasksplitAtjoinAt packWord8LE packWord8BE unpackWord8LE unpackWord8BEfromBool fromListLEtoListLE fromListBEtoListBEnewArray newListArray readArrayunsafeReadArray writeArraymapArray mapIndicesgetElemsunsafeGetElems getAssocsfill elemIndexpopCount STBitArrayboundsarray listArray accumArray!!!!indiceselemsassocs//accumamapixmapfalsetrue!? toByteStringfromByteStringtoByteStringIOfromByteStringIO DecodeError BadMagicP BadMagicNBadWidth BadHeightBadSpace BadPixels EncodeError BadPixelWidth BadSmallWidth BadLargeWidth encErrPBMPBMpbmWidth pbmPixels encodePBMencodePlainPBM encodePBM' decodePBM decodePBMsdecodePlainPBMpadPBMtrimPBMrepadPBM$fEqDecodeError$fOrdDecodeError$fReadDecodeError$fShowDecodeErrorghc-prim GHC.TypesIOIOBiobData iobBoundLo iobBoundHiiobBytesBbase Data.BitsBits FiniteBitsGHC.BaseNothingJustGHC.ArrIxBoolFalseSTBTrue Data.TuplesndreverseByteBits reverseBits bitReversed bitReversepbmSpace