import type { Either } from "../Either"; import type { FunctionN, Lazy, Predicate, Refinement } from "../Function"; import type { Option } from "./model"; /** * ```haskell * nothing :: () -> Nothing * ``` * * Constructs a new `Maybe` holding no value (a.k.a `Nothing`) * * @category Constructors * @since 1.0.0 */ export declare const none: () => Option; /** * ```haskell * just :: a -> Just a * ``` * * Constructs a new `Maybe` holding a `Just` value. * * @category Constructs * @since 1.0.0 */ export declare const some: (a: A) => Option; /** * ```haskell * fromNullable :: ?a -> Maybe a * ``` * * Constructs a new `Maybe` from a nullable value. If the value is `null` or `undefined`, returns `Nothing`, otherwise * returns the value wrapped in a `Just` * * @category Constructors * @since 1.0.0 */ export declare const fromNullable: (a: A | null | undefined) => Option>; /** * ```haskell * partial :: (() -> a) -> Maybe a * ``` * * Constructs a new `Maybe` from a function that might throw * * @category Constructors * @since 1.0.0 */ export declare const partial: (thunk: Lazy) => Option; /** * ```haskell * partialK :: ((a, b, ...) -> c) -> ((a, b, ...) -> Maybe c) * ``` * * Transforms a non-curried function that may throw, takes a set of arguments `(a, b, ...)`, and returns a value `c`, into a non-curried function that will not throw, takes a set of arguments `(a, b, ...)`, and returns a `Maybe` * * @category Constructors * @since 1.0.0 */ export declare const partialK: (f: FunctionN) => (...args: A) => Option; /** * ```haskell * fromPredicate_ :: (a, (a -> is b)) -> Maybe b * fromPredicate_ :: (a, (a -> Boolean)) -> Maybe a * ``` * * Constructs a new `Maybe` from a value and the given predicate * * @category Constructors * @since 1.0.0 */ export declare const fromPredicate_: { (a: A, refinement: Refinement): Option; (a: A, predicate: Predicate): Option; }; /** * ```haskell * fromPredicate :: (a -> is b) -> a -> Maybe b * fromPredicate :: (a -> Boolean) -> a -> Maybe a * ``` * * Returns a smart constructor based on the given predicate * * @category Constructors * @since 1.0.0 */ export declare const fromPredicate: { (refinement: Refinement): (a: A) => Option; (predicate: Predicate): (a: A) => Option; }; /** * ```haskell * fromEither :: Either e a -> Maybe a * ``` * * Constructs a new `Maybe` from an `Either`, transforming a `Left` into a `Nothing` and a `Right` into a `Just`. * * @category Constructors * @since 1.0.0 */ export declare const fromEither: (ma: Either) => Option; //# sourceMappingURL=constructors.d.ts.map