Sha256: 283f45c78f7935451d1bc0ee4b86c835fe9a80389f66e1f61c7e15f7b8a7caab

Contents?: true

Size: 426 Bytes

Versions: 11

Compression:

Stored size: 426 Bytes

Contents

# frozen_string_literal: true

module Kind
  require 'kind/monad'

  class Either::Monad::Wrapper < Kind::Monad::Wrapper
    def left(matcher = UNDEFINED)
      return if @monad.right? || output?

      @output = yield(@monad.value) if @monad.either?(matcher)
    end

    def right(matcher = UNDEFINED)
      return if @monad.left? || output?

      @output = yield(@monad.value) if @monad.either?(matcher)
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
kind-5.10.0 lib/kind/either/monad/wrapper.rb
kind-5.9.0 lib/kind/either/monad/wrapper.rb
kind-5.8.1 lib/kind/either/monad/wrapper.rb
kind-5.8.0 lib/kind/either/monad/wrapper.rb
kind-5.7.0 lib/kind/either/monad/wrapper.rb
kind-5.6.0 lib/kind/either/monad/wrapper.rb
kind-5.5.0 lib/kind/either/monad/wrapper.rb
kind-5.4.1 lib/kind/either/monad/wrapper.rb
kind-5.4.0 lib/kind/either/monad/wrapper.rb
kind-5.3.0 lib/kind/either/monad/wrapper.rb
kind-5.2.0 lib/kind/either/monad/wrapper.rb