Safe Haskell | None |
---|---|
Language | Haskell2010 |
Heterogeneous array: like a HList but indexed in O(1)
- data HArray (types :: [*])
- type HArrayIndex (n :: Nat) t (ts :: [*]) = (KnownNat n, t ~ Index n ts, KnownNat (Length ts), CmpNat n (Length ts) ~ LT)
- type HArrayIndexT t (ts :: [*]) = (IsMember t ts ~ True, HArrayIndex (IndexOf t ts) t ts)
- type HArrayTryIndexT t (ts :: [*]) = HArrayIndex (MaybeIndexOf t ts) t (t ': ts)
- emptyHArray :: HArray '[]
- singleHArray :: a -> HArray '[a]
- getHArrayN :: forall (n :: Nat) (ts :: [*]) t. HArrayIndex n t ts => HArray ts -> t
- getHArray0 :: HArrayIndex 0 t ts => HArray ts -> t
- setHArrayN :: forall (n :: Nat) (ts :: [*]) t. HArrayIndex n t ts => t -> HArray ts -> HArray ts
- getHArrayT :: forall t ts. HArrayIndexT t ts => HArray ts -> t
- setHArrayT :: forall t ts. HArrayIndexT t ts => t -> HArray ts -> HArray ts
- tryGetHArrayT :: forall t ts. HArrayTryIndexT t ts => HArray ts -> Maybe t
- appendHArray :: HArray ts -> t -> HArray (Snoc ts t)
- prependHArray :: t -> HArray ts -> HArray (t ': ts)
- concatHArray :: HArray ts1 -> HArray ts2 -> HArray (Concat ts1 ts2)
- initHArray :: HArray ts -> HArray (Init ts)
- tailHArray :: HArray ts -> HArray (Tail ts)
- newtype HArrayT m xs ys = HArrayT {
- runHArrayT :: HArray xs -> m (HArray ys)
- (>~:~>) :: Monad m => HArrayT m xs ys -> HArrayT m ys zs -> HArrayT m xs zs
Documentation
type HArrayIndex (n :: Nat) t (ts :: [*]) = (KnownNat n, t ~ Index n ts, KnownNat (Length ts), CmpNat n (Length ts) ~ LT) Source #
The type t
with index n
is indexable in the array
type HArrayIndexT t (ts :: [*]) = (IsMember t ts ~ True, HArrayIndex (IndexOf t ts) t ts) Source #
A type t
is indexable in the array
type HArrayTryIndexT t (ts :: [*]) = HArrayIndex (MaybeIndexOf t ts) t (t ': ts) Source #
A type t
is maybe indexable in the array
emptyHArray :: HArray '[] Source #
Empty array
singleHArray :: a -> HArray '[a] Source #
Empty array
getHArrayN :: forall (n :: Nat) (ts :: [*]) t. HArrayIndex n t ts => HArray ts -> t Source #
Get an element by index
getHArray0 :: HArrayIndex 0 t ts => HArray ts -> t Source #
Get first element
setHArrayN :: forall (n :: Nat) (ts :: [*]) t. HArrayIndex n t ts => t -> HArray ts -> HArray ts Source #
Set an element by index
getHArrayT :: forall t ts. HArrayIndexT t ts => HArray ts -> t Source #
Get an element by type (select the first one with this type)
setHArrayT :: forall t ts. HArrayIndexT t ts => t -> HArray ts -> HArray ts Source #
Set an element by type (select the first one with this type)
tryGetHArrayT :: forall t ts. HArrayTryIndexT t ts => HArray ts -> Maybe t Source #
Get an element by type (select the first one with this type)
prependHArray :: t -> HArray ts -> HArray (t ': ts) Source #
Prepend a value to an array (O(n))