Module Relude_Tree
type t('a)
=
{
value: 'a,
children: list(t('a)),
}
;A non-empty multi-way (aka "rose") tree which contains a "top" value and a list of child trees.
let pure: a. 'a => t('a);
Constructs a tree containing a single value
let singleton: 'a => t('a);
Alias for pure
let isSingleton: a. t('a) => bool;
Checks if this tree contains a single item
let unmake: a. t('a) => ('a, list(t('a)));
Destructures a tree into a tuple of the value and children
let fill: a. ('a => list('a)) => 'a => t('a);
Creates a tree using a seed value and a function to produce child seed values
let getValue: a. t('a) => 'a;
Gets the top value of the tree
let setChildren: a. list(t('a)) => t('a) => t('a);
Replaces all the children with the given list of new children
let modifyChildren: a. (list(t('a)) => list(t('a))) => t('a) => t('a);
Modifies the children using the given function
let prependChildren: a. list(t('a)) => t('a) => t('a);
Prepends new children to the left side of the existing children
let appendChildren: a. list(t('a)) => t('a) => t('a);
Appends new children to the right side of the existing children
let toNonEmptyList: a. t('a) => Relude_NonEmpty.List.t('a);
Dumps the tree to a flattened non-empty list, with the top value first, proceeding downward and left-to-right
let toNonEmptyArray: a. t('a) => Relude_NonEmpty.Array.t('a);
Dumps the tree to a flattened non-empty array, with the top value first, proceeding downward and left-to-right
let zipWith: a b c. ('a => 'b => 'c) => t('a) => t('b) => t('c);
Zips two tree together position-by-position using the given function
let zip: a b. t('a) => t('b) => t(('a, 'b));
Zips two tree together position-by-position to make a tree of tuples
include { ... };
module BsFunctorExtensions: { ... };
let apply: a b. t(('a => 'b)) => t('a) => t('b);
Applies a tree of functions to a tree of values position-by-position, trimming off non-matching branches.
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);
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));
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);
include { ... };
include { ... };
let foldLeft: a b. ('b => 'a => 'b) => 'b => t('a) => 'b;
Folds a tree from left to right, depth first
let foldRight: a b. ('a => 'b => 'b) => 'b => t('a) => 'b;
Folds a tree from right to left, depth first
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) => { ... };
let unfold: a. ('a => option(('a, 'a))) => 'a => t('a);
module Unfoldable: BsBastet.Interface.UNFOLDABLE with type Unfoldable.t('a) = t('a);
include { ... };
module WithApplicative: (A: BsBastet.Interface.APPLICATIVE) => { ... };
let filter: a. ('a => bool) => t('a) => option(t('a));
Filters the tree to only contain values which pass the given predicate. If a value doesn't pass the predicate, the entire subtree is trimmed.
let showBy: a. ('a => string) => t('a) => string;
Shows a tree using the given function for the contained values
module type SHOW_F = (ShowA: BsBastet.Interface.SHOW) => BsBastet.Interface.SHOW with type SHOW_F.t = t(ShowA.t);
module Show: SHOW_F;
let showPrettyBy: a. ('a => string) => t('a) => string;
module ShowPretty: SHOW_F;
let eqBy: a. ('a => 'a => bool) => t('a) => t('a) => bool;
Compares two trees for quality using the given function
module type EQ_F = (EqA: BsBastet.Interface.EQ) => BsBastet.Interface.EQ with type EQ_F.t = t(EqA.t);
module Eq: EQ_F;