import type { Kind, TypeLambda } from "effect/HKT"; import type { Invariant } from "./Invariant.js"; /** * @category type class * @since 0.24.0 */ export interface Covariant extends Invariant { readonly map: { (f: (a: A) => B): (self: Kind) => Kind; (self: Kind, f: (a: A) => B): Kind; }; } /** * Returns a default `map` composition. * * @since 0.24.0 */ export declare const mapComposition: (F: Covariant, G: Covariant) => (self: Kind>, f: (a: A) => B) => Kind>; /** * Returns a default `imap` implementation. * * @since 0.24.0 */ export declare const imap: (map: (self: Kind, f: (a: A) => B) => Kind) => Invariant["imap"]; /** * @category mapping * @since 0.24.0 */ export declare const flap: (F: Covariant) => { (self: Kind B>): (a: A) => Kind; (a: A_1, self: Kind B_1>): Kind; }; /** * @category mapping * @since 0.24.0 */ export declare const as: (F: Covariant) => { (b: B): (self: Kind) => Kind; (self: Kind, b: B): Kind; }; /** * @category mapping * @since 0.24.0 */ export declare const asVoid: (F: Covariant) => (self: Kind) => Kind; declare const let_: (F: Covariant) => { (name: Exclude, f: (a: A) => B): (self: Kind) => Kind; (self: Kind, name: Exclude, f: (a: A_1) => B_1): Kind; }; export { /** * **Example** * * ```ts * import * as covariant from "@effect/typeclass/Covariant" * import type { HKT } from "effect" * import { dual, pipe } from "effect/Function" * * interface MyData { * readonly value: A * } * * interface MyDataTypeLambda extends HKT.TypeLambda { * readonly type: MyData * } * * const map: covariant.Covariant["map"] = dual( * 2, * (self: MyData, f: (a: A) => B): MyData => ({ value: f(self.value) }) * ) * * const Covariant: covariant.Covariant = { imap: covariant.imap(map), map } * * const notation = { * Do: { value: {} } as MyData<{}>, * let: covariant.let(Covariant) * } * * console.log(pipe(notation.Do, notation.let("foo", () => "bar"))) * // { value: { foo: "bar" } } * ``` * * @category do notation * @since 0.24.0 */ let_ as let }; //# sourceMappingURL=Covariant.d.ts.map