Module: Fear

Extended by:
EitherApi, ForApi, FutureApi, Mixin, OptionApi, PatternMatchingApi, TryApi
Defined in:
lib/fear.rb,
lib/fear/for.rb,
lib/fear/try.rb,
lib/fear/left.rb,
lib/fear/none.rb,
lib/fear/some.rb,
lib/fear/unit.rb,
lib/fear/await.rb,
lib/fear/right.rb,
lib/fear/utils.rb,
lib/fear/either.rb,
lib/fear/future.rb,
lib/fear/option.rb,
lib/fear/failure.rb,
lib/fear/for_api.rb,
lib/fear/promise.rb,
lib/fear/success.rb,
lib/fear/try_api.rb,
lib/fear/version.rb,
lib/fear/awaitable.rb,
lib/fear/either_api.rb,
lib/fear/future_api.rb,
lib/fear/none_class.rb,
lib/fear/option_api.rb,
lib/fear/right_biased.rb,
lib/fear/pattern_match.rb,
lib/fear/partial_function.rb,
lib/fear/try/pattern_match.rb,
lib/fear/left/pattern_match.rb,
lib/fear/some/pattern_match.rb,
lib/fear/right/pattern_match.rb,
lib/fear/either/pattern_match.rb,
lib/fear/option/pattern_match.rb,
lib/fear/partial_function/any.rb,
lib/fear/pattern_matching_api.rb,
lib/fear/failure/pattern_match.rb,
lib/fear/success/pattern_match.rb,
lib/fear/either/left_projection.rb,
lib/fear/empty_partial_function.rb,
lib/fear/partial_function/empty.rb,
lib/fear/partial_function/guard.rb,
lib/fear/partial_function_class.rb,
lib/fear/partial_function/lifted.rb,
lib/fear/none_class/pattern_match.rb,
lib/fear/partial_function/or_else.rb,
lib/fear/partial_function/and_then.rb,
lib/fear/partial_function/combined.rb,
lib/fear/partial_function/guard/or.rb,
lib/fear/partial_function/guard/and.rb,
lib/fear/partial_function/guard/and3.rb

Defined Under Namespace

Modules: Await, Awaitable, Either, EitherApi, For, ForApi, FutureApi, Mixin, Option, OptionApi, PartialFunction, PatternMatchingApi, Try, TryApi Classes: Failure, Future, Left, PatternMatch, Promise, Right, Some, Success

Constant Summary collapse

Error =
Class.new(StandardError)
IllegalStateException =
Class.new(Error)
MatchError =
Class.new(Error)
NoSuchElementError =
Class.new(Error)
None =

The only instance of NoneClass

NoneClass.new.freeze
Unit =

Represents lack of value. It’s typically returned when function completed without a value.

Examples:

if user.valid?
  Fear.right(Fear::Unit)
else
  Fear.left(user.errors)
end
def sent_notifications(user)
  # ...
  Fear::Unit
end
Object.new.tap do |unit|
  # @return [String]
  def unit.to_s
    "#<Fear::Unit>"
  end

  # @return [String]
  def unit.inspect
    "#<Fear::Unit>"
  end
end.freeze
VERSION =
"3.0.0"

Method Summary

Methods included from Try::Mixin

#Failure, #Success, #Try

Methods included from Option::Mixin

#None, #Option, #Some

Methods included from For::Mixin

#For

Methods included from Either::Mixin

#Left, #Right

Methods included from EitherApi

left, right

Methods included from ForApi

for

Methods included from FutureApi

future

Methods included from OptionApi

none, option, some

Methods included from PatternMatchingApi

case, match, matcher

Methods included from TryApi

failure, success, try