/** * A Box type that encapsulates a value and provides methods to manipulate it. * 値を包み込み、操作するためのメソッドを提供する Box 型。 */ export type Box = { readonly isBox: true; /** * Applies a function to the value inside the Box and returns a new Box. * Box 内の値に関数を適用し、新しい Box を返します。 * @param fn - A function to apply to the Box value. / Box の値に適用する関数。 */ readonly map: (fn: (value: T) => U) => Box; /** * Applies a function to the value inside the Box and returns a new Box. * Alias for `map`. * Box 内の値に関数を適用し、新しい Box を返します。 * `map` のエイリアス。 * @param fn - A function to apply to the Box value. / Box の値に適用する関数。 */ readonly "<$>": (fn: (value: T) => U) => Box; /** * Applies a boxed function to a boxed value and returns a new Box. * Box に包まれた関数を別の Box に適用し、新しい Box を返します。 * @param boxValue - A Box containing a value to apply the function to. * / 関数を適用する値を含む Box。 */ readonly apply: (this: Box<(a: A) => B>, boxValue: Box) => Box; /** * Applies a boxed function to a boxed value and returns a new Box. * Alias for `apply`. * Box に包まれた関数を別の Box に適用し、新しい Box を返します。 * `apply` のエイリアス。 * @param boxValue - A Box containing a value to apply the function to. * / 関数を適用する値を含む Box。 */ readonly "<*>": (this: Box<(a: A) => B>, boxValue: Box) => Box; /** * Applies a function that returns a Box to the value inside this Box and flattens the result. * Box 内の値に Box を返す関数を適用し、その結果を平坦化して返します。 * @param fn - A function that returns a Box. / Box を返す関数。 */ readonly flatMap: (fn: (value: T) => Box) => Box; /** * Applies a function that returns a Box to the value inside this Box and flattens the result. * Alias for `flatMap`. * Box 内の値に Box を返す関数を適用し、その結果を平坦化して返します。 * `flatMap` のエイリアス。 * @param fn - A function that returns a Box. / Box を返す関数。 */ readonly ">>=": (fn: (value: T) => Box) => Box; /** * Gets the value inside the Box. * Box 内の値を取得します。 */ readonly getValue: () => T; }; /** * Adapter type for Do's `$` parameter. * `$` は `yield* $(Box.pack(...))` のためのアダプタ関数です。 */ export type $Box = (fa: Box) => Generator; /** * Creates a new Box containing the given value. * 指定された値を含む新しい Box を作成します。 * @param value - The value to encapsulate. / 包み込む値。 */ declare const box: (value: T) => Box; /** * Checks if the given value is a Box. * 指定された値が Box かどうかを判定します。 * @param value - The value to check. / 判定する値。 */ export declare const isBox: (value: any) => value is Box; declare function Do(generatorFunc: () => Generator, U | Box, T>): Box; declare function Do(g: ($: (fa: Box) => Generator) => Generator): Box; /** * Box utility object containing helpers like `pack` and `isBox`. * `pack` や `isBox` を含む Box ユーティリティオブジェクト。 */ export declare const Box: { do: typeof Do; pack: typeof box; isBox: typeof isBox; }; export {};