Class: Kind::Maybe::Typed

Inherits:
Object
  • Object
show all
Defined in:
lib/kind/maybe/typed.rb

Instance Method Summary collapse

Constructor Details

#initialize(kind) ⇒ Typed

Returns a new instance of Typed.



10
11
12
# File 'lib/kind/maybe/typed.rb', line 10

def initialize(kind)
  @kind = kind
end

Instance Method Details

#inspectObject



22
23
24
# File 'lib/kind/maybe/typed.rb', line 22

def inspect
  "Kind::Maybe<#{@kind}>"
end

#new(arg) ⇒ Object Also known as: []



14
15
16
17
18
# File 'lib/kind/maybe/typed.rb', line 14

def new(arg)
  value = Monad::Value[arg]

  @kind === value ? Maybe::Some[value] : Maybe::NONE_INSTANCE
end