foundation-0.0.6: Alternative prelude with batteries and no dependencies

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

Foundation.Collection

Description

Different collections (list, vector, string, ..) unified under 1 API. an API to rules them all, and in the darkness bind them.

Synopsis

Documentation

class Zippable col => BoxedZippable col where #

Methods

zip :: (Sequential a, Sequential b, Element col ~ (Element a, Element b)) => a -> b -> col #

zip takes two collections and returns a collections of corresponding pairs. If one input collection is short, excess elements of the longer collection are discarded.

zip3 :: (Sequential a, Sequential b, Sequential c, Element col ~ (Element a, Element b, Element c)) => a -> b -> c -> col #

Like zip, but works with 3 collections.

zip4 :: (Sequential a, Sequential b, Sequential c, Sequential d, Element col ~ (Element a, Element b, Element c, Element d)) => a -> b -> c -> d -> col #

Like zip, but works with 4 collections.

zip5 :: (Sequential a, Sequential b, Sequential c, Sequential d, Sequential e, Element col ~ (Element a, Element b, Element c, Element d, Element e)) => a -> b -> c -> d -> e -> col #

Like zip, but works with 5 collections.

zip6 :: (Sequential a, Sequential b, Sequential c, Sequential d, Sequential e, Sequential f, Element col ~ (Element a, Element b, Element c, Element d, Element e, Element f)) => a -> b -> c -> d -> e -> f -> col #

Like zip, but works with 6 collections.

zip7 :: (Sequential a, Sequential b, Sequential c, Sequential d, Sequential e, Sequential f, Sequential g, Element col ~ (Element a, Element b, Element c, Element d, Element e, Element f, Element g)) => a -> b -> c -> d -> e -> f -> g -> col #

Like zip, but works with 7 collections.

unzip :: (Sequential a, Sequential b, Element col ~ (Element a, Element b)) => col -> (a, b) #

unzip transforms a collection of pairs into a collection of first components and a collection of second components.

unzip3 :: (Sequential a, Sequential b, Sequential c, Element col ~ (Element a, Element b, Element c)) => col -> (a, b, c) #

Like unzip, but works on a collection of 3-element tuples.

unzip4 :: (Sequential a, Sequential b, Sequential c, Sequential d, Element col ~ (Element a, Element b, Element c, Element d)) => col -> (a, b, c, d) #

Like unzip, but works on a collection of 4-element tuples.

unzip5 :: (Sequential a, Sequential b, Sequential c, Sequential d, Sequential e, Element col ~ (Element a, Element b, Element c, Element d, Element e)) => col -> (a, b, c, d, e) #

Like unzip, but works on a collection of 5-element tuples.

unzip6 :: (Sequential a, Sequential b, Sequential c, Sequential d, Sequential e, Sequential f, Element col ~ (Element a, Element b, Element c, Element d, Element e, Element f)) => col -> (a, b, c, d, e, f) #

Like unzip, but works on a collection of 6-element tuples.

unzip7 :: (Sequential a, Sequential b, Sequential c, Sequential d, Sequential e, Sequential f, Sequential g, Element col ~ (Element a, Element b, Element c, Element d, Element e, Element f, Element g)) => col -> (a, b, c, d, e, f, g) #

Like unzip, but works on a collection of 7-element tuples.

Instances

BoxedZippable [a] # 

Methods

zip :: (Sequential a, Sequential b, (* ~ Element [a]) (Element a, Element b)) => a -> b -> [a] #

zip3 :: (Sequential a, Sequential b, Sequential c, (* ~ Element [a]) (Element a, Element b, Element c)) => a -> b -> c -> [a] #

zip4 :: (Sequential a, Sequential b, Sequential c, Sequential d, (* ~ Element [a]) (Element a, Element b, Element c, Element d)) => a -> b -> c -> d -> [a] #

zip5 :: (Sequential a, Sequential b, Sequential c, Sequential d, Sequential e, (* ~ Element [a]) (Element a, Element b, Element c, Element d, Element e)) => a -> b -> c -> d -> e -> [a] #

zip6 :: (Sequential a, Sequential b, Sequential c, Sequential d, Sequential e, Sequential f, (* ~ Element [a]) (Element a, Element b, Element c, Element d, Element e, Element f)) => a -> b -> c -> d -> e -> f -> [a] #

zip7 :: (Sequential a, Sequential b, Sequential c, Sequential d, Sequential e, Sequential f, Sequential g, (* ~ Element [a]) (Element a, Element b, Element c, Element d, Element e, Element f, Element g)) => a -> b -> c -> d -> e -> f -> g -> [a] #

unzip :: (Sequential a, Sequential b, (* ~ Element [a]) (Element a, Element b)) => [a] -> (a, b) #

unzip3 :: (Sequential a, Sequential b, Sequential c, (* ~ Element [a]) (Element a, Element b, Element c)) => [a] -> (a, b, c) #

unzip4 :: (Sequential a, Sequential b, Sequential c, Sequential d, (* ~ Element [a]) (Element a, Element b, Element c, Element d)) => [a] -> (a, b, c, d) #

unzip5 :: (Sequential a, Sequential b, Sequential c, Sequential d, Sequential e, (* ~ Element [a]) (Element a, Element b, Element c, Element d, Element e)) => [a] -> (a, b, c, d, e) #

unzip6 :: (Sequential a, Sequential b, Sequential c, Sequential d, Sequential e, Sequential f, (* ~ Element [a]) (Element a, Element b, Element c, Element d, Element e, Element f)) => [a] -> (a, b, c, d, e, f) #

unzip7 :: (Sequential a, Sequential b, Sequential c, Sequential d, Sequential e, Sequential f, Sequential g, (* ~ Element [a]) (Element a, Element b, Element c, Element d, Element e, Element f, Element g)) => [a] -> (a, b, c, d, e, f, g) #

BoxedZippable (Array ty) # 

Methods

zip :: (Sequential a, Sequential b, (* ~ Element (Array ty)) (Element a, Element b)) => a -> b -> Array ty #

zip3 :: (Sequential a, Sequential b, Sequential c, (* ~ Element (Array ty)) (Element a, Element b, Element c)) => a -> b -> c -> Array ty #

zip4 :: (Sequential a, Sequential b, Sequential c, Sequential d, (* ~ Element (Array ty)) (Element a, Element b, Element c, Element d)) => a -> b -> c -> d -> Array ty #

zip5 :: (Sequential a, Sequential b, Sequential c, Sequential d, Sequential e, (* ~ Element (Array ty)) (Element a, Element b, Element c, Element d, Element e)) => a -> b -> c -> d -> e -> Array ty #

zip6 :: (Sequential a, Sequential b, Sequential c, Sequential d, Sequential e, Sequential f, (* ~ Element (Array ty)) (Element a, Element b, Element c, Element d, Element e, Element f)) => a -> b -> c -> d -> e -> f -> Array ty #

zip7 :: (Sequential a, Sequential b, Sequential c, Sequential d, Sequential e, Sequential f, Sequential g, (* ~ Element (Array ty)) (Element a, Element b, Element c, Element d, Element e, Element f, Element g)) => a -> b -> c -> d -> e -> f -> g -> Array ty #

unzip :: (Sequential a, Sequential b, (* ~ Element (Array ty)) (Element a, Element b)) => Array ty -> (a, b) #

unzip3 :: (Sequential a, Sequential b, Sequential c, (* ~ Element (Array ty)) (Element a, Element b, Element c)) => Array ty -> (a, b, c) #

unzip4 :: (Sequential a, Sequential b, Sequential c, Sequential d, (* ~ Element (Array ty)) (Element a, Element b, Element c, Element d)) => Array ty -> (a, b, c, d) #

unzip5 :: (Sequential a, Sequential b, Sequential c, Sequential d, Sequential e, (* ~ Element (Array ty)) (Element a, Element b, Element c, Element d, Element e)) => Array ty -> (a, b, c, d, e) #

unzip6 :: (Sequential a, Sequential b, Sequential c, Sequential d, Sequential e, Sequential f, (* ~ Element (Array ty)) (Element a, Element b, Element c, Element d, Element e, Element f)) => Array ty -> (a, b, c, d, e, f) #

unzip7 :: (Sequential a, Sequential b, Sequential c, Sequential d, Sequential e, Sequential f, Sequential g, (* ~ Element (Array ty)) (Element a, Element b, Element c, Element d, Element e, Element f, Element g)) => Array ty -> (a, b, c, d, e, f, g) #

type family Element container #

Element type of a collection

Instances

type Element String # 
type Element AsciiString # 
type Element Bitmap # 
type Element [a] # 
type Element [a] = a
type Element (UArray ty) # 
type Element (UArray ty) = ty
type Element (Array ty) # 
type Element (Array ty) = ty
type Element (NonEmpty a) # 
type Element (NonEmpty a) = Element a
type Element (ChunkedUArray ty) # 
type Element (ChunkedUArray ty) = ty

class InnerFunctor c where #

A monomorphic functor that maps the inner values to values of the same type

Methods

imap :: (Element c -> Element c) -> c -> c #

imap :: (Functor f, Element (f a) ~ a, f a ~ c) => (Element c -> Element c) -> c -> c #

Instances

InnerFunctor String # 
InnerFunctor AsciiString # 
InnerFunctor Bitmap # 
InnerFunctor [a] # 

Methods

imap :: (Element [a] -> Element [a]) -> [a] -> [a] #

PrimType ty => InnerFunctor (UArray ty) # 

Methods

imap :: (Element (UArray ty) -> Element (UArray ty)) -> UArray ty -> UArray ty #

InnerFunctor (Array ty) # 

Methods

imap :: (Element (Array ty) -> Element (Array ty)) -> Array ty -> Array ty #

class Foldable collection where #

Give the ability to fold a collection on itself

Minimal complete definition

foldl, foldl', foldr

Methods

foldl :: (a -> Element collection -> a) -> a -> collection -> a #

Left-associative fold of a structure.

In the case of lists, foldl, when applied to a binary operator, a starting value (typically the left-identity of the operator), and a list, reduces the list using the binary operator, from left to right:

foldl f z [x1, x2, ..., xn] == (...((z `f` x1) `f` x2) `f`...) `f` xn

Note that to produce the outermost application of the operator the entire input list must be traversed. This means that foldl' will diverge if given an infinite list.

Also note that if you want an efficient left-fold, you probably want to use foldl' instead of foldl. The reason for this is that latter does not force the "inner" results (e.g. z f x1 in the above example) before applying them to the operator (e.g. to (f x2)). This results in a thunk chain O(n) elements long, which then must be evaluated from the outside-in.

foldl' :: (a -> Element collection -> a) -> a -> collection -> a #

Left-associative fold of a structure but with strict application of the operator.

foldr :: (Element collection -> a -> a) -> a -> collection -> a #

Right-associative fold of a structure.

foldr f z [x1, x2, ..., xn] == x1 `f` (x2 `f` ... (xn `f` z)...)

foldr' :: (Element collection -> a -> a) -> a -> collection -> a #

Right-associative fold of a structure, but with strict application of the operator.

Instances

Foldable Bitmap # 

Methods

foldl :: (a -> Element Bitmap -> a) -> a -> Bitmap -> a #

foldl' :: (a -> Element Bitmap -> a) -> a -> Bitmap -> a #

foldr :: (Element Bitmap -> a -> a) -> a -> Bitmap -> a #

foldr' :: (Element Bitmap -> a -> a) -> a -> Bitmap -> a #

Foldable [a] # 

Methods

foldl :: (a -> Element [a] -> a) -> a -> [a] -> a #

foldl' :: (a -> Element [a] -> a) -> a -> [a] -> a #

foldr :: (Element [a] -> a -> a) -> a -> [a] -> a #

foldr' :: (Element [a] -> a -> a) -> a -> [a] -> a #

PrimType ty => Foldable (UArray ty) # 

Methods

foldl :: (a -> Element (UArray ty) -> a) -> a -> UArray ty -> a #

foldl' :: (a -> Element (UArray ty) -> a) -> a -> UArray ty -> a #

foldr :: (Element (UArray ty) -> a -> a) -> a -> UArray ty -> a #

foldr' :: (Element (UArray ty) -> a -> a) -> a -> UArray ty -> a #

Foldable (Array ty) # 

Methods

foldl :: (a -> Element (Array ty) -> a) -> a -> Array ty -> a #

foldl' :: (a -> Element (Array ty) -> a) -> a -> Array ty -> a #

foldr :: (Element (Array ty) -> a -> a) -> a -> Array ty -> a #

foldr' :: (Element (Array ty) -> a -> a) -> a -> Array ty -> a #

class Functor collection => Mappable collection where #

Functors representing data structures that can be traversed from left to right.

Mostly like base's Traversable but applied to collections only.

Minimal complete definition

traverse | sequenceA

Methods

traverse :: Applicative f => (a -> f b) -> collection a -> f (collection b) #

Map each element of a structure to an action, evaluate these actions from left to right, and collect the results. For a version that ignores the results see traverse_.

sequenceA :: Applicative f => collection (f a) -> f (collection a) #

Evaluate each actions of the given collections, from left to right, and collect the results. For a version that ignores the results, see sequenceA_

mapM :: (Applicative m, Monad m) => (a -> m b) -> collection a -> m (collection b) #

Map each element of the collection to an action, evaluate these actions from left to right, and collect the results. For a version that ignores the results see mapM_.

sequence :: (Applicative m, Monad m) => collection (m a) -> m (collection a) #

Evaluate each actions of the given collections, from left to right, and collect the results. For a version that ignores the results, see sequence_

Instances

Mappable [] # 

Methods

traverse :: Applicative f => (a -> f b) -> [a] -> f [b] #

sequenceA :: Applicative f => [f a] -> f [a] #

mapM :: (Applicative m, Monad m) => (a -> m b) -> [a] -> m [b] #

sequence :: (Applicative m, Monad m) => [m a] -> m [a] #

Mappable Array # 

Methods

traverse :: Applicative f => (a -> f b) -> Array a -> f (Array b) #

sequenceA :: Applicative f => Array (f a) -> f (Array a) #

mapM :: (Applicative m, Monad m) => (a -> m b) -> Array a -> m (Array b) #

sequence :: (Applicative m, Monad m) => Array (m a) -> m (Array a) #

traverse_ :: (Mappable col, Applicative f) => (a -> f b) -> col a -> f () #

Map each element of a collection to an action, evaluate these actions from left to right, and ignore the results. For a version that doesn't ignore the results see traverse

mapM_ :: (Mappable col, Applicative m, Monad m) => (a -> m b) -> col a -> m () #

Map each element of a collection to a monadic action, evaluate these actions from left to right, and ignore the results. For a version that doesn't ignore the results see mapM.

forM :: (Mappable col, Applicative m, Monad m) => col a -> (a -> m b) -> m (col b) #

forM is mapM with its arguments flipped. For a version that ignores the results see forM_.

forM_ :: (Mappable col, Applicative m, Monad m) => col a -> (a -> m b) -> m () #

forM_ is mapM_ with its arguments flipped. For a version that doesn't ignore the results see forM.

class (IsList c, Item c ~ Element c) => Collection c where #

A set of methods for ordered colection

Minimal complete definition

null, length, (elem | notElem), minimum, maximum, all, any

Methods

null :: c -> Bool #

Check if a collection is empty

length :: c -> Int #

Length of a collection (number of Element c)

elem :: forall a. (Eq a, a ~ Element c) => Element c -> c -> Bool #

Check if a collection contains a specific element

This is the inverse of notElem.

notElem :: forall a. (Eq a, a ~ Element c) => Element c -> c -> Bool #

Check if a collection does *not* contain a specific element

This is the inverse of elem.

maximum :: forall a. (Ord a, a ~ Element c) => NonEmpty c -> Element c #

Get the maximum element of a collection

minimum :: forall a. (Ord a, a ~ Element c) => NonEmpty c -> Element c #

Get the minimum element of a collection

any :: (Element c -> Bool) -> c -> Bool #

Determine is any elements of the collection satisfy the predicate

all :: (Element c -> Bool) -> c -> Bool #

Determine is all elements of the collection satisfy the predicate

Instances

Collection String # 

Methods

null :: String -> Bool #

length :: String -> Int #

elem :: (Eq a, (* ~ a) (Element String)) => Element String -> String -> Bool #

notElem :: (Eq a, (* ~ a) (Element String)) => Element String -> String -> Bool #

maximum :: (Ord a, (* ~ a) (Element String)) => NonEmpty String -> Element String #

minimum :: (Ord a, (* ~ a) (Element String)) => NonEmpty String -> Element String #

any :: (Element String -> Bool) -> String -> Bool #

all :: (Element String -> Bool) -> String -> Bool #

Collection AsciiString # 
Collection Bitmap # 

Methods

null :: Bitmap -> Bool #

length :: Bitmap -> Int #

elem :: (Eq a, (* ~ a) (Element Bitmap)) => Element Bitmap -> Bitmap -> Bool #

notElem :: (Eq a, (* ~ a) (Element Bitmap)) => Element Bitmap -> Bitmap -> Bool #

maximum :: (Ord a, (* ~ a) (Element Bitmap)) => NonEmpty Bitmap -> Element Bitmap #

minimum :: (Ord a, (* ~ a) (Element Bitmap)) => NonEmpty Bitmap -> Element Bitmap #

any :: (Element Bitmap -> Bool) -> Bitmap -> Bool #

all :: (Element Bitmap -> Bool) -> Bitmap -> Bool #

Collection [a] # 

Methods

null :: [a] -> Bool #

length :: [a] -> Int #

elem :: (Eq a, (* ~ a) (Element [a])) => Element [a] -> [a] -> Bool #

notElem :: (Eq a, (* ~ a) (Element [a])) => Element [a] -> [a] -> Bool #

maximum :: (Ord a, (* ~ a) (Element [a])) => NonEmpty [a] -> Element [a] #

minimum :: (Ord a, (* ~ a) (Element [a])) => NonEmpty [a] -> Element [a] #

any :: (Element [a] -> Bool) -> [a] -> Bool #

all :: (Element [a] -> Bool) -> [a] -> Bool #

PrimType ty => Collection (UArray ty) # 

Methods

null :: UArray ty -> Bool #

length :: UArray ty -> Int #

elem :: (Eq a, (* ~ a) (Element (UArray ty))) => Element (UArray ty) -> UArray ty -> Bool #

notElem :: (Eq a, (* ~ a) (Element (UArray ty))) => Element (UArray ty) -> UArray ty -> Bool #

maximum :: (Ord a, (* ~ a) (Element (UArray ty))) => NonEmpty (UArray ty) -> Element (UArray ty) #

minimum :: (Ord a, (* ~ a) (Element (UArray ty))) => NonEmpty (UArray ty) -> Element (UArray ty) #

any :: (Element (UArray ty) -> Bool) -> UArray ty -> Bool #

all :: (Element (UArray ty) -> Bool) -> UArray ty -> Bool #

Collection (Array ty) # 

Methods

null :: Array ty -> Bool #

length :: Array ty -> Int #

elem :: (Eq a, (* ~ a) (Element (Array ty))) => Element (Array ty) -> Array ty -> Bool #

notElem :: (Eq a, (* ~ a) (Element (Array ty))) => Element (Array ty) -> Array ty -> Bool #

maximum :: (Ord a, (* ~ a) (Element (Array ty))) => NonEmpty (Array ty) -> Element (Array ty) #

minimum :: (Ord a, (* ~ a) (Element (Array ty))) => NonEmpty (Array ty) -> Element (Array ty) #

any :: (Element (Array ty) -> Bool) -> Array ty -> Bool #

all :: (Element (Array ty) -> Bool) -> Array ty -> Bool #

Collection c => Collection (NonEmpty c) # 

Methods

null :: NonEmpty c -> Bool #

length :: NonEmpty c -> Int #

elem :: (Eq a, (* ~ a) (Element (NonEmpty c))) => Element (NonEmpty c) -> NonEmpty c -> Bool #

notElem :: (Eq a, (* ~ a) (Element (NonEmpty c))) => Element (NonEmpty c) -> NonEmpty c -> Bool #

maximum :: (Ord a, (* ~ a) (Element (NonEmpty c))) => NonEmpty (NonEmpty c) -> Element (NonEmpty c) #

minimum :: (Ord a, (* ~ a) (Element (NonEmpty c))) => NonEmpty (NonEmpty c) -> Element (NonEmpty c) #

any :: (Element (NonEmpty c) -> Bool) -> NonEmpty c -> Bool #

all :: (Element (NonEmpty c) -> Bool) -> NonEmpty c -> Bool #

PrimType ty => Collection (ChunkedUArray ty) # 

data NonEmpty a #

NonEmpty property for any Collection

This can only be made, through the nonEmpty smart contructor

Instances

Collection c => IsList (NonEmpty c) # 

Associated Types

type Item (NonEmpty c) :: * #

Methods

fromList :: [Item (NonEmpty c)] -> NonEmpty c #

fromListN :: Int -> [Item (NonEmpty c)] -> NonEmpty c #

toList :: NonEmpty c -> [Item (NonEmpty c)] #

Eq a => Eq (NonEmpty a) # 

Methods

(==) :: NonEmpty a -> NonEmpty a -> Bool #

(/=) :: NonEmpty a -> NonEmpty a -> Bool #

Show a => Show (NonEmpty a) # 

Methods

showsPrec :: Int -> NonEmpty a -> ShowS #

show :: NonEmpty a -> String #

showList :: [NonEmpty a] -> ShowS #

Collection c => Collection (NonEmpty c) # 

Methods

null :: NonEmpty c -> Bool #

length :: NonEmpty c -> Int #

elem :: (Eq a, (* ~ a) (Element (NonEmpty c))) => Element (NonEmpty c) -> NonEmpty c -> Bool #

notElem :: (Eq a, (* ~ a) (Element (NonEmpty c))) => Element (NonEmpty c) -> NonEmpty c -> Bool #

maximum :: (Ord a, (* ~ a) (Element (NonEmpty c))) => NonEmpty (NonEmpty c) -> Element (NonEmpty c) #

minimum :: (Ord a, (* ~ a) (Element (NonEmpty c))) => NonEmpty (NonEmpty c) -> Element (NonEmpty c) #

any :: (Element (NonEmpty c) -> Bool) -> NonEmpty c -> Bool #

all :: (Element (NonEmpty c) -> Bool) -> NonEmpty c -> Bool #

type Item (NonEmpty c) # 
type Item (NonEmpty c) = Item c
type Element (NonEmpty a) # 
type Element (NonEmpty a) = Element a

nonEmpty :: Collection c => c -> Maybe (NonEmpty c) #

Smart constructor to create a NonEmpty collection

If the collection is empty, then Nothing is returned Otherwise, the collection is wrapped in the NonEmpty property

nonEmpty_ :: Collection c => c -> NonEmpty c #

same as nonEmpty, but assume that the collection is non empty, and return an asynchronous error if it is.

nonEmptyFmap :: Functor f => (a -> b) -> NonEmpty (f a) -> NonEmpty (f b) #

class (IsList c, Item c ~ Element c, Monoid c, Collection c) => Sequential c where #

A set of methods for ordered colection

Methods

take :: Int -> c -> c #

Take the first @n elements of a collection

revTake :: Int -> c -> c #

Take the last @n elements of a collection

drop :: Int -> c -> c #

Drop the first @n elements of a collection

revDrop :: Int -> c -> c #

Drop the last @n elements of a collection

splitAt :: Int -> c -> (c, c) #

Split the collection at the @n'th elements

revSplitAt :: Int -> c -> (c, c) #

Split the collection at the @n'th elements from the end

splitOn :: (Element c -> Bool) -> c -> [c] #

Split on a specific elements returning a list of colletion

break :: (Element c -> Bool) -> c -> (c, c) #

Split a collection when the predicate return true

breakElem :: Eq (Element c) => Element c -> c -> (c, c) #

Split a collection when the predicate return true

intersperse :: Element c -> c -> c #

The intersperse function takes an element and a list and `intersperses' that element between the elements of the list. For example,

intersperse ',' "abcde" == "a,b,c,d,e"

intercalate :: Monoid (Item c) => Element c -> c -> Element c #

intercalate xs xss is equivalent to (mconcat (intersperse xs xss)). It inserts the list xs in between the lists in xss and concatenates the result.

span :: (Element c -> Bool) -> c -> (c, c) #

Split a collection while the predicate return true

filter :: (Element c -> Bool) -> c -> c #

Filter all the elements that satisfy the predicate

partition :: (Element c -> Bool) -> c -> (c, c) #

Partition the elements thtat satisfy the predicate and those that don't

reverse :: c -> c #

Reverse a collection

uncons :: c -> Maybe (Element c, c) #

Decompose a collection into its first element and the remaining collection. If the collection is empty, returns Nothing.

unsnoc :: c -> Maybe (c, Element c) #

Decompose a collection into a collection without its last element, and the last element If the collection is empty, returns Nothing.

snoc :: c -> Element c -> c #

Prepend an element to an ordered collection

cons :: Element c -> c -> c #

Append an element to an ordered collection

find :: (Element c -> Bool) -> c -> Maybe (Element c) #

Find an element in an ordered collection

sortBy :: (Element c -> Element c -> Ordering) -> c -> c #

Sort an ordered collection using the specified order function

singleton :: Element c -> c #

Create a collection with a single element

head :: NonEmpty c -> Element c #

get the first element of a non-empty collection

last :: NonEmpty c -> Element c #

get the last element of a non-empty collection

tail :: NonEmpty c -> c #

Extract the elements after the first element of a non-empty collection.

init :: NonEmpty c -> c #

Extract the elements before the last element of a non-empty collection.

isPrefixOf :: Eq (Element c) => c -> c -> Bool #

Takes two collections and returns True iff the first collection is a prefix of the second.

isPrefixOf :: Eq c => c -> c -> Bool #

Takes two collections and returns True iff the first collection is a prefix of the second.

isSuffixOf :: Eq (Element c) => c -> c -> Bool #

Takes two collections and returns True iff the first collection is a suffix of the second.

isSuffixOf :: Eq c => c -> c -> Bool #

Takes two collections and returns True iff the first collection is a suffix of the second.

Instances

Sequential String # 
Sequential AsciiString # 

Methods

take :: Int -> AsciiString -> AsciiString #

revTake :: Int -> AsciiString -> AsciiString #

drop :: Int -> AsciiString -> AsciiString #

revDrop :: Int -> AsciiString -> AsciiString #

splitAt :: Int -> AsciiString -> (AsciiString, AsciiString) #

revSplitAt :: Int -> AsciiString -> (AsciiString, AsciiString) #

splitOn :: (Element AsciiString -> Bool) -> AsciiString -> [AsciiString] #

break :: (Element AsciiString -> Bool) -> AsciiString -> (AsciiString, AsciiString) #

breakElem :: Element AsciiString -> AsciiString -> (AsciiString, AsciiString) #

intersperse :: Element AsciiString -> AsciiString -> AsciiString #

intercalate :: Element AsciiString -> AsciiString -> Element AsciiString #

span :: (Element AsciiString -> Bool) -> AsciiString -> (AsciiString, AsciiString) #

filter :: (Element AsciiString -> Bool) -> AsciiString -> AsciiString #

partition :: (Element AsciiString -> Bool) -> AsciiString -> (AsciiString, AsciiString) #

reverse :: AsciiString -> AsciiString #

uncons :: AsciiString -> Maybe (Element AsciiString, AsciiString) #

unsnoc :: AsciiString -> Maybe (AsciiString, Element AsciiString) #

snoc :: AsciiString -> Element AsciiString -> AsciiString #

cons :: Element AsciiString -> AsciiString -> AsciiString #

find :: (Element AsciiString -> Bool) -> AsciiString -> Maybe (Element AsciiString) #

sortBy :: (Element AsciiString -> Element AsciiString -> Ordering) -> AsciiString -> AsciiString #

singleton :: Element AsciiString -> AsciiString #

head :: NonEmpty AsciiString -> Element AsciiString #

last :: NonEmpty AsciiString -> Element AsciiString #

tail :: NonEmpty AsciiString -> AsciiString #

init :: NonEmpty AsciiString -> AsciiString #

isPrefixOf :: AsciiString -> AsciiString -> Bool #

isSuffixOf :: AsciiString -> AsciiString -> Bool #

Sequential Bitmap # 
Sequential [a] # 

Methods

take :: Int -> [a] -> [a] #

revTake :: Int -> [a] -> [a] #

drop :: Int -> [a] -> [a] #

revDrop :: Int -> [a] -> [a] #

splitAt :: Int -> [a] -> ([a], [a]) #

revSplitAt :: Int -> [a] -> ([a], [a]) #

splitOn :: (Element [a] -> Bool) -> [a] -> [[a]] #

break :: (Element [a] -> Bool) -> [a] -> ([a], [a]) #

breakElem :: Element [a] -> [a] -> ([a], [a]) #

intersperse :: Element [a] -> [a] -> [a] #

intercalate :: Element [a] -> [a] -> Element [a] #

span :: (Element [a] -> Bool) -> [a] -> ([a], [a]) #

filter :: (Element [a] -> Bool) -> [a] -> [a] #

partition :: (Element [a] -> Bool) -> [a] -> ([a], [a]) #

reverse :: [a] -> [a] #

uncons :: [a] -> Maybe (Element [a], [a]) #

unsnoc :: [a] -> Maybe ([a], Element [a]) #

snoc :: [a] -> Element [a] -> [a] #

cons :: Element [a] -> [a] -> [a] #

find :: (Element [a] -> Bool) -> [a] -> Maybe (Element [a]) #

sortBy :: (Element [a] -> Element [a] -> Ordering) -> [a] -> [a] #

singleton :: Element [a] -> [a] #

head :: NonEmpty [a] -> Element [a] #

last :: NonEmpty [a] -> Element [a] #

tail :: NonEmpty [a] -> [a] #

init :: NonEmpty [a] -> [a] #

isPrefixOf :: [a] -> [a] -> Bool #

isSuffixOf :: [a] -> [a] -> Bool #

PrimType ty => Sequential (UArray ty) # 

Methods

take :: Int -> UArray ty -> UArray ty #

revTake :: Int -> UArray ty -> UArray ty #

drop :: Int -> UArray ty -> UArray ty #

revDrop :: Int -> UArray ty -> UArray ty #

splitAt :: Int -> UArray ty -> (UArray ty, UArray ty) #

revSplitAt :: Int -> UArray ty -> (UArray ty, UArray ty) #

splitOn :: (Element (UArray ty) -> Bool) -> UArray ty -> [UArray ty] #

break :: (Element (UArray ty) -> Bool) -> UArray ty -> (UArray ty, UArray ty) #

breakElem :: Element (UArray ty) -> UArray ty -> (UArray ty, UArray ty) #

intersperse :: Element (UArray ty) -> UArray ty -> UArray ty #

intercalate :: Element (UArray ty) -> UArray ty -> Element (UArray ty) #

span :: (Element (UArray ty) -> Bool) -> UArray ty -> (UArray ty, UArray ty) #

filter :: (Element (UArray ty) -> Bool) -> UArray ty -> UArray ty #

partition :: (Element (UArray ty) -> Bool) -> UArray ty -> (UArray ty, UArray ty) #

reverse :: UArray ty -> UArray ty #

uncons :: UArray ty -> Maybe (Element (UArray ty), UArray ty) #

unsnoc :: UArray ty -> Maybe (UArray ty, Element (UArray ty)) #

snoc :: UArray ty -> Element (UArray ty) -> UArray ty #

cons :: Element (UArray ty) -> UArray ty -> UArray ty #

find :: (Element (UArray ty) -> Bool) -> UArray ty -> Maybe (Element (UArray ty)) #

sortBy :: (Element (UArray ty) -> Element (UArray ty) -> Ordering) -> UArray ty -> UArray ty #

singleton :: Element (UArray ty) -> UArray ty #

head :: NonEmpty (UArray ty) -> Element (UArray ty) #

last :: NonEmpty (UArray ty) -> Element (UArray ty) #

tail :: NonEmpty (UArray ty) -> UArray ty #

init :: NonEmpty (UArray ty) -> UArray ty #

isPrefixOf :: UArray ty -> UArray ty -> Bool #

isSuffixOf :: UArray ty -> UArray ty -> Bool #

Sequential (Array ty) # 

Methods

take :: Int -> Array ty -> Array ty #

revTake :: Int -> Array ty -> Array ty #

drop :: Int -> Array ty -> Array ty #

revDrop :: Int -> Array ty -> Array ty #

splitAt :: Int -> Array ty -> (Array ty, Array ty) #

revSplitAt :: Int -> Array ty -> (Array ty, Array ty) #

splitOn :: (Element (Array ty) -> Bool) -> Array ty -> [Array ty] #

break :: (Element (Array ty) -> Bool) -> Array ty -> (Array ty, Array ty) #

breakElem :: Element (Array ty) -> Array ty -> (Array ty, Array ty) #

intersperse :: Element (Array ty) -> Array ty -> Array ty #

intercalate :: Element (Array ty) -> Array ty -> Element (Array ty) #

span :: (Element (Array ty) -> Bool) -> Array ty -> (Array ty, Array ty) #

filter :: (Element (Array ty) -> Bool) -> Array ty -> Array ty #

partition :: (Element (Array ty) -> Bool) -> Array ty -> (Array ty, Array ty) #

reverse :: Array ty -> Array ty #

uncons :: Array ty -> Maybe (Element (Array ty), Array ty) #

unsnoc :: Array ty -> Maybe (Array ty, Element (Array ty)) #

snoc :: Array ty -> Element (Array ty) -> Array ty #

cons :: Element (Array ty) -> Array ty -> Array ty #

find :: (Element (Array ty) -> Bool) -> Array ty -> Maybe (Element (Array ty)) #

sortBy :: (Element (Array ty) -> Element (Array ty) -> Ordering) -> Array ty -> Array ty #

singleton :: Element (Array ty) -> Array ty #

head :: NonEmpty (Array ty) -> Element (Array ty) #

last :: NonEmpty (Array ty) -> Element (Array ty) #

tail :: NonEmpty (Array ty) -> Array ty #

init :: NonEmpty (Array ty) -> Array ty #

isPrefixOf :: Array ty -> Array ty -> Bool #

isSuffixOf :: Array ty -> Array ty -> Bool #

PrimType ty => Sequential (ChunkedUArray ty) # 

Methods

take :: Int -> ChunkedUArray ty -> ChunkedUArray ty #

revTake :: Int -> ChunkedUArray ty -> ChunkedUArray ty #

drop :: Int -> ChunkedUArray ty -> ChunkedUArray ty #

revDrop :: Int -> ChunkedUArray ty -> ChunkedUArray ty #

splitAt :: Int -> ChunkedUArray ty -> (ChunkedUArray ty, ChunkedUArray ty) #

revSplitAt :: Int -> ChunkedUArray ty -> (ChunkedUArray ty, ChunkedUArray ty) #

splitOn :: (Element (ChunkedUArray ty) -> Bool) -> ChunkedUArray ty -> [ChunkedUArray ty] #

break :: (Element (ChunkedUArray ty) -> Bool) -> ChunkedUArray ty -> (ChunkedUArray ty, ChunkedUArray ty) #

breakElem :: Element (ChunkedUArray ty) -> ChunkedUArray ty -> (ChunkedUArray ty, ChunkedUArray ty) #

intersperse :: Element (ChunkedUArray ty) -> ChunkedUArray ty -> ChunkedUArray ty #

intercalate :: Element (ChunkedUArray ty) -> ChunkedUArray ty -> Element (ChunkedUArray ty) #

span :: (Element (ChunkedUArray ty) -> Bool) -> ChunkedUArray ty -> (ChunkedUArray ty, ChunkedUArray ty) #

filter :: (Element (ChunkedUArray ty) -> Bool) -> ChunkedUArray ty -> ChunkedUArray ty #

partition :: (Element (ChunkedUArray ty) -> Bool) -> ChunkedUArray ty -> (ChunkedUArray ty, ChunkedUArray ty) #

reverse :: ChunkedUArray ty -> ChunkedUArray ty #

uncons :: ChunkedUArray ty -> Maybe (Element (ChunkedUArray ty), ChunkedUArray ty) #

unsnoc :: ChunkedUArray ty -> Maybe (ChunkedUArray ty, Element (ChunkedUArray ty)) #

snoc :: ChunkedUArray ty -> Element (ChunkedUArray ty) -> ChunkedUArray ty #

cons :: Element (ChunkedUArray ty) -> ChunkedUArray ty -> ChunkedUArray ty #

find :: (Element (ChunkedUArray ty) -> Bool) -> ChunkedUArray ty -> Maybe (Element (ChunkedUArray ty)) #

sortBy :: (Element (ChunkedUArray ty) -> Element (ChunkedUArray ty) -> Ordering) -> ChunkedUArray ty -> ChunkedUArray ty #

singleton :: Element (ChunkedUArray ty) -> ChunkedUArray ty #

head :: NonEmpty (ChunkedUArray ty) -> Element (ChunkedUArray ty) #

last :: NonEmpty (ChunkedUArray ty) -> Element (ChunkedUArray ty) #

tail :: NonEmpty (ChunkedUArray ty) -> ChunkedUArray ty #

init :: NonEmpty (ChunkedUArray ty) -> ChunkedUArray ty #

isPrefixOf :: ChunkedUArray ty -> ChunkedUArray ty -> Bool #

isSuffixOf :: ChunkedUArray ty -> ChunkedUArray ty -> Bool #

class MutableCollection c where #

Collection of things that can be made mutable, modified and then freezed into an MutableFreezed collection

Minimal complete definition

thaw, freeze, mutNew, mutWrite, mutRead, mutUnsafeWrite, mutUnsafeRead

Associated Types

type MutableFreezed c #

type MutableKey c #

type MutableValue c #

Methods

unsafeThaw :: PrimMonad prim => MutableFreezed c -> prim (c (PrimState prim)) #

unsafeFreeze :: PrimMonad prim => c (PrimState prim) -> prim (MutableFreezed c) #

thaw :: PrimMonad prim => MutableFreezed c -> prim (c (PrimState prim)) #

freeze :: PrimMonad prim => c (PrimState prim) -> prim (MutableFreezed c) #

mutNew :: PrimMonad prim => Int -> prim (c (PrimState prim)) #

mutUnsafeWrite :: PrimMonad prim => c (PrimState prim) -> MutableKey c -> MutableValue c -> prim () #

mutWrite :: PrimMonad prim => c (PrimState prim) -> MutableKey c -> MutableValue c -> prim () #

mutUnsafeRead :: PrimMonad prim => c (PrimState prim) -> MutableKey c -> prim (MutableValue c) #

mutRead :: PrimMonad prim => c (PrimState prim) -> MutableKey c -> prim (MutableValue c) #

Instances

MutableCollection MutableBitmap # 
PrimType ty => MutableCollection (MUArray ty) # 

Associated Types

type MutableFreezed (MUArray ty :: * -> *) :: * #

type MutableKey (MUArray ty :: * -> *) :: * #

type MutableValue (MUArray ty :: * -> *) :: * #

Methods

unsafeThaw :: PrimMonad prim => MutableFreezed (MUArray ty) -> prim (MUArray ty (PrimState prim)) #

unsafeFreeze :: PrimMonad prim => MUArray ty (PrimState prim) -> prim (MutableFreezed (MUArray ty)) #

thaw :: PrimMonad prim => MutableFreezed (MUArray ty) -> prim (MUArray ty (PrimState prim)) #

freeze :: PrimMonad prim => MUArray ty (PrimState prim) -> prim (MutableFreezed (MUArray ty)) #

mutNew :: PrimMonad prim => Int -> prim (MUArray ty (PrimState prim)) #

mutUnsafeWrite :: PrimMonad prim => MUArray ty (PrimState prim) -> MutableKey (MUArray ty) -> MutableValue (MUArray ty) -> prim () #

mutWrite :: PrimMonad prim => MUArray ty (PrimState prim) -> MutableKey (MUArray ty) -> MutableValue (MUArray ty) -> prim () #

mutUnsafeRead :: PrimMonad prim => MUArray ty (PrimState prim) -> MutableKey (MUArray ty) -> prim (MutableValue (MUArray ty)) #

mutRead :: PrimMonad prim => MUArray ty (PrimState prim) -> MutableKey (MUArray ty) -> prim (MutableValue (MUArray ty)) #

MutableCollection (MArray ty) # 

Associated Types

type MutableFreezed (MArray ty :: * -> *) :: * #

type MutableKey (MArray ty :: * -> *) :: * #

type MutableValue (MArray ty :: * -> *) :: * #

Methods

unsafeThaw :: PrimMonad prim => MutableFreezed (MArray ty) -> prim (MArray ty (PrimState prim)) #

unsafeFreeze :: PrimMonad prim => MArray ty (PrimState prim) -> prim (MutableFreezed (MArray ty)) #

thaw :: PrimMonad prim => MutableFreezed (MArray ty) -> prim (MArray ty (PrimState prim)) #

freeze :: PrimMonad prim => MArray ty (PrimState prim) -> prim (MutableFreezed (MArray ty)) #

mutNew :: PrimMonad prim => Int -> prim (MArray ty (PrimState prim)) #

mutUnsafeWrite :: PrimMonad prim => MArray ty (PrimState prim) -> MutableKey (MArray ty) -> MutableValue (MArray ty) -> prim () #

mutWrite :: PrimMonad prim => MArray ty (PrimState prim) -> MutableKey (MArray ty) -> MutableValue (MArray ty) -> prim () #

mutUnsafeRead :: PrimMonad prim => MArray ty (PrimState prim) -> MutableKey (MArray ty) -> prim (MutableValue (MArray ty)) #

mutRead :: PrimMonad prim => MArray ty (PrimState prim) -> MutableKey (MArray ty) -> prim (MutableValue (MArray ty)) #

class IndexedCollection c where #

Collection of elements that can indexed by int

Minimal complete definition

(!), findIndex

Methods

(!) :: c -> Int -> Maybe (Element c) #

findIndex :: (Element c -> Bool) -> c -> Maybe Int #

Instances

class KeyedCollection c where #

Collection of things that can be looked up by Key

Minimal complete definition

lookup

Associated Types

type Key c #

type Value c #

Methods

lookup :: Key c -> c -> Maybe (Value c) #

Instances

Eq k => KeyedCollection [(k, v)] # 

Associated Types

type Key [(k, v)] :: * #

type Value [(k, v)] :: * #

Methods

lookup :: Key [(k, v)] -> [(k, v)] -> Maybe (Value [(k, v)]) #

class Sequential col => Zippable col where #

Methods

zipWith :: (Sequential a, Sequential b) => (Element a -> Element b -> Element col) -> a -> b -> col #

zipWith generalises zip by zipping with the function given as the first argument, instead of a tupling function. For example, zipWith (+) is applied to two collections to produce the collection of corresponding sums.

zipWith3 :: (Sequential a, Sequential b, Sequential c) => (Element a -> Element b -> Element c -> Element col) -> a -> b -> c -> col #

Like zipWith, but works with 3 collections.

zipWith4 :: (Sequential a, Sequential b, Sequential c, Sequential d) => (Element a -> Element b -> Element c -> Element d -> Element col) -> a -> b -> c -> d -> col #

Like zipWith, but works with 4 collections.

zipWith5 :: (Sequential a, Sequential b, Sequential c, Sequential d, Sequential e) => (Element a -> Element b -> Element c -> Element d -> Element e -> Element col) -> a -> b -> c -> d -> e -> col #

Like zipWith, but works with 5 collections.

zipWith6 :: (Sequential a, Sequential b, Sequential c, Sequential d, Sequential e, Sequential f) => (Element a -> Element b -> Element c -> Element d -> Element e -> Element f -> Element col) -> a -> b -> c -> d -> e -> f -> col #

Like zipWith, but works with 6 collections.

zipWith7 :: (Sequential a, Sequential b, Sequential c, Sequential d, Sequential e, Sequential f, Sequential g) => (Element a -> Element b -> Element c -> Element d -> Element e -> Element f -> Element g -> Element col) -> a -> b -> c -> d -> e -> f -> g -> col #

Like zipWith, but works with 7 collections.

Instances

Zippable String # 

Methods

zipWith :: (Sequential a, Sequential b) => (Element a -> Element b -> Element String) -> a -> b -> String #

zipWith3 :: (Sequential a, Sequential b, Sequential c) => (Element a -> Element b -> Element c -> Element String) -> a -> b -> c -> String #

zipWith4 :: (Sequential a, Sequential b, Sequential c, Sequential d) => (Element a -> Element b -> Element c -> Element d -> Element String) -> a -> b -> c -> d -> String #

zipWith5 :: (Sequential a, Sequential b, Sequential c, Sequential d, Sequential e) => (Element a -> Element b -> Element c -> Element d -> Element e -> Element String) -> a -> b -> c -> d -> e -> String #

zipWith6 :: (Sequential a, Sequential b, Sequential c, Sequential d, Sequential e, Sequential f) => (Element a -> Element b -> Element c -> Element d -> Element e -> Element f -> Element String) -> a -> b -> c -> d -> e -> f -> String #

zipWith7 :: (Sequential a, Sequential b, Sequential c, Sequential d, Sequential e, Sequential f, Sequential g) => (Element a -> Element b -> Element c -> Element d -> Element e -> Element f -> Element g -> Element String) -> a -> b -> c -> d -> e -> f -> g -> String #

Zippable AsciiString # 

Methods

zipWith :: (Sequential a, Sequential b) => (Element a -> Element b -> Element AsciiString) -> a -> b -> AsciiString #

zipWith3 :: (Sequential a, Sequential b, Sequential c) => (Element a -> Element b -> Element c -> Element AsciiString) -> a -> b -> c -> AsciiString #

zipWith4 :: (Sequential a, Sequential b, Sequential c, Sequential d) => (Element a -> Element b -> Element c -> Element d -> Element AsciiString) -> a -> b -> c -> d -> AsciiString #

zipWith5 :: (Sequential a, Sequential b, Sequential c, Sequential d, Sequential e) => (Element a -> Element b -> Element c -> Element d -> Element e -> Element AsciiString) -> a -> b -> c -> d -> e -> AsciiString #

zipWith6 :: (Sequential a, Sequential b, Sequential c, Sequential d, Sequential e, Sequential f) => (Element a -> Element b -> Element c -> Element d -> Element e -> Element f -> Element AsciiString) -> a -> b -> c -> d -> e -> f -> AsciiString #

zipWith7 :: (Sequential a, Sequential b, Sequential c, Sequential d, Sequential e, Sequential f, Sequential g) => (Element a -> Element b -> Element c -> Element d -> Element e -> Element f -> Element g -> Element AsciiString) -> a -> b -> c -> d -> e -> f -> g -> AsciiString #

Zippable [c] # 

Methods

zipWith :: (Sequential a, Sequential b) => (Element a -> Element b -> Element [c]) -> a -> b -> [c] #

zipWith3 :: (Sequential a, Sequential b, Sequential c) => (Element a -> Element b -> Element c -> Element [c]) -> a -> b -> c -> [c] #

zipWith4 :: (Sequential a, Sequential b, Sequential c, Sequential d) => (Element a -> Element b -> Element c -> Element d -> Element [c]) -> a -> b -> c -> d -> [c] #

zipWith5 :: (Sequential a, Sequential b, Sequential c, Sequential d, Sequential e) => (Element a -> Element b -> Element c -> Element d -> Element e -> Element [c]) -> a -> b -> c -> d -> e -> [c] #

zipWith6 :: (Sequential a, Sequential b, Sequential c, Sequential d, Sequential e, Sequential f) => (Element a -> Element b -> Element c -> Element d -> Element e -> Element f -> Element [c]) -> a -> b -> c -> d -> e -> f -> [c] #

zipWith7 :: (Sequential a, Sequential b, Sequential c, Sequential d, Sequential e, Sequential f, Sequential g) => (Element a -> Element b -> Element c -> Element d -> Element e -> Element f -> Element g -> Element [c]) -> a -> b -> c -> d -> e -> f -> g -> [c] #

PrimType ty => Zippable (UArray ty) # 

Methods

zipWith :: (Sequential a, Sequential b) => (Element a -> Element b -> Element (UArray ty)) -> a -> b -> UArray ty #

zipWith3 :: (Sequential a, Sequential b, Sequential c) => (Element a -> Element b -> Element c -> Element (UArray ty)) -> a -> b -> c -> UArray ty #

zipWith4 :: (Sequential a, Sequential b, Sequential c, Sequential d) => (Element a -> Element b -> Element c -> Element d -> Element (UArray ty)) -> a -> b -> c -> d -> UArray ty #

zipWith5 :: (Sequential a, Sequential b, Sequential c, Sequential d, Sequential e) => (Element a -> Element b -> Element c -> Element d -> Element e -> Element (UArray ty)) -> a -> b -> c -> d -> e -> UArray ty #

zipWith6 :: (Sequential a, Sequential b, Sequential c, Sequential d, Sequential e, Sequential f) => (Element a -> Element b -> Element c -> Element d -> Element e -> Element f -> Element (UArray ty)) -> a -> b -> c -> d -> e -> f -> UArray ty #

zipWith7 :: (Sequential a, Sequential b, Sequential c, Sequential d, Sequential e, Sequential f, Sequential g) => (Element a -> Element b -> Element c -> Element d -> Element e -> Element f -> Element g -> Element (UArray ty)) -> a -> b -> c -> d -> e -> f -> g -> UArray ty #

Zippable (Array ty) # 

Methods

zipWith :: (Sequential a, Sequential b) => (Element a -> Element b -> Element (Array ty)) -> a -> b -> Array ty #

zipWith3 :: (Sequential a, Sequential b, Sequential c) => (Element a -> Element b -> Element c -> Element (Array ty)) -> a -> b -> c -> Array ty #

zipWith4 :: (Sequential a, Sequential b, Sequential c, Sequential d) => (Element a -> Element b -> Element c -> Element d -> Element (Array ty)) -> a -> b -> c -> d -> Array ty #

zipWith5 :: (Sequential a, Sequential b, Sequential c, Sequential d, Sequential e) => (Element a -> Element b -> Element c -> Element d -> Element e -> Element (Array ty)) -> a -> b -> c -> d -> e -> Array ty #

zipWith6 :: (Sequential a, Sequential b, Sequential c, Sequential d, Sequential e, Sequential f) => (Element a -> Element b -> Element c -> Element d -> Element e -> Element f -> Element (Array ty)) -> a -> b -> c -> d -> e -> f -> Array ty #

zipWith7 :: (Sequential a, Sequential b, Sequential c, Sequential d, Sequential e, Sequential f, Sequential g) => (Element a -> Element b -> Element c -> Element d -> Element e -> Element f -> Element g -> Element (Array ty)) -> a -> b -> c -> d -> e -> f -> g -> Array ty #

class Buildable col where #

Collections that can be built chunk by chunk.

Use the Monad instance of Builder to chain append operations and feed it into build:

>>> runST $ build 32 (append 'a' >> append 'b' >> append 'c') :: UArray Char
"abc"

Minimal complete definition

append, build

Associated Types

type Mutable col :: * -> * #

Mutable collection type used for incrementally writing chunks.

type Step col #

Unit of the smallest step possible in an append operation.

A UTF-8 character can have a size between 1 and 4 bytes, so this should be defined as 1 byte for collections of Char.

Methods

append :: PrimMonad prim => Element col -> Builder col (Mutable col) (Step col) prim () #

build :: PrimMonad prim => Int -> Builder col (Mutable col) (Step col) prim () -> prim col #

Instances

Buildable String # 

Associated Types

type Mutable String :: * -> * #

type Step String :: * #

Methods

append :: PrimMonad prim => Element String -> Builder String (Mutable String) (Step String) prim () #

build :: PrimMonad prim => Int -> Builder String (Mutable String) (Step String) prim () -> prim String #

PrimType ty => Buildable (UArray ty) # 

Associated Types

type Mutable (UArray ty) :: * -> * #

type Step (UArray ty) :: * #

Methods

append :: PrimMonad prim => Element (UArray ty) -> Builder (UArray ty) (Mutable (UArray ty)) (Step (UArray ty)) prim () #

build :: PrimMonad prim => Int -> Builder (UArray ty) (Mutable (UArray ty)) (Step (UArray ty)) prim () -> prim (UArray ty) #

Buildable (Array ty) # 

Associated Types

type Mutable (Array ty) :: * -> * #

type Step (Array ty) :: * #

Methods

append :: PrimMonad prim => Element (Array ty) -> Builder (Array ty) (Mutable (Array ty)) (Step (Array ty)) prim () #

build :: PrimMonad prim => Int -> Builder (Array ty) (Mutable (Array ty)) (Step (Array ty)) prim () -> prim (Array ty) #

newtype Builder collection mutCollection step state a #

Constructors

Builder 

Fields

Instances

Monad state => Monad (Builder collection mutCollection step state) # 

Methods

(>>=) :: Builder collection mutCollection step state a -> (a -> Builder collection mutCollection step state b) -> Builder collection mutCollection step state b #

(>>) :: Builder collection mutCollection step state a -> Builder collection mutCollection step state b -> Builder collection mutCollection step state b #

return :: a -> Builder collection mutCollection step state a #

fail :: String -> Builder collection mutCollection step state a #

Monad state => Functor (Builder collection mutCollection step state) # 

Methods

fmap :: (a -> b) -> Builder collection mutCollection step state a -> Builder collection mutCollection step state b #

(<$) :: a -> Builder collection mutCollection step state b -> Builder collection mutCollection step state a #

Monad state => Applicative (Builder collection mutCollection step state) # 

Methods

pure :: a -> Builder collection mutCollection step state a #

(<*>) :: Builder collection mutCollection step state (a -> b) -> Builder collection mutCollection step state a -> Builder collection mutCollection step state b #

(*>) :: Builder collection mutCollection step state a -> Builder collection mutCollection step state b -> Builder collection mutCollection step state b #

(<*) :: Builder collection mutCollection step state a -> Builder collection mutCollection step state b -> Builder collection mutCollection step state a #

data BuildingState collection mutCollection step state #

The in-progress state of a building operation.

The previous buffers are in reverse order, and this contains the current buffer and the state of progress packing the elements inside.

Constructors

BuildingState 

Fields

class Copy a where #

Minimal complete definition

copy

Methods

copy :: a -> a #

Instances

Copy String # 

Methods

copy :: String -> String #

Copy [ty] # 

Methods

copy :: [ty] -> [ty] #

PrimType ty => Copy (UArray ty) # 

Methods

copy :: UArray ty -> UArray ty #

Copy (Array ty) # 

Methods

copy :: Array ty -> Array ty #