basement-0.0.6: Foundation scrap box of array & string

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

Basement.Sized.List

Contents

Description

A Nat-sized list abstraction

Using this module is limited to GHC 7.10 and above.

Synopsis

Documentation

data ListN (n :: Nat) a Source #

Instances

Eq a => Eq (ListN n a) Source # 

Methods

(==) :: ListN n a -> ListN n a -> Bool #

(/=) :: ListN n a -> ListN n a -> Bool #

Ord a => Ord (ListN n a) Source # 

Methods

compare :: ListN n a -> ListN n a -> Ordering #

(<) :: ListN n a -> ListN n a -> Bool #

(<=) :: ListN n a -> ListN n a -> Bool #

(>) :: ListN n a -> ListN n a -> Bool #

(>=) :: ListN n a -> ListN n a -> Bool #

max :: ListN n a -> ListN n a -> ListN n a #

min :: ListN n a -> ListN n a -> ListN n a #

Show a => Show (ListN n a) Source # 

Methods

showsPrec :: Int -> ListN n a -> ShowS #

show :: ListN n a -> String #

showList :: [ListN n a] -> ShowS #

NormalForm a => NormalForm (ListN n a) Source # 

Methods

toNormalForm :: ListN n a -> () Source #

toListN :: forall (n :: Nat) a. (KnownNat n, NatWithinBound Int n) => [a] -> Maybe (ListN n a) Source #

unListN :: ListN n a -> [a] Source #

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

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

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

singleton :: a -> ListN 1 a Source #

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

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

index :: ListN n ty -> Offset ty -> ty Source #

indexStatic :: forall i n a. (KnownNat i, CmpNat i n ~ LT, Offsetable a i) => ListN n a -> a Source #

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

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

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

foldl' :: (b -> a -> b) -> b -> ListN n a -> b Source #

foldr :: (a -> b -> b) -> b -> ListN n a -> b Source #

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

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

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

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

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

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

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

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

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

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

zip4 :: ListN n a -> ListN n b -> ListN n c -> ListN n d -> ListN n (a, b, c, d) 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 #

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

zipWith3 :: (a -> b -> c -> x) -> ListN n a -> ListN n b -> ListN n c -> ListN n x 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 #

replicate :: forall (n :: Nat) a. (NatWithinBound Int n, KnownNat n) => a -> ListN n a Source #

Applicative And Monadic

replicateM :: forall (n :: Nat) m a. (NatWithinBound Int n, Monad m, KnownNat n) => m a -> m (ListN n a) Source #

mapM :: Monad m => (a -> m b) -> ListN n a -> m (ListN n b) Source #

mapM_ :: Monad m => (a -> m b) -> ListN n a -> m () Source #