foundation-0.0.10: Alternative prelude with batteries and no dependencies

LicenseBSD-style
MaintainerVincent Hanquez <vincent@snarc.org>
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Foundation.List.SList

Description

A Nat-sized list abstraction

Using this module is limited to GHC 7.10 and above.

Documentation

data SList n a Source #

toSList :: forall n a. (KnownNat n, NatWithinBound Int n) => [a] -> Maybe (SList n a) Source #

unSList :: SList n a -> [a] Source #

length :: forall a n. (KnownNat n, NatWithinBound Int n) => SList n a -> Int Source #

create :: forall a n. KnownNat n => (Integer -> a) -> SList n a Source #

createFrom :: forall a n start. (KnownNat n, KnownNat start) => Proxy start -> (Integer -> a) -> SList n a Source #

singleton :: a -> SList 1 a Source #

uncons :: CmpNat n 0 ~ GT => SList n a -> (a, SList (n - 1) a) Source #

cons :: a -> SList n a -> SList (n + 1) a Source #

map :: (a -> b) -> SList n a -> SList n b Source #

elem :: Eq a => a -> SList n a -> Bool Source #

foldl :: (b -> a -> b) -> b -> SList n a -> b Source #

append :: SList n a -> SList m a -> SList (n + m) a Source #

minimum :: (Ord a, CmpNat n 0 ~ GT) => SList n a -> a Source #

maximum :: (Ord a, CmpNat n 0 ~ GT) => SList n a -> a Source #

head :: CmpNat n 0 ~ GT => SList n a -> a Source #

tail :: CmpNat n 0 ~ GT => SList n a -> SList (n - 1) a Source #

take :: forall a m n. (KnownNat m, NatWithinBound Int m, m <= n) => SList n a -> SList m a Source #

drop :: forall a d m n. (KnownNat d, NatWithinBound Int d, (n - m) ~ d, m <= n) => SList n a -> SList m a Source #

zip :: SList n a -> SList n b -> SList n (a, b) Source #

zip3 :: SList n a -> SList n b -> SList n c -> SList n (a, b, c) Source #

zip4 :: SList n a -> SList n b -> SList n c -> SList n d -> SList n (a, b, c, d) Source #

zip5 :: SList n a -> SList n b -> SList n c -> SList n d -> SList n e -> SList n (a, b, c, d, e) Source #

zipWith :: (a -> b -> x) -> SList n a -> SList n b -> SList n x Source #

zipWith3 :: (a -> b -> c -> x) -> SList n a -> SList n b -> SList n c -> SList n x Source #

zipWith4 :: (a -> b -> c -> d -> x) -> SList n a -> SList n b -> SList n c -> SList n d -> SList n x Source #

zipWith5 :: (a -> b -> c -> d -> e -> x) -> SList n a -> SList n b -> SList n c -> SList n d -> SList n e -> SList n x Source #

replicateM :: forall n m a. (n <= 1048576, Monad m, KnownNat n) => m a -> m (SList n a) Source #