Utilities for Shake types #
This file provides basic API for Needs, NeedsKind, and Bitset.
Counts the number of set bits in the binary representation of n.
Instances For
The number of set bits in a Bitset.
Instances For
Whether the Bitset contains any elements.
Instances For
The minimum size of the ambient index set necessary to hold Bitset.
Instances For
The full set {0, ..., n - 1}.
Instances For
The set s without the element i.
Instances For
The highest set bit of a Bitset, if there is one.
Instances For
The lowest set bit of a Bitset, if there is one.
Instances For
Fold over the set bit indices in a Bitset from high to low. This is more efficient for large
bitsets than Bitset.foldl.
Instances For
Fold over the set bit indices in a Bitset from low to high. This is less efficient for large
bitsets than Bitset.foldr.
Instances For
Array #
The set bit indices of a Bitset in order from low to high.
Instances For
The set bit indices of a Bitset in order from high to low.
Instances For
ForIn #
Instances For
A Bitset with a ForIn instance that traverses the bitset's indices from the highest index
to the lowest. This is the most efficient traversal of a bitset for large bitsets.
Instances For
A Bitset with a ForIn instance that traverses the bitset's indices from the highest index
to the lowest. Bitset.HighToLow (Bitset.highToLow) is more efficient for large Bitsets.
- toBitset : Bitset
Instances For
Instances For
A Bitset with a ForIn instance that traverses the bitset's indices from the highest index
to the lowest. Bitset.HighToLow (Bitset.highToLow) is more efficient for large Bitsets.
Instances For
Representations #
Converts a Bitset to a string of the form "◻◼◻◻◻◼◻◼◼◻◻◼", where indices run left-to-right
from 0 and ◻ represents absence at that index, while ◼ represents presence.
By default, this shows only as many squares as necessary (or "◻" for an empty bitset), and so in
the nonempty case the last square will always be ◼. Instead, univSize? : Option Nat can be
provided to set the total number of indices, and will either truncate (even if higher bits are set)
or pad with ◻ as appropriate.
Instances For
Iterates through NeedsKinds.all, and for each NeedsKind, iterates through the set bit
indices of the corresponding Bitset from highest to lowest.
Instances For
A Needs with a ForIn instance that traverses the component bitset's indices from the
highest index to the lowest. This is the most efficient traversal of a bitset. Does not actually
reverse the indices in the bitsets.
Instances For
Iterates through NeedsKinds.all, and for each NeedsKind, iterates through the set bit
indices of the corresponding Bitset from lowest to highest.
Instances For
Operations #
Includes i in the field of Needs corresponding to k.
Instances For
Applies f "pointwise" to the pairs of bitsets at each given NeedsKind.
f k (n₁.get k) (n₂.get k) = (n₁.mapWithKind₂ n₂ f).get k for all k : NeedsKind.
Instances For
Whether all component bitsets are empty.
Instances For
Whether the component bitset at k : NeedsKind is empty.
Instances For
The minimum size of the ambient index set necessary to hold every component Bitset.
Instances For
Whether each field of the first Needs is contained within the corresponding field of the
second. Use with caution: this does not necessarily indicate that one Needs subsumes another. See
also Needs.coveredBy for testing against an import hierarchy.
Instances For
Representations #
A braille cell depicting the set of NeedsKinds of n at index i. The left column holds
non-meta needs, and the right column meta needs; the top row holds public needs, the middle row
private, and the bottom row private-of-private.
Instances For
A braille cell in brackets depicting the set of NeedsKinds of n at index i. The left
column holds non-meta needs, and the right column meta needs; the top row holds public needs, the
middle row private, and the bottom row private-of-private.
For the braille cell character without brackets, see Needs.brailleCellAt.
Instances For
Represents a Needs as a string of the form e.g. │⠇│⠑│⠁│⠝│, where each braille cell
represents the set of NeedsKinds expressed by a single "column" of the Needs (i.e. at a given
index). The left column of each Braille cell are non-meta needs, and the right column holds meta
needs; the top row holds public needs, the middle private, and the bottom private-of-private.
By default, shows dividers (│) between each braille cell; dividers := false omits dividers.
By default this shows only as many cells as necessary, or a single empty cell for an empty Needs.
Instead, univSize? : Option Nat can be provided to set the total number of indices, and will
either truncate (even if higher indices are set) or pad with empty cells as appropriate.
Instances For
The NeedsKinds which land (directly) in the private scope.
Instances For
The NeedsKinds which land (directly) in the public scope.
Instances For
The NeedsKinds which (directly) demand the private scope.
Instances For
The NeedsKinds which (directly) demand the public scope.
Instances For
The NeedsKinds which land (directly) in the given scope.
Instances For
The NeedsKinds which (directly) demand the given scope.
Instances For
The NeedsKinds which land in the private scope after taking into account public ⊆ private
on both ends. This is simply NeedsKind.all, but can help record why we're using it.
Instances For
The NeedsKinds which land in the public scope after taking into account public ⊆ private
on both ends. This is simply toPublic, but can help record why we're using it.
Instances For
The NeedsKinds which demand the private scope after taking into account public ⊆ private
on both ends.
Instances For
The NeedsKinds which demand the public scope after taking into account public ⊆ private
on both ends. This is simply NeedsKind.all, but can help record why we're using it.
Instances For
The scope (directly) demanded by the NeedsKind.
Instances For
The scope targeted by the NeedsKind.
Instances For
Whether k places the src in the tgt visibility, after taking into account public ⊆
private on both ends. Note that we abstractly consider NeedsKind to be a single arrow between
scopes (i.e. privOfPriv only relates the private scope to the private scope), but in this
function we allow linearization (i.e. composition with public ↪ private)
Instances For
Whether k yields something in the scope tgt. This is always true when tgt is .private
thanks to public ⊆ private on the target side, and is k.isExported when .public.
Instances For
Whether k demands something in the scope src. This is always true when src is .public
thanks to public ⊆ private on the source side, and is k.isAll when .private.
Instances For
The NeedsKind that represents a connection from src to tgt, with tgt the importing
file. E.g., connecting? .public .private is the NeedsKind that imports a public scope into a
private scope.