Module Relude_NonEmpty.WithSequence
Creates a NonEmpty module with the given SEQUENCE module to handle the tail part.
Parameters
TailSequence: Relude_Interface.SEQUENCE
Signature
type t('a)
=
;|
NonEmpty('a, TailSequence.t('a))
The type of a non-empty sequence of values
let one: a. 'a => t('a);
Creates a NonEmpty with a single value
let make: a. 'a => TailSequence.t('a) => t('a);
Constructs a NonEmpty with the given head and tail values
let fromSequence: a. TailSequence.t('a) => option(t('a));
Converts the non-empty Sequence into a NonEmpty value. This operation can fail with None if the Sequence is empty.
let toSequence: a. t('a) => TailSequence.t('a);
Converts the NonEmpty value into a Sequence. This operation cannot fail.
let fromList: a. list('a) => option(t('a));
Converts a list to a NonEmpty, failing if the list is empty
let fromArray: a. array('a) => option(t('a));
Converts an array to a NonEmpty, failing if the list is empty
let uncons: a. t('a) => ('a, TailSequence.t('a));
Splits the NonEmpty into head and tail parts. This operation cannot fail because we are guaranteed to have a head value.
let head: a. t('a) => 'a;
Gets the head value from the NonEmpty. This operation cannot fail because we are guaranteed to have a head value.
let tail: a. t('a) => TailSequence.t('a);
Gets the tail of a NonEmpty. The tail of a NonEmpty can be an empty sequence.
let concat: a. t('a) => t('a) => t('a);
Concatenates two NonEmpty values, with the left side first and the right side last.
module SemigroupAny: BsBastet.Interface.SEMIGROUP_ANY with type SemigroupAny.t('a) = t('a);
include { ... };
let concatNamed: prefix:SemigroupAny.t('a) => SemigroupAny.t('a) => SemigroupAny.t('a);
let reduceLeft: a. ('a => 'a => 'a) => t('a) => 'a;
Reduces the NonEmpty to a single accumulator value, using the head as the initial accumulator, and running the function for the remaining items.
let foldLeft: a b. ('b => 'a => 'b) => 'b => t('a) => 'b;
Folds the NonEmpty to a single accumulator value, using the given starter value.
let foldRight: a b. ('a => 'b => 'b) => 'b => t('a) => 'b;
Folds the NonEmpty to a single accumulator value, using the given starter value.
include { ... };
module BsFoldableExtensions: { ... };
let any: ('a => bool) => Foldable.t('a) => bool;
let all: ('a => bool) => Foldable.t('a) => bool;
let containsBy: ('a => 'a => bool) => 'a => Foldable.t('a) => bool;
let contains: (module BsBastet.Interface.EQ with type t = 'a) => 'a => Foldable.t('a) => bool;
let indexOfBy: ('a => 'a => bool) => 'a => Foldable.t('a) => option(int);
let indexOf: (module BsBastet.Interface.EQ with type t = 'a) => 'a => Foldable.t('a) => option(int);
let minBy: ('a => 'a => BsBastet.Interface.ordering) => Foldable.t('a) => option('a);
let min: (module BsBastet.Interface.ORD with type t = 'a) => Foldable.t('a) => option('a);
let maxBy: ('a => 'a => BsBastet.Interface.ordering) => Foldable.t('a) => option('a);
let max: (module BsBastet.Interface.ORD with type t = 'a) => Foldable.t('a) => option('a);
let countBy: ('a => bool) => Foldable.t('a) => int;
let length: Foldable.t('a) => int;
let size: Foldable.t('a) => int;
let count: Foldable.t('a) => int;
let forEach: ('a => unit) => Foldable.t('a) => unit;
let forEachWithIndex: ('a => int => unit) => Foldable.t('a) => unit;
let find: ('a => bool) => Foldable.t('a) => option('a);
let findWithIndex: ('a => int => bool) => Foldable.t('a) => option('a);
let toList: Foldable.t('a) => list('a);
let toArray: Foldable.t('a) => array('a);
module FoldableSemigroupExtensions: (S: BsBastet.Interface.SEMIGROUP) => { ... };
module FoldableMonoidExtensions: (M: BsBastet.Interface.MONOID) => { ... };
let foldMap: (module BsBastet.Interface.MONOID with type t = 'a) => ('b => 'a) => Foldable.t('b) => 'a;
let foldWithMonoid: (module BsBastet.Interface.MONOID with type t = 'a) => Foldable.t('a) => 'a;
let intercalate: (module BsBastet.Interface.MONOID with type t = 'a) => 'a => Foldable.t('a) => 'a;
module FoldableApplicativeExtensions: (A: BsBastet.Interface.APPLICATIVE) => { ... };
module FoldableMonadExtensions: (M: BsBastet.Interface.MONAD) => { ... };
module FoldableEqExtensions: (E: BsBastet.Interface.EQ) => { ... };
module FoldableOrdExtensions: (O: BsBastet.Interface.ORD) => { ... };
include { ... };
module BsFunctorExtensions: { ... };
let apply: a b. t(('a => 'b)) => t('a) => t('b);
Applies a NonEmpty sequence of function to a NonEmpty sequence of values
include { ... };
module BsApplyExtensions: { ... };
let applyFirst: Apply.t('a) => Apply.t('b) => Apply.t('a);
let applySecond: Apply.t('a) => Apply.t('b) => Apply.t('b);
let map2: ('a => 'b => 'c) => Apply.t('a) => Apply.t('b) => Apply.t('c);
let map3: ('a => 'b => 'c => 'd) => Apply.t('a) => Apply.t('b) => Apply.t('c) => Apply.t('d);
let map4: ('a => 'b => 'c => 'd => 'e) => Apply.t('a) => Apply.t('b) => Apply.t('c) => Apply.t('d) => Apply.t('e);
let map5: ('a => 'b => 'c => 'd => 'e => 'f) => Apply.t('a) => Apply.t('b) => Apply.t('c) => Apply.t('d) => Apply.t('e) => Apply.t('f);
let tuple2: Apply.t('a) => Apply.t('b) => Apply.t(('a, 'b));
let tuple3: Apply.t('a) => Apply.t('b) => Apply.t('c) => Apply.t(('a, 'b, 'c));
let tuple4: Apply.t('a) => Apply.t('b) => Apply.t('c) => Apply.t('d) => Apply.t(('a, 'b, 'c, 'd));
let tuple5: Apply.t('a) => Apply.t('b) => Apply.t('c) => Apply.t('d) => Apply.t('e) => Apply.t(('a, 'b, 'c, 'd, 'e));
let mapTuple2: ('a => 'b => 'c) => (Apply.t('a), Apply.t('b)) => Apply.t('c);
let mapTuple3: ('a => 'b => 'c => 'd) => (Apply.t('a), Apply.t('b), Apply.t('c)) => Apply.t('d);
let mapTuple4: ('a => 'b => 'c => 'd => 'e) => (Apply.t('a), Apply.t('b), Apply.t('c), Apply.t('d)) => Apply.t('e);
let mapTuple5: ('a => 'b => 'c => 'd => 'e => 'f) => (Apply.t('a), Apply.t('b), Apply.t('c), Apply.t('d), Apply.t('e)) => Apply.t('f);
let pure: 'a => t('a);
Lifts a single pure value into a NonEmpty of one item
Alias for
one
module Applicative: BsBastet.Interface.APPLICATIVE with type Applicative.t('a) = t('a);
include { ... };
module BsApplicativeExtensions: { ... };
let liftA1: ('a => 'b) => Applicative.t('a) => Applicative.t('b);
let when_: bool => Applicative.t(unit) => Applicative.t(unit);
let unless: bool => Applicative.t(unit) => Applicative.t(unit);
let all: list(Applicative.t('a)) => Applicative.t(list('a));
let bind: a b. t('a) => ('a => t('b)) => t('b);
Applies a monadic function to a NonEmpty sequence of values
include { ... };
module BsMonadExtensions: { ... };
let flatMap: ('a => Monad.t('b)) => Monad.t('a) => Monad.t('b);
let flatten: Monad.t(Monad.t('a)) => Monad.t('a);
let composeKleisli: ('a => Monad.t('b)) => ('b => Monad.t('c)) => 'a => Monad.t('c);
let flipComposeKleisli: ('b => Monad.t('c)) => ('a => Monad.t('b)) => 'a => Monad.t('c);
let liftM1: ('a => 'b) => Monad.t('a) => Monad.t('b);
let when_: Monad.t(bool) => Monad.t(unit) => Monad.t(unit);
let unless: Monad.t(bool) => Monad.t(unit) => Monad.t(unit);
let mkString: string => t(string) => string;
Converts the non-empty into a string delimited by the given string
let eqBy: a. ('a => 'a => bool) => t('a) => t('a) => bool;
Indicates if two NonEmpty sequences are pair-wise equal
let eq: (module BsBastet.Interface.EQ with type t = 'a) => t('a) => t('a) => bool;
Indicates if two NonEmpty sequences are pair-wise equal using the given EQ module
module type EQ_F = (EqA: BsBastet.Interface.EQ) => BsBastet.Interface.EQ with type EQ_F.t = t(EqA.t);
module Eq: EQ_F;
let showBy: a. ('a => string) => t('a) => string;
Converts a NonEmpty to a string using the given show function
let show: (module BsBastet.Interface.SHOW with type t = 'a) => t('a) => string;
Converts a NonEmpty to a string using the given SHOW module
module type SHOW_F = (S: BsBastet.Interface.SHOW) => BsBastet.Interface.SHOW with type SHOW_F.t = t(S.t);
module Show: SHOW_F;
module WithApplicative: (A: BsBastet.Interface.APPLICATIVE) => { ... };
NonEmpty extensions when you have an APPLICATIVE instance