Sha256: c74b1e90952785e33641516687f0f03df1cd4fac18165f5e339ef6f41b25fb39

Contents?: true

Size: 385 Bytes

Versions: 1

Compression:

Stored size: 385 Bytes

Contents

module Fear
  module PartialFunction
    # @api private
    class Lifted
      # @param pf [Fear::PartialFunction]
      def initialize(pf)
        @pf = pf
      end
      attr_reader :pf

      # @param arg [any]
      # @return [Fear::Option]
      def call(arg)
        Some.new(pf.call_or_else(arg) { return Fear::None })
      end
    end

    private_constant :Lifted
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fear-0.11.0 lib/fear/partial_function/lifted.rb