[{"name":"Bit","comment":" A primitive: the single bit\n\n@docs Bit\n\n\n## create\n\n@docs random, fuzz\n\n\n## `N`\n\n@docs fromN, toN\n\n\n## alter\n\n@docs opposite\n\nI'll be happy to add or merge more stuff!\nJust open an issue or a PR\n\n","unions":[{"name":"Bit","comment":" One of 2 states:\n\n  - 1, on: `I`\n  - 0, off: `O`\n\nThis right here is really the core of this library.\nRepresenting bits safely is now quite readable!\n\n    ArraySized.l8 O I I I O O I O\n    --: ArraySized Bit (In (Up8 minX_) (Up8 maxX_))\n\nfor an example of using this to represent an `Id`,\nvisit the [readme](https://dark.elm.dmy.fr/packages/lue-bird/elm-bits/latest/)\n\n","args":[],"cases":[["I",[]],["O",[]]]}],"aliases":[],"values":[{"name":"fromN","comment":" `n0` → [`O`](#Bit), `n1` → [`I`](#Bit)\n","type":"N.N (N.In min_ (N.Up maxTo1_ N.To N.N1)) -> Bit.Bit"},{"name":"fuzz","comment":" Uniform `Fuzzer` for either [`I`](#Bit) or [`O`](#Bit)\n","type":"Fuzz.Fuzzer Bit.Bit"},{"name":"opposite","comment":" Switch `O` ↔ `I`. Often called the NOT operator\n","type":"Bit.Bit -> Bit.Bit"},{"name":"random","comment":" Uniform `Random.Generator` for either [`I`](#Bit) or [`O`](#Bit)\n","type":"Random.Generator Bit.Bit"},{"name":"toN","comment":" Convert `O` to `n0`, `I` to `1`.\n`N (In (Up0 minX_) (Up1 maxX_))` means that the result will be between 0 & 1\n\n    toInt =\n        Bit.toN >> N.toInt\n\n","type":"Bit.Bit -> N.N (N.In (N.Up0 minX_) (N.Up1 maxX_))"}],"binops":[]},{"name":"BitArray","comment":" [`ArraySized`](https://package.elm-lang.org/packages/lue-bird/elm-typesafe-array/latest/)\nof [`Bit`](Bit#Bit)s\n\nUse what's available in `ArraySized` to create and analyze bits!\n\nUse the helpers here in `Bits`\nwhen you know the exact number of bits, like in an id\n\n\n## `N`\n\n@docs fromN, toN\n\n\n## `Int` signed\n\n@docs fromIntSigned, toIntSigned\n\n\n## alter\n\n@docs toChunksOf\n\nYou can additionally use the operations of `ArraySized`, for example\n\n    -- left shift\n    ArraySized.attach Up (ArraySized.repeat O n)\n\n    -- left right\n    ArraySized.attach Down (ArraySized.repeat O n)\n\n    -- complement\n    ArraySized.map Bit.opposite\n\n    ...\n\n","unions":[],"aliases":[],"values":[{"name":"fromIntSigned","comment":" Encode with a given bit size `n` (`<= 32`)\nranging from `-(2 ^ (n - 1))` to `2 ^ (n - 1) - 1`.\nFor example, bit size 5 ranges from -16 to 15\n\n    import ArraySized\n    import Bit exposing (Bit(..))\n    import N exposing (n5, n6)\n\n    -6 |> BitArray.fromIntSigned n5 |> ArraySized.toList\n    --> [ I, I, O, I, O ]\n\n    10 |> BitArray.fromIntSigned n6 |> ArraySized.toList\n    --> [ O, O, I, O, I, O ]\n\n","type":"N.N (N.Exactly (N.On (N.Add1 bitSizeFrom1))) -> Basics.Int -> ArraySized.ArraySized Bit.Bit (N.Exactly (N.On (N.Add1 bitSizeFrom1)))"},{"name":"fromN","comment":" Convert the [natural number](https://dark.elm.dmy.fr/packages/lue-bird/elm-bounded-nat/latest/)\nto a given number of bits (`<= 32`).\n\n    import N exposing (n4, n14)\n    import Bit exposing (Bit(..))\n    import ArraySized\n\n    n14 |> BitArray.fromN n4 |> ArraySized.toList\n    --> [ I, I, I, O ]\n\nThe `N` is always clamped to `<= 2 ^ bitCount - 1`\n\n    import N exposing (n0)\n    import N.Local exposing (n32)\n\n    2 ^ 53 - 1\n        |> N.intToAtLeast n0\n        |> BitArray.fromN n32\n        |> BitArray.toN\n        |> N.toInt\n    --> 2 ^ 32 - 1\n\n","type":"N.N (N.In (N.Up minX N.To minPlusX) max) -> N.N range_ -> ArraySized.ArraySized Bit.Bit (N.In (N.Up minX N.To minPlusX) max)"},{"name":"toChunksOf","comment":" Pad the `ArraySized` of [`Bit`](Bit#Bit)s to chunks of a given length\n\n    import ArraySized\n    import Linear exposing (Direction(..))\n    import N exposing (n8)\n    import Bit exposing (Bit(..))\n\n    ArraySized.one O\n        |> BitArray.toChunksOf n8\n        |> ArraySized.map ArraySized.toList\n        |> ArraySized.toList\n    --> [ [ O, O, O, O, O, O, O, O ] ]\n\n    ArraySized.l3 I I I\n        |> ArraySized.attach Up (ArraySized.l8 O I I I O I O O)\n        |> ArraySized.attach Up (ArraySized.l8 O I I I O I O O)\n        |> ArraySized.attach Up (ArraySized.l8 O I I I O I O O)\n        |> BitArray.toChunksOf n8\n        |> ArraySized.map ArraySized.toList\n        |> ArraySized.toList\n    --> [ [ O, O, O, O, O, I, I, I ]\n    --> , [ O, I, I, I, O, I, O, O ]\n    --> , [ O, I, I, I, O, I, O, O ]\n    --> , [ O, I, I, I, O, I, O, O ]\n    --> ]\n\n[`O`](Bit#Bit)s at the beginning aren't removed from the original `ArraySized`\n\n","type":"N.N (N.In (N.On (N.Add1 chunkMinFrom1)) (N.Up chunkMaxX N.To (N.Add1 chunkMaxFrom1PlusX))) -> ArraySized.ArraySized Bit.Bit (N.In min_ (N.Up maxX N.To maxPlusX)) -> ArraySized.ArraySized (ArraySized.ArraySized Bit.Bit (N.In (N.On (N.Add1 chunkMinFrom1)) (N.Up chunkMaxX N.To (N.Add1 chunkMaxFrom1PlusX)))) (N.In (N.Up0 minX_) (N.Up maxX N.To maxPlusX))"},{"name":"toIntSigned","comment":" Create signed `Int` from a bit array's in 2's complement encoding\nusing its length (`<= 32`) as the `Int`'s bit count.\n\nSo given bit count `n`,\ndecodes in the range `-(2 ^ (n - 1))` → `2 ^ (n - 1) - 1`.\nFor example, bit size 5 ranges from -16 to 15\n\n    import ArraySized\n    import Bit exposing (Bit(..))\n    import N exposing (n5, n6)\n\n    ArraySized.l5 O I O I O |> BitArray.toIntSigned\n    --> 10\n\n    ArraySized.l8 I O I O I O I O |> BitArray.toIntSigned\n    --> -86\n\n    ArraySized.l11 O O O O O I O I O I O |> BitArray.toIntSigned\n    --> 42\n\n","type":"ArraySized.ArraySized Bit.Bit (N.In min_ max_) -> Basics.Int"},{"name":"toN","comment":" Convert <= 32 bits into a natural number: `N (Min (Up0 _))`\n\n    import N\n    import Bit exposing (Bit(..))\n    import ArraySized\n\n    ArraySized.l6 I O O I O I\n        |> BitArray.toN\n        |> N.toInt\n    --> 37\n\n","type":"ArraySized.ArraySized Bit.Bit (N.In min_ max_) -> N.N (N.Min (N.Up0 nX_))"}],"binops":[]}]