Class: Funkr::Types::Container

Inherits:
Object
  • Object
show all
Extended by:
Monoid::ClassMethods
Includes:
Functor, Categories, Monoid
Defined in:
lib/funkr/types/container.rb

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ Container

Returns a new instance of Container.



9
10
11
# File 'lib/funkr/types/container.rb', line 9

def initialize(value)
  @value = value
end

Instance Method Details

#map(&block) ⇒ Object



19
20
21
# File 'lib/funkr/types/container.rb', line 19

def map(&block)
  self.class.new(yield(@value))
end

#mplus(c_y) ⇒ Object



26
27
28
# File 'lib/funkr/types/container.rb', line 26

def mplus(c_y)
  self.class.new(@value.mplus(c_y.unbox))
end

#to_sObject



15
# File 'lib/funkr/types/container.rb', line 15

def to_s; format("{- %s -}", @value.to_s); end

#unboxObject



13
# File 'lib/funkr/types/container.rb', line 13

def unbox; @value; end