foundation-0.0.30: Alternative prelude with batteries and no dependencies
LicenseBSD-style
MaintainerVincent Hanquez <vincent@snarc.org>
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Foundation.List.ListN

Description

A Nat-sized list abstraction

Using this module is limited to GHC 7.10 and above.

Documentation

mapM_ :: forall m a b (n :: Nat). Monad m => (a -> m b) -> ListN n a -> m () #

data ListN (n :: Nat) a #

Instances

Instances details
Generic (ListN n a) 
Instance details

Defined in Basement.Sized.List

Associated Types

type Rep (ListN n a) 
Instance details

Defined in Basement.Sized.List

type Rep (ListN n a) = D1 ('MetaData "ListN" "Basement.Sized.List" "basement-0.0.16-I9AlVWPhvehBtGy6XynHKq" 'True) (C1 ('MetaCons "ListN" 'PrefixI 'True) (S1 ('MetaSel ('Just "unListN") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [a])))

Methods

from :: ListN n a -> Rep (ListN n a) x

to :: Rep (ListN n a) x -> ListN n a

Show a => Show (ListN n a) 
Instance details

Defined in Basement.Sized.List

Methods

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

show :: ListN n a -> String

showList :: [ListN n a] -> ShowS

NormalForm a => NormalForm (ListN n a) 
Instance details

Defined in Basement.Sized.List

Methods

toNormalForm :: ListN n a -> () #

(Arbitrary a, KnownNat n, NatWithinBound Int n) => Arbitrary (ListN n a) Source # 
Instance details

Defined in Foundation.Check.Arbitrary

Methods

arbitrary :: Gen (ListN n a) Source #

Copy (ListN n ty) Source # 
Instance details

Defined in Foundation.Collection.Copy

Methods

copy :: ListN n ty -> ListN n ty Source #

1 <= n => Fold1able (ListN n a) Source # 
Instance details

Defined in Foundation.Collection.Foldable

Methods

foldl1' :: (Element (ListN n a) -> Element (ListN n a) -> Element (ListN n a)) -> NonEmpty (ListN n a) -> Element (ListN n a) Source #

foldr1 :: (Element (ListN n a) -> Element (ListN n a) -> Element (ListN n a)) -> NonEmpty (ListN n a) -> Element (ListN n a) Source #

Foldable (ListN n a) Source # 
Instance details

Defined in Foundation.Collection.Foldable

Methods

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

foldr :: (Element (ListN n a) -> a0 -> a0) -> a0 -> ListN n a -> a0 Source #

foldr' :: (Element (ListN n a) -> a0 -> a0) -> a0 -> ListN n a -> a0 Source #

(NatWithinBound Int n, KnownNat n) => IndexedCollection (ListN n a) Source # 
Instance details

Defined in Foundation.Collection.Indexed

Methods

(!) :: ListN n a -> Offset (Element (ListN n a)) -> Maybe (Element (ListN n a)) Source #

findIndex :: (Element (ListN n a) -> Bool) -> ListN n a -> Maybe (Offset (Element (ListN n a))) Source #

Eq a => Eq (ListN n a) 
Instance details

Defined in Basement.Sized.List

Methods

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

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

Ord a => Ord (ListN n a) 
Instance details

Defined in Basement.Sized.List

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 #

type Rep (ListN n a) 
Instance details

Defined in Basement.Sized.List

type Rep (ListN n a) = D1 ('MetaData "ListN" "Basement.Sized.List" "basement-0.0.16-I9AlVWPhvehBtGy6XynHKq" 'True) (C1 ('MetaCons "ListN" 'PrefixI 'True) (S1 ('MetaSel ('Just "unListN") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [a])))
type Element (ListN n a) Source # 
Instance details

Defined in Foundation.Collection.Element

type Element (ListN n a) = a

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

elem :: forall a (n :: Nat). Eq a => a -> ListN n a -> Bool #

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

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

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

empty :: ListN 0 a #

foldl' :: forall b a (n :: Nat). (b -> a -> b) -> b -> ListN n a -> b #

uncons :: forall (n :: Natural) a. 1 <= n => ListN n a -> (a, ListN (n - 1) a) #

unsnoc :: forall (n :: Natural) a. 1 <= n => ListN n a -> (ListN (n - 1) a, a) #

sequence_ :: forall m (n :: Nat) a. Monad m => ListN n (m a) -> m () #

singleton :: a -> ListN 1 a #

snoc :: forall (n :: Nat) a. ListN n a -> a -> ListN (n + 1) a #

reverse :: forall (n :: Nat) a. ListN n a -> ListN n a #

append :: forall (n :: Nat) a (m :: Nat). ListN n a -> ListN m a -> ListN (n + m) a #

index :: forall (n :: Nat) ty. ListN n ty -> Offset ty -> ty #

cons :: forall a (n :: Nat). a -> ListN n a -> ListN (n + 1) a #

head :: forall (n :: Natural) a. 1 <= n => ListN n a -> a #

foldl :: forall b a (n :: Nat). (b -> a -> b) -> b -> ListN n a -> b #

foldl1' :: forall (n :: Natural) a. 1 <= n => (a -> a -> a) -> ListN n a -> a #

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

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

foldr :: forall a b (n :: Nat). (a -> b -> b) -> b -> ListN n a -> b #

foldr1 :: forall (n :: Natural) a. 1 <= n => (a -> a -> a) -> ListN n a -> a #

map :: forall a b (n :: Nat). (a -> b) -> ListN n a -> ListN n b #

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

mapM :: forall m a b (n :: Nat). Monad m => (a -> m b) -> ListN n a -> m (ListN n b) #

sequence :: forall m (n :: Nat) a. Monad m => ListN n (m a) -> m (ListN n a) #

init :: forall (n :: Natural) a. 1 <= n => ListN n a -> ListN (n - 1) a #

zip :: forall (n :: Nat) a b. ListN n a -> ListN n b -> ListN n (a, b) #

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

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

mapi :: forall a b (n :: Nat). (Natural -> a -> b) -> ListN n a -> ListN n b #

maximum :: forall a (n :: Natural). (Ord a, 1 <= n) => ListN n a -> a #

minimum :: forall a (n :: Natural). (Ord a, 1 <= n) => ListN n a -> a #

scanl' :: forall b a (n :: Nat). (b -> a -> b) -> b -> ListN n a -> ListN (n + 1) b #

scanl1' :: forall a (n :: Nat). (a -> a -> a) -> ListN n a -> ListN n a #

tail :: forall (n :: Natural) a. 1 <= n => ListN n a -> ListN (n - 1) a #

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

toListN_ :: forall (n :: Nat) a. (HasCallStack, NatWithinBound Int n, KnownNat n) => [a] -> ListN n a #

unzip :: forall (n :: Nat) a b. ListN n (a, b) -> (ListN n a, ListN n b) #

updateAt :: forall (n :: Nat) a. Offset a -> (a -> a) -> ListN n a -> ListN n a #

zip3 :: forall (n :: Nat) a b c. ListN n a -> ListN n b -> ListN n c -> ListN n (a, b, c) #

zip4 :: forall (n :: Nat) a b c d. ListN n a -> ListN n b -> ListN n c -> ListN n d -> ListN n (a, b, c, d) #

zip5 :: forall (n :: Nat) a b c d e. ListN n a -> ListN n b -> ListN n c -> ListN n d -> ListN n e -> ListN n (a, b, c, d, e) #

zipWith :: forall a b x (n :: Nat). (a -> b -> x) -> ListN n a -> ListN n b -> ListN n x #

zipWith3 :: forall a b c x (n :: Nat). (a -> b -> c -> x) -> ListN n a -> ListN n b -> ListN n c -> ListN n x #

zipWith4 :: forall a b c d x (n :: Nat). (a -> b -> c -> d -> x) -> ListN n a -> ListN n b -> ListN n c -> ListN n d -> ListN n x #

zipWith5 :: forall a b c d e x (n :: Nat). (a -> b -> c -> d -> e -> x) -> ListN n a -> ListN n b -> ListN n c -> ListN n d -> ListN n e -> ListN n x #