class Rammed::Monad::MaybeConstructors::Just
Public Class Methods
new(v)
click to toggle source
# File lib/monad/maybe.rb, line 9 def initialize(v) @v = v end
Public Instance Methods
==(other)
click to toggle source
# File lib/monad/maybe.rb, line 29 def ==(other) other.respond_to?(:just?) && other.just? && other.instance_variable_get(:@v) == @v end
bind(f)
click to toggle source
# File lib/monad/maybe.rb, line 21 def bind(f) f.(@v) end
just?()
click to toggle source
# File lib/monad/maybe.rb, line 13 def just? true end
map(f)
click to toggle source
# File lib/monad/maybe.rb, line 25 def map(f) self >> ->(x) { Just.new(f.(x)) } end
mreturn(v)
click to toggle source
# File lib/monad/maybe.rb, line 33 def mreturn(v) self.class.new(v) end
none?()
click to toggle source
# File lib/monad/maybe.rb, line 17 def none? false end