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/struct.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/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/none_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/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/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: EitherPatternMatch, Failure, Future, Left, LeftPatternMatch, OptionPatternMatch, PatternMatch, Promise, Right, RightPatternMatch, Some, Struct, Success, TryPatternMatch

Constant Summary collapse

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

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

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 =
"2.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