Class: Kleisli::Try::Failure

Inherits:
Kleisli::Try show all
Defined in:
lib/kleisli/try.rb

Instance Attribute Summary

Attributes inherited from Kleisli::Try

#exception, #value

Instance Method Summary collapse

Methods inherited from Kleisli::Try

lift

Methods inherited from Monad

#>>

Constructor Details

#initialize(exception) ⇒ Failure

Returns a new instance of Failure.



39
40
41
# File 'lib/kleisli/try.rb', line 39

def initialize(exception)
  @exception = exception
end

Instance Method Details

#>(f) ⇒ Object



43
44
45
# File 'lib/kleisli/try.rb', line 43

def >(f)
  self
end

#fmap(&f) ⇒ Object



47
48
49
# File 'lib/kleisli/try.rb', line 47

def fmap(&f)
  self
end

#to_eitherObject



55
56
57
# File 'lib/kleisli/try.rb', line 55

def to_either
  Either::Left.new(@exception)
end

#to_maybeObject



51
52
53
# File 'lib/kleisli/try.rb', line 51

def to_maybe
  Maybe::None.new
end