Class Unit

java.lang.Object
eu.bandm.tools.ramus.ogma.Unit

public final class Unit extends Object
A data class with no information content. To be used as replacement for Void in contexts that do not allow null values.
See Also:
  • Field Details

    • unit

      public static final Unit unit
      The unique instance.
  • Method Details

    • toString

      public String toString()
      Overrides:
      toString in class Object
    • forget

      public static <A> Function<A,Unit> forget()
      Returns the unique unit-valued function from some argument type.
      Type Parameters:
      A - the argument type
      Returns:
      the constant function that always returns unit
    • point

      public static <A> Function<Unit,A> point(A value)
      Returns the constant function that maps the unit value to a given value.

      All functions from (the non-null values of) Unit to some type A can be constructed by this method.

      Type Parameters:
      A - the result type
      Parameters:
      value - the result value
      Returns:
      a function that can only be applied to unit and returns value