FuncType - v0.16.0
    Preparing search index...

    Function $

    • Extracts values from monads in Do-notation with type inference. The '$' symbol is the universal extraction operator in functional programming.

      Type Parameters

      • T

      Parameters

      • monad: Option<T>

        Any monad that can be unwrapped (Option, Either, List, Try, etc.)

      Returns Generator<Option<T>, T, T>

      A generator that yields the monad and returns its extracted value

      const result = Do(function* () {
      const x = yield* $(Option(5)) // x: number
      const y = yield* $(List([1, 2, 3])) // y: number (for cartesian product)
      const name = yield* $(Right("Alice")) // name: string
      return `${name}: ${x + y}`
      })
    • Extracts values from monads in Do-notation with type inference. The '$' symbol is the universal extraction operator in functional programming.

      Type Parameters

      • L
      • R

      Parameters

      • monad: Either<L, R>

        Any monad that can be unwrapped (Option, Either, List, Try, etc.)

      Returns Generator<Either<L, R>, R, R>

      A generator that yields the monad and returns its extracted value

      const result = Do(function* () {
      const x = yield* $(Option(5)) // x: number
      const y = yield* $(List([1, 2, 3])) // y: number (for cartesian product)
      const name = yield* $(Right("Alice")) // name: string
      return `${name}: ${x + y}`
      })
    • Extracts values from monads in Do-notation with type inference. The '$' symbol is the universal extraction operator in functional programming.

      Type Parameters

      • T

      Parameters

      • monad: List<T>

        Any monad that can be unwrapped (Option, Either, List, Try, etc.)

      Returns Generator<List<T>, T, T>

      A generator that yields the monad and returns its extracted value

      const result = Do(function* () {
      const x = yield* $(Option(5)) // x: number
      const y = yield* $(List([1, 2, 3])) // y: number (for cartesian product)
      const name = yield* $(Right("Alice")) // name: string
      return `${name}: ${x + y}`
      })
    • Extracts values from monads in Do-notation with type inference. The '$' symbol is the universal extraction operator in functional programming.

      Type Parameters

      • T

      Parameters

      • monad: Try<T>

        Any monad that can be unwrapped (Option, Either, List, Try, etc.)

      Returns Generator<Try<T>, T, T>

      A generator that yields the monad and returns its extracted value

      const result = Do(function* () {
      const x = yield* $(Option(5)) // x: number
      const y = yield* $(List([1, 2, 3])) // y: number (for cartesian product)
      const name = yield* $(Right("Alice")) // name: string
      return `${name}: ${x + y}`
      })
    • Extracts values from monads in Do-notation with type inference. The '$' symbol is the universal extraction operator in functional programming.

      Type Parameters

      • T

      Parameters

      • monad: Doable<T>

        Any monad that can be unwrapped (Option, Either, List, Try, etc.)

      Returns Generator<Doable<T>, T, T>

      A generator that yields the monad and returns its extracted value

      const result = Do(function* () {
      const x = yield* $(Option(5)) // x: number
      const y = yield* $(List([1, 2, 3])) // y: number (for cartesian product)
      const name = yield* $(Right("Alice")) // name: string
      return `${name}: ${x + y}`
      })
    • Extracts values from monads in Do-notation with type inference. The '$' symbol is the universal extraction operator in functional programming.

      Type Parameters

      • M

      Parameters

      • monad: M

        Any monad that can be unwrapped (Option, Either, List, Try, etc.)

      Returns Generator<M, InferYieldType<M>, InferYieldType<M>>

      A generator that yields the monad and returns its extracted value

      const result = Do(function* () {
      const x = yield* $(Option(5)) // x: number
      const y = yield* $(List([1, 2, 3])) // y: number (for cartesian product)
      const name = yield* $(Right("Alice")) // name: string
      return `${name}: ${x + y}`
      })