-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Efficient little-endian bit vector library
--   
--   This package contains a time- and space- efficient implementation of
--   <i>little-endian</i> bit vectors. Provides implementations of
--   applicable typeclasses and numeric conversions.
--   
--   The declared cost of each operation is either worst-case or amortized.
--   
--   For an implementation of <i>big-endian</i> bit vectors, use the
--   <a>bv</a> package.
@package bv-little
@version 0.1.2


-- | A bit vector similar to <tt>Data.BitVector</tt> from the <a>bv</a>,
--   however the endianness is reversed. This module defines
--   <i>little-endian</i> pseudo–size-polymorphic bit vectors.
--   
--   Little-endian bit vectors are isomorphic to a <tt>[Bool]</tt> with the
--   <i>least</i> significant bit at the head of the list and the
--   <i>most</i> significant bit at the end of the list. Consequently, the
--   endianness of a bit vector affects the semantics of the following
--   typeclasses:
--   
--   <ul>
--   <li><a>Bits</a></li>
--   <li><a>FiniteBits</a></li>
--   <li><a>Semigroup</a></li>
--   <li><a>Monoid</a></li>
--   <li><a>MonoFoldable</a></li>
--   <li><a>MonoTraversable</a></li>
--   </ul>
--   
--   For an implementation of bit vectors which are isomorphic to a
--   <tt>[Bool]</tt> with the <i>most</i> significant bit at the head of
--   the list and the <i>least</i> significant bit at the end of the list,
--   use the <a>bv</a> package.
--   
--   This module does <i>not</i> define numeric instances for
--   <a>BitVector</a>. This is intentional! To interact with a bit vector
--   as an <a>Integral</a> value, convert the <a>BitVector</a> using either
--   <a>toSignedNumber</a> or <a>toUnsignedNumber</a>.
module Data.BitVector.LittleEndian

-- | A little-endian bit vector of non-negative dimension.
data BitVector

-- | Create a bit vector from a <i>little-endian</i> list of bits.
--   
--   The following will hold:
--   
--   <pre>
--   length . takeWhile not === countLeadingZeros . fromBits
--   length . takeWhile not . reverse === countTrailingZeros . fromBits
--   </pre>
--   
--   <i>Time:</i> &lt;math&gt;
--   
--   <i>Since: 0.1.0.0</i>
--   
--   <h4><b>Examples</b></h4>
--   
--   <pre>
--   &gt;&gt;&gt; fromBits [True, False, False]
--   [3]1
--   </pre>
fromBits :: Foldable f => f Bool -> BitVector

-- | Create a <i>little-endian</i> list of bits from a bit vector.
--   
--   The following will hold:
--   
--   <pre>
--   length . takeWhile not . toBits === countLeadingZeros
--   length . takeWhile not . reverse . toBits === countTrailingZeros
--   </pre>
--   
--   <i>Time:</i> &lt;math&gt;
--   
--   <i>Since: 0.1.0.0</i>
--   
--   <h4><b>Examples</b></h4>
--   
--   <pre>
--   &gt;&gt;&gt; toBits [4]11
--   [True, True, False, True]
--   </pre>
toBits :: BitVector -> [Bool]

-- | Create a bit vector of non-negative dimension from an integral value.
--   
--   The integral value will be treated as an <i>signed</i> number and the
--   resulting bit vector will contain the two's complement bit
--   representation of the number.
--   
--   The integral value will be interpreted as <i>little-endian</i> so that
--   the least significant bit of the integral value will be the value of
--   the 0th index of the resulting bit vector and the most significant bit
--   of the integral value will be at index <tt>dimension − 1</tt>.
--   
--   Note that if the bit representation of the integral value exceeds the
--   supplied dimension, then the most significant bits will be truncated
--   in the resulting bit vector.
--   
--   <i>Time:</i> &lt;math&gt;
--   
--   <i>Since: 0.1.0.0</i>
--   
--   <h4><b>Examples</b></h4>
--   
--   <pre>
--   &gt;&gt;&gt; fromNumber 8 96
--   [8]96
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; fromNumber 8 -96
--   [8]160
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; fromNumber 6 96
--   [6]32
--   </pre>
fromNumber :: Integral v => Word -> v -> BitVector

-- | Two's complement value of a bit vector.
--   
--   <i>Time:</i> &lt;math&gt;
--   
--   <i>Since: 0.1.0.0</i>
--   
--   <h4><b>Examples</b></h4>
--   
--   <pre>
--   &gt;&gt;&gt; toSignedNumber [4]0
--   0
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; toSignedNumber [4]3
--   3
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; toSignedNumber [4]7
--   7
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; toSignedNumber [4]8
--   -8
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; toSignedNumber [4]12
--   -4
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; toSignedNumber [4]15
--   -1
--   </pre>
toSignedNumber :: Num a => BitVector -> a

-- | Unsigned value of a bit vector.
--   
--   <i>Time:</i> &lt;math&gt;
--   
--   <i>Since: 0.1.0.0</i>
--   
--   <h4><b>Examples</b></h4>
--   
--   <pre>
--   &gt;&gt;&gt; toSignedNumber [4]0
--   0
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; toSignedNumber [4]3
--   3
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; toSignedNumber [4]7
--   7
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; toSignedNumber [4]8
--   8
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; toSignedNumber [4]12
--   12
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; toSignedNumber [4]15
--   15
--   </pre>
toUnsignedNumber :: Num a => BitVector -> a

-- | Get the dimension of a <a>BitVector</a>. Preferable to
--   <a>finiteBitSize</a> as it returns a type which cannot represent a
--   non-negative value and a <a>BitVector</a> must have a non-negative
--   dimension.
--   
--   <i>Time:</i> &lt;math&gt;
--   
--   <i>Since: 0.1.0.0</i>
--   
--   <h4><b>Examples</b></h4>
--   
--   <pre>
--   &gt;&gt;&gt; dimension [2]3
--   2
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; dimension [4]12
--   4
--   </pre>
dimension :: BitVector -> Word

-- | Determine if <i>any</i> bits are set in the <a>BitVector</a>. Faster
--   than <tt>(0 ==) . popCount</tt>.
--   
--   <i>Time:</i> &lt;math&gt;
--   
--   <i>Since: 0.1.0.0</i>
--   
--   <h4><b>Examples</b></h4>
--   
--   <pre>
--   &gt;&gt;&gt; isZeroVector [2]3
--   False
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; isZeroVector [4]0
--   True
--   </pre>
isZeroVector :: BitVector -> Bool

-- | Get the <i>inclusive</i> range of bits in <a>BitVector</a> as a new
--   <a>BitVector</a>.
--   
--   If either of the bounds of the subrange exceed the bit vector's
--   dimension, the resulting subrange will append an infinite number of
--   zeroes to the end of the bit vector in order to satisfy the subrange
--   request.
--   
--   <i>Time:</i> &lt;math&gt;
--   
--   <i>Since: 0.1.0.0</i>
--   
--   <h4><b>Examples</b></h4>
--   
--   <pre>
--   &gt;&gt;&gt; subRange (0,2) [4]7
--   [3]7
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; subRange (1, 3) [4]7
--   [3]3
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; subRange (2, 4) [4]7
--   [3]1
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; subRange (3, 5) [4]7
--   [3]0
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; subRange (10, 20) [4]7
--   [10]0
--   </pre>
subRange :: (Word, Word) -> BitVector -> BitVector
instance GHC.Generics.Generic Data.BitVector.LittleEndian.BitVector
instance Data.Data.Data Data.BitVector.LittleEndian.BitVector
instance Test.QuickCheck.Arbitrary.Arbitrary Data.BitVector.LittleEndian.BitVector
instance Data.Bits.Bits Data.BitVector.LittleEndian.BitVector
instance Test.QuickCheck.Arbitrary.CoArbitrary Data.BitVector.LittleEndian.BitVector
instance GHC.Classes.Eq Data.BitVector.LittleEndian.BitVector
instance Data.Bits.FiniteBits Data.BitVector.LittleEndian.BitVector
instance Data.Hashable.Class.Hashable Data.BitVector.LittleEndian.BitVector
instance GHC.Base.Monoid Data.BitVector.LittleEndian.BitVector
instance Data.MonoTraversable.MonoFoldable Data.BitVector.LittleEndian.BitVector
instance Data.MonoTraversable.MonoFunctor Data.BitVector.LittleEndian.BitVector
instance Data.MonoTraversable.MonoTraversable Data.BitVector.LittleEndian.BitVector
instance Control.DeepSeq.NFData Data.BitVector.LittleEndian.BitVector
instance GHC.Classes.Ord Data.BitVector.LittleEndian.BitVector
instance GHC.Base.Semigroup Data.BitVector.LittleEndian.BitVector
instance GHC.Show.Show Data.BitVector.LittleEndian.BitVector
