Object

io.chrisdavenport.Data

Maybe

Related Doc: package Data

Permalink

object Maybe

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Maybe
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. sealed trait Maybe[+A] extends AnyRef

    Permalink

    The Maybe type encapsulates an optional value.

    The Maybe type encapsulates an optional value. A value of type Maybe a either contains a value of type a (represented as MJust a), or it is empty (represented as MNothing). Using Maybe is a good way to deal with errors or exceptional cases without resorting to drastic measures such as error.

    The Maybe type is also a monad. It is a simple kind of error monad, where all errors are represented by Nothing.

    This corresponds to the Data.Maybe in Haskell.

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. def >>=[A, B](ma: Maybe[A])(f: (A) ⇒ Maybe[B]): Maybe[B]

    Permalink
  5. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  6. def checkNonFatal[A](a: ⇒ A): Maybe[A]

    Permalink
  7. def checkNull[A](a: A): Maybe[A]

    Permalink
  8. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  9. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  10. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  11. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  12. def fromMaybe[A](a: A)(ma: Maybe[A]): A

    Permalink

    The fromMaybe function takes a default value and and Maybe value.

    The fromMaybe function takes a default value and and Maybe value. If the Maybe is MNothing, it returns the default values; otherwise, it returns the value contained in the Maybe.

  13. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  14. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  15. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  16. def isMJust[A](ma: Maybe[A]): Boolean

    Permalink

    The isJust function returns True iff its argument is of the form MJust _.

  17. def isMNothing[A](ma: Maybe[A]): Boolean

    Permalink

    The isNothing function returns True iff its argument is MNothing.

  18. def just[A](a: A): Maybe[A]

    Permalink

    Constructors *

  19. def listToMaybe[A](l: List[A]): Maybe[A]

    Permalink

    The listToMaybe function returns MNothing on an empty list or MJust a where a is the first element of the list.

  20. def maybe[B, A](b: B)(f: (A) ⇒ B)(ma: Maybe[A]): B

    Permalink

    The maybe function takes a default value, a function, and a Maybe value.

    The maybe function takes a default value, a function, and a Maybe value. If the Maybe value is MNothing, the function returns the default value. Otherwise, it applies the function to the value inside the MJust and returns the result.

  21. def maybeToList[A](ma: Maybe[A]): List[A]

    Permalink

    The maybeToList function returns an empty list when given Nothing or a singleton list when not given Nothing.

  22. def maybeToOption[A](ma: Maybe[A]): Option[A]

    Permalink

    The maybeToOption function returns Empty on MNothing and returns Some on MJust

  23. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  24. def nothing[A]: Maybe[A]

    Permalink
  25. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  26. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  27. def optionToMaybe[A](o: Option[A]): Maybe[A]

    Permalink

    The optionToMaybe function returns MNothing On Empty and returns MJust on Some

  28. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  29. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  30. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  31. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  32. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped