Class: Either::Left

Inherits:
Trither::Box show all
Includes:
Trither::BasicTypes
Defined in:
lib/trither/either.rb,
lib/trither/either.rb

Constant Summary

Constants included from Trither::BasicTypes

Trither::BasicTypes::C, Trither::BasicTypes::Func0, Trither::BasicTypes::Func1, Trither::BasicTypes::Predicate

Constants inherited from Trither::Box

Trither::Box::C

Instance Method Summary collapse

Methods inherited from Trither::Box

#==, #initialize

Constructor Details

This class inherits a constructor from Trither::Box

Instance Method Details

#leftObject



29
30
31
# File 'lib/trither/either.rb', line 29

def left
  @value
end

#left?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/trither/either.rb', line 19

def left?
  true
end

#left_flat_map {|@value| ... } ⇒ Object

Yields:

  • (@value)


44
45
46
# File 'lib/trither/either.rb', line 44

def left_flat_map
  yield @value
end

#left_mapObject



34
35
36
# File 'lib/trither/either.rb', line 34

def left_map
  Left.new(yield @value)
end

#right?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/trither/either.rb', line 24

def right?
  false
end

#right_flat_mapObject



49
50
51
# File 'lib/trither/either.rb', line 49

def right_flat_map
  self
end

#right_mapObject



39
40
41
# File 'lib/trither/either.rb', line 39

def right_map
  self
end