Copyright | (c) Galois Inc 2022 |
---|---|
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Synopsis
- data FinMap (n :: Nat) a
- null :: FinMap n a -> Bool
- lookup :: Fin n -> FinMap n a -> Maybe a
- size :: forall n a. FinMap n a -> Fin (n + 1)
- incMax :: FinMap n a -> FinMap (n + 1) a
- embed :: n <= m => NatRepr m -> FinMap n a -> FinMap m a
- empty :: KnownNat n => FinMap n a
- singleton :: a -> FinMap 1 a
- insert :: Fin n -> a -> FinMap n a -> FinMap n a
- buildFinMap :: forall m a. NatRepr m -> (forall n. (n + 1) <= m => NatRepr n -> FinMap n a -> FinMap (n + 1) a) -> FinMap m a
- append :: NatRepr n -> a -> FinMap n a -> FinMap (n + 1) a
- fromVector :: forall n a. Vector n (Maybe a) -> FinMap n a
- delete :: Fin n -> FinMap n a -> FinMap n a
- decMax :: NatRepr n -> FinMap (n + 1) a -> FinMap n a
- mapWithKey :: (Fin n -> a -> b) -> FinMap n a -> FinMap n b
- unionWithKey :: (Fin n -> a -> a -> a) -> FinMap n a -> FinMap n a -> FinMap n a
- unionWith :: (a -> a -> a) -> FinMap n a -> FinMap n a -> FinMap n a
- union :: FinMap n a -> FinMap n a -> FinMap n a
Documentation
data FinMap (n :: Nat) a Source #
Instances
Foldable (FinMap n) Source # | |
Defined in Data.Parameterized.FinMap.Unsafe fold :: Monoid m => FinMap n m -> m # foldMap :: Monoid m => (a -> m) -> FinMap n a -> m # foldMap' :: Monoid m => (a -> m) -> FinMap n a -> m # foldr :: (a -> b -> b) -> b -> FinMap n a -> b # foldr' :: (a -> b -> b) -> b -> FinMap n a -> b # foldl :: (b -> a -> b) -> b -> FinMap n a -> b # foldl' :: (b -> a -> b) -> b -> FinMap n a -> b # foldr1 :: (a -> a -> a) -> FinMap n a -> a # foldl1 :: (a -> a -> a) -> FinMap n a -> a # elem :: Eq a => a -> FinMap n a -> Bool # maximum :: Ord a => FinMap n a -> a # minimum :: Ord a => FinMap n a -> a # | |
Traversable (FinMap n) Source # | |
Defined in Data.Parameterized.FinMap.Unsafe | |
Functor (FinMap n) Source # | |
FoldableWithIndex (Fin n) (FinMap n) Source # | |
Defined in Data.Parameterized.FinMap.Unsafe ifoldMap :: Monoid m => (Fin n -> a -> m) -> FinMap n a -> m # ifoldMap' :: Monoid m => (Fin n -> a -> m) -> FinMap n a -> m # ifoldr :: (Fin n -> a -> b -> b) -> b -> FinMap n a -> b # ifoldl :: (Fin n -> b -> a -> b) -> b -> FinMap n a -> b # | |
FunctorWithIndex (Fin n) (FinMap n) Source # | |
KnownNat n => Monoid (FinMap n a) Source # | |
Semigroup (FinMap n a) Source # | |
Show a => Show (FinMap n a) Source # | Non-lawful instance, provided for testing |
Eq a => Eq (FinMap n a) Source # | |
Query
lookup :: Fin n -> FinMap n a -> Maybe a Source #
O(min(n,W)). Fetch the value at the given key in the map.
Construction
incMax :: FinMap n a -> FinMap (n + 1) a Source #
O(1). Increase maximum key/size by 1.
This does not alter the key-value pairs in the map, but rather increases the maximum number of key-value pairs that the map can hold. See Data.Parameterized.FinMap for more information.
Requires n + 1 < (maxBound :: Int)
.
embed :: n <= m => NatRepr m -> FinMap n a -> FinMap m a Source #
O(1). Increase maximum key/size.
Requires m < (maxBound :: Int)
.
buildFinMap :: forall m a. NatRepr m -> (forall n. (n + 1) <= m => NatRepr n -> FinMap n a -> FinMap (n + 1) a) -> FinMap m a Source #