given_Monad_Option

given given_Monad_Option: Monad[[A] =>> Option[A]]

Value members

Concrete methods

def bind[A, B](f: A => Option[B]): Option[A] => Option[B]

Extensions

Inherited extensions

extension (f: A => M[B])
@targetName("composeKleisliFlipped")
def <=<[A, B, C](ff: C => M[A]): C => Option[B]

Right-to-left composition of Kleisli arrows.

Right-to-left composition of Kleisli arrows.

Example
val ff1 = (x:Int) => Option(x +1)
val ff2 = (x:Int) => Option(x +2)
(ff2 <=< ff1) =<< Option(1) == Option(4)
Inherited from
Monad
@targetName("bindFlipped")
def =<<[A, B, C](ma: M[A]): Option[B]

Flipped &gt;&gt;=

Flipped &gt;&gt;=

Inherited from
Monad
@targetName("composeKleisli")
def >=>[A, B, C](ff: B => M[C]): A => Option[C]

Left-to-right composition of Kleisli arrows.

Left-to-right composition of Kleisli arrows.

Example
val ff1 = (x:Int) => Option(x +1)
val ff2 = (x:Int) => Option(x +2)
Option(1) >>= (ff1 >=> ff2) == Option(4)
Inherited from
Monad
extension (fa: M[A])
@targetName("dropLeft")
def >>[A, B](fb: M[B]): Option[B]

Sequentially compose two actions, discarding any value produced by the first, like sequencing operators (such as the semicolon) in imperative languages.

Sequentially compose two actions, discarding any value produced by the first, like sequencing operators (such as the semicolon) in imperative languages.

Example
Option(1) >> Option(2) == Option(2)
Inherited from
Monad
@targetName("bind")
def >>=[A, B](f: A => M[B]): Option[B]

Sequentially compose two actions, passing any value produced by the first as an argument to the second.

Sequentially compose two actions, passing any value produced by the first as an argument to the second.

Example
val f = (x:Int) => Option(x +1)
Option(1) >>= f == Option(2)
Inherited from
Monad
def flatMap[A, B](f: A => M[B]): Option[B]

alias of &gt;&gt;= for for comprehension

alias of &gt;&gt;= for for comprehension

Inherited from
Monad
extension (ffa: M[M[A]])
def flatten[A]: Option[A]

Flatten a nested Monad

Flatten a nested Monad

Example
Option(Option(1)).flatten == Option(1)
Inherited from
Monad