License | BSD-style |
---|---|
Maintainer | Vincent Hanquez <vincent@snarc.org> |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
A Nat-sized list abstraction
Using this module is limited to GHC 7.10 and above.
- data ListN n a
- toListN :: forall n a. (KnownNat n, NatWithinBound Int n) => [a] -> Maybe (ListN n a)
- unListN :: ListN n a -> [a]
- length :: forall a n. (KnownNat n, NatWithinBound Int n) => ListN n a -> Int
- create :: forall a n. KnownNat n => (Integer -> a) -> ListN n a
- createFrom :: forall a n start. (KnownNat n, KnownNat start) => Proxy start -> (Integer -> a) -> ListN n a
- empty :: ListN 0 a
- singleton :: a -> ListN 1 a
- uncons :: CmpNat n 0 ~ GT => ListN n a -> (a, ListN (n - 1) a)
- cons :: a -> ListN n a -> ListN (n + 1) a
- index :: ListN n ty -> Offset ty -> ty
- indexStatic :: forall i n a. (KnownNat i, CmpNat i n ~ LT, Offsetable a i) => ListN n a -> a
- map :: (a -> b) -> ListN n a -> ListN n b
- elem :: Eq a => a -> ListN n a -> Bool
- foldl :: (b -> a -> b) -> b -> ListN n a -> b
- foldl' :: (b -> a -> b) -> b -> ListN n a -> b
- foldr :: (a -> b -> b) -> b -> ListN n a -> b
- append :: ListN n a -> ListN m a -> ListN (n + m) a
- minimum :: (Ord a, CmpNat n 0 ~ GT) => ListN n a -> a
- maximum :: (Ord a, CmpNat n 0 ~ GT) => ListN n a -> a
- head :: CmpNat n 0 ~ GT => ListN n a -> a
- tail :: CmpNat n 0 ~ GT => ListN n a -> ListN (n - 1) a
- take :: forall a m n. (KnownNat m, NatWithinBound Int m, m <= n) => ListN n a -> ListN m a
- drop :: forall a d m n. (KnownNat d, NatWithinBound Int d, (n - m) ~ d, m <= n) => ListN n a -> ListN m a
- splitAt :: forall a d m n. (KnownNat d, NatWithinBound Int d, (n - m) ~ d, m <= n) => ListN n a -> (ListN m a, ListN (n - m) a)
- zip :: ListN n a -> ListN n b -> ListN n (a, b)
- zip3 :: ListN n a -> ListN n b -> ListN n c -> ListN n (a, b, c)
- zip4 :: ListN n a -> ListN n b -> ListN n c -> ListN n d -> ListN n (a, b, c, d)
- zip5 :: ListN n a -> ListN n b -> ListN n c -> ListN n d -> ListN n e -> ListN n (a, b, c, d, e)
- zipWith :: (a -> b -> x) -> ListN n a -> ListN n b -> ListN n x
- zipWith3 :: (a -> b -> c -> x) -> ListN n a -> ListN n b -> ListN n c -> ListN n x
- zipWith4 :: (a -> b -> c -> d -> x) -> ListN n a -> ListN n b -> ListN n c -> ListN n d -> ListN n x
- zipWith5 :: (a -> b -> c -> d -> e -> x) -> ListN n a -> ListN n b -> ListN n c -> ListN n d -> ListN n e -> ListN n x
- replicate :: forall n a. (NatWithinBound Int n, KnownNat n) => a -> ListN n a
- replicateM :: forall n m a. (NatWithinBound Int n, Monad m, KnownNat n) => m a -> m (ListN n a)
- mapM :: Monad m => (a -> m b) -> ListN n a -> m (ListN n b)
- mapM_ :: Monad m => (a -> m b) -> ListN n a -> m ()
Documentation
createFrom :: forall a n start. (KnownNat n, KnownNat start) => Proxy start -> (Integer -> a) -> ListN n a Source #
indexStatic :: forall i n a. (KnownNat i, CmpNat i n ~ LT, Offsetable a i) => ListN n a -> a Source #
drop :: forall a d m n. (KnownNat d, NatWithinBound Int d, (n - m) ~ d, m <= n) => ListN n a -> ListN m a Source #
splitAt :: forall a d m n. (KnownNat d, NatWithinBound Int d, (n - m) ~ d, m <= n) => ListN n a -> (ListN m a, ListN (n - m) a) Source #
zip5 :: ListN n a -> ListN n b -> ListN n c -> ListN n d -> ListN n e -> ListN n (a, b, c, d, e) Source #
zipWith4 :: (a -> b -> c -> d -> x) -> ListN n a -> ListN n b -> ListN n c -> ListN n d -> ListN n x Source #
zipWith5 :: (a -> b -> c -> d -> e -> x) -> ListN n a -> ListN n b -> ListN n c -> ListN n d -> ListN n e -> ListN n x Source #
Applicative And Monadic
replicateM :: forall n m a. (NatWithinBound Int n, Monad m, KnownNat n) => m a -> m (ListN n a) Source #