Module: Fear

Extended by:
EitherApi, ExtractorApi, ForApi, FutureApi, 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/extractor.rb,
lib/fear/either_api.rb,
lib/fear/future_api.rb,
lib/fear/option_api.rb,
lib/fear/right_biased.rb,
lib/fear/extractor_api.rb,
lib/fear/pattern_match.rb,
lib/fear/partial_function.rb,
lib/fear/extractor/grammar.rb,
lib/fear/extractor/matcher.rb,
lib/fear/extractor/pattern.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/extractor/any_matcher.rb,
lib/fear/extractor/matcher/and.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/extractor/array_matcher.rb,
lib/fear/extractor/value_matcher.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/extractor/extractor_matcher.rb,
lib/fear/partial_function/guard/and3.rb,
lib/fear/extractor/array_head_matcher.rb,
lib/fear/extractor/empty_list_matcher.rb,
lib/fear/extractor/identifier_matcher.rb,
lib/fear/extractor/array_splat_matcher.rb,
lib/fear/extractor/typed_identifier_matcher.rb,
lib/fear/extractor/named_array_splat_matcher.rb,
lib/fear/extractor/anonymous_array_splat_matcher.rb

Defined Under Namespace

Modules: Await, Awaitable, Either, EitherApi, Extractor, ExtractorApi, For, ForApi, FutureApi, Mixin, Option, OptionApi, PartialFunction, PatternMatchingApi, Try, TryApi Classes: EitherPatternMatch, Failure, FailurePatternMatch, Future, Left, LeftPatternMatch, OptionPatternMatch, PatternMatch, Promise, Right, RightPatternMatch, Some, Struct, Success, SuccessPatternMatch, 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 =

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 =
"1.1.0"

Method Summary

Methods included from EitherApi

left, right

Methods included from ExtractorApi

[], register_extractor

Methods included from ForApi

for

Methods included from FutureApi

future

Methods included from OptionApi

none, option, some

Methods included from PatternMatchingApi

case, match, matcher, xcase

Methods included from TryApi

failure, success, try