red-g / accumulate / Split

Extract elements from collections.

Splitters


type Splitter a b

Tries to split an element a off of b.

Manipulations

custom : (b -> Maybe ( a, b )) -> Splitter a b

Create a splitter that tries to take an element a off of b.

take : (a -> b -> c) -> Splitter a b -> b -> Maybe c

Try to split an item off a collection, applying the given function on success.

Primitives

arrayEnd : Splitter a (Array a)

Split off the end of an array.

arrayStart : Splitter a (Array a)

Split off the start of an array.

listHead : Splitter a (List a)

Split off the head of a list.

stringHead : Splitter Char String

Split off the head of a string.