A monad which allows making the computation value into a Result with an error context message.

Type Parameters

  • M

Hierarchy

Properties

apply: (<T, U>(fn) => ((t) => Instance<Apply1<M, U>>))

Type declaration

context: ((context) => (<T>(computation) => Result<Error, T>))

Type declaration

    • (context): (<T>(computation) => Result<Error, T>)
    • Converts a computation value into a Result with a message context.

      Parameters

      • context: string

        The message to be included to an error.

      Returns (<T>(computation) => Result<Error, T>)

      The extracted value or an Error if failed.

        • <T>(computation): Result<Error, T>
        • Type Parameters

          • T

          Parameters

          • computation: Get1<M, T>

          Returns Result<Error, T>

flatMap: (<T1, U1>(a) => ((t) => Instance<Apply1<M, U1>>))

Type declaration

map: (<T, U>(fn) => ((t) => Instance<Apply1<M, U>>))

Type declaration

pure: (<T>(t) => Instance<Apply1<M, T>>)

Type declaration

withContext: ((fn) => (<T>(computation) => Result<Error, T>))

Type declaration

    • (fn): (<T>(computation) => Result<Error, T>)
    • Converts a computation value into a Result with a function fn creating a message.

      Parameters

      • fn: (() => string)

        The function to create a message to be included to an error.

          • (): string
          • Returns string

      Returns (<T>(computation) => Result<Error, T>)

      The extracted value or an Error if failed.

        • <T>(computation): Result<Error, T>
        • Type Parameters

          • T

          Parameters

          • computation: Get1<M, T>

          Returns Result<Error, T>

Generated using TypeDoc