HORIZON HASKELLDocslts/ghc-10.0.x77a86622026-10-31Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 77a8662 · 2026-10-31

Modulebasement-0.0.16Haskell2010

Basement.Sized.List

A Nat-sized list abstraction

Using this module is limited to GHC 7.10 and above.

Contents
  1. Applicative And Monadic
Synopsis
  • Packagebasement-0.0.16
  • Exports51
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceList.hs
newtypenewtype ListN (n :: Nat) a

A Typed-level sized List equivalent to [a]

Instances6Eq, Ord, Show, Generic, NormalForm, Rep
valuefoldl :: (b -> a -> b) -> b -> ListN n a -> b

Fold all elements from left

valuefoldl' :: (b -> a -> b) -> b -> ListN n a -> b

Fold all elements from left strictly

valuefoldl1' :: 1 <= n => (a -> a -> a) -> ListN n a -> a

Fold all elements from left strictly with a first element as the accumulator

valuescanl' :: (b -> a -> b) -> b -> ListN n a -> ListN (n + 1) b

scanl is similar to foldl, but returns a list of successive reduced values from the left

scanl f z [x1, x2, ...] == [z, z `f` x1, (z `f` x1) `f` x2, ...]
valuescanl1' :: (a -> a -> a) -> ListN n a -> ListN n a

scanl1 is a variant of scanl that has no starting value argument:

scanl1 f [x1, x2, ...] == [x1, x1 `f` x2, ...]
valuefoldr :: (a -> b -> b) -> b -> ListN n a -> b

Fold all elements from right

valuefoldr1 :: 1 <= n => (a -> a -> a) -> ListN n a -> a

Fold all elements from right assuming at least one element is in the list.

valuezip :: ListN n a -> ListN n b -> ListN n (a, b)

Zip 2 lists of the same size, returning a new list of the tuple of each elements

Applicative And Monadic

valuesequence_ :: Monad m => ListN n (m a) -> m ()

Evaluate each monadic action in the list sequentially, and ignore the results.

valuemapM :: Monad m => (a -> m b) -> ListN n a -> m (ListN n b)

Map each element of a List to a monadic action, evaluate these actions sequentially and collect the results

valuemapM_ :: Monad m => (a -> m b) -> ListN n a -> m ()

Map each element of a List to a monadic action, evaluate these actions sequentially and ignore the results