Copyright | (C) Frank Staals |
---|---|
License | see the LICENSE file |
Maintainer | Frank Staals |
Safe Haskell | None |
Language | Haskell2010 |
Synopsis
- runAcquire :: forall t a b. Traversable t => (forall s. CanAquire (I s a) a => t (I s a) -> b) -> t a -> b
- class HasIndex i Int => CanAquire i a where
- aquire :: i -> a
- class HasIndex t i | t -> i where
- indexOf :: t -> i
- replaceByIndex :: forall t a. Traversable t => t a -> (Vector a, t Int)
- labelWithIndex :: Traversable t => t a -> (t (Int, a), Int)
- data I (s :: *) a
Documentation
runAcquire :: forall t a b. Traversable t => (forall s. CanAquire (I s a) a => t (I s a) -> b) -> t a -> b Source #
Run a computation on something that can aquire i's.
replaceByIndex :: forall t a. Traversable t => t a -> (Vector a, t Int) Source #
Replaces every element by an index. Returns the new traversable containing only these indices, as well as a vector with the values. (such that indexing in this value gives the original value).
labelWithIndex :: Traversable t => t a -> (t (Int, a), Int) Source #
Label each element with its index. Returns the new collection as well as its size.