Module Relude_Identity
Relude.Identity is a type which is useful for acting as an identity Functor, Monad, etc. in cases where you need to provide such a thing, but you don't need any extra effects or behavior.
A common use of Identity is to create a plain Reader monad from a ReaderT transformer by using the Identity monad as the ReaderT monad type. You can see this technique in action in Relude_ReaderT and Relude_OptionT.
type t('a)= 'a;The identity type. This is useful for contexts that require a type constructor, but you don't actually need any extra functionality.
let wrap: a. 'a => t('a);Lifts a pure value in the Identity context.
let unwrap: a. t('a) => 'a;Unwraps a value in the Identity context.
let map: a b. ('a => 'b) => t('a) => t('b);Maps a pure function over the value contained in the Identity.
include { ... };
module BsFunctorExtensions: { ... };let apply: a b. t(('a => 'b)) => t('a) => t('b);Applies a wrapped function to the value contained in the Identity.
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. 'a => t('a);Lifts a pure value into the Identity.
Alias for
wrap
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 the value contained in the Identity context.
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 eq: (module BsBastet.Interface.EQ with type t = 'a) => t('a) => t('a) => bool;Indicates if two Identity values are equal
let eqBy: (t(t('a)) => t(t('a)) => bool) => t(t(t('a))) => t(t(t('a))) => bool;Indicates if two Identity values are equal using the given equality function
module Eq: EQ_F;let show: (module BsBastet.Interface.SHOW with type t = 'a) => t('a) => string;Converts the Identity value to a string, using the given SHOW module
let showBy: a. ('a => string) => t('a) => string;Converts the Identity value to a string, using the given show function
module type SHOW_F = (S: BsBastet.Interface.SHOW) => BsBastet.Interface.SHOW with type SHOW_F.t = t(S.t);module Show: SHOW_F;