Value

org.finos.morphir.ir.Value$
object Value extends PatternModule

In functional programming data and logic are treated the same way and we refer to both as values. This module provides the building blocks for those values (data and logic) in the Morphir IR.

If you use Elm as your frontend language for Morphir then you should think about all the logic and constant values that you can put in the body of a function. Here are a few examples:

myThreshold =
   1000

min a b =
 if a < b then
   a
 else b

addTwo a = a + 2

All the above are values: the first one is just data, the second one is logic and the last one has both logic and data. In either case each value is represented by a Value expression. This is a recursive data structure with various node types representing each possible language construct. You can check out the documentation for values below to find more details. Here are the Morphir IR snippets for the above values as a quick reference:

myThreshold = Literal () (WholeNumberLiteral 1000)

min a b = IfThenElse () (Apply () (Apply () (Reference () (fqn "Morphir.SDK" "Basics" "lessThan")) (Variable () [ "a"
]) ) (Variable () [ "b" ]) ) (Variable () [ "a" ]) (Variable () [ "b" ])

addTwo a = Apply () (Apply () (Reference () (fqn "Morphir.SDK" "Basics" "add")) (Variable () [ "a" ]) ) (Literal ()
(WholeNumberLiteral 2))

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Value.type

Members list

Type members

Classlikes

final class FieldsPartiallyApplied(val dummy: Boolean) extends AnyVal

Attributes

Supertypes
class AnyVal
trait Matchable
class Any
final class FunctionDefInputsClause[TA, VA](val args: Chunk[(Name, VA, Type[TA])]) extends AnyVal

Attributes

Supertypes
class AnyVal
trait Matchable
class Any
final class FunctionSignature[TA, VA](val input: () => (Chunk[(Name, VA, Type[TA])], Type[TA])) extends AnyVal

Attributes

Supertypes
class AnyVal
trait Matchable
class Any
final implicit class RawValueExtensions(self: RawValue) extends AnyVal

Attributes

Supertypes
class AnyVal
trait Matchable
class Any
final class RecordPartiallyApplied[VA](val attributes: VA) extends AnyVal

Attributes

Supertypes
class AnyVal
trait Matchable
class Any
final class ValueDefClause[TA](val returnType: Type[TA]) extends AnyVal

Attributes

Supertypes
class AnyVal
trait Matchable
class Any

Types

final type Definition[+TA, +VA] = ValueDefinition[TA, VA]
final type RawValue = RawValue
final type Specification[+TA] = ValueSpecification[TA]
final type TypedValue = TypedValue
final type USpecification = ValueSpecification[Unit]
final type Value[+TA, +VA] = Value[TA, VA]

Inherited types

final type APattern = Pattern[Attributes]

Attributes

Inherited from:
PatternModule
final type Pattern[+A] = Pattern[A]

Attributes

Inherited from:
PatternModule
final type UPattern = Pattern[Unit]

Attributes

Inherited from:
PatternModule

Value members

Concrete methods

final def apply[TA, VA](attributes: VA, function: Value[TA, VA], argument: Value[TA, VA], arguments: Value[TA, VA]*)(implicit ev: IsNotAValue[VA]): Value[TA, VA]
final def apply(function: RawValue, argument: RawValue): Raw
final def apply(function: RawValue, argument: RawValue, arguments: RawValue*): Raw
final def boolean[A](attributes: A, value: Boolean): Value[Nothing, A]
final def boolean(value: Boolean): RawValue
final def call[TA, VA](function: Value[TA, VA], attributes: VA)(arguments: Value[TA, VA]*)(implicit ev: NeedsAttributes[VA]): Value[TA, VA]
final def caseOf[TA, VA](value: Value[TA, VA])(firstCase: (Pattern[VA], Value[TA, VA]), otherCases: (Pattern[VA], Value[TA, VA])*): Value[TA, VA]
final def constructor[A](attributes: A, name: String): Value[Nothing, A]
final def constructor[A](attributes: A, name: FQName): Value[Nothing, A]
final def constructor(name: String): RawValue
final def constructor(name: FQName): RawValue
final def constructor(name: String, tpe: UType): TypedValue
final def constructor(name: FQName, tpe: UType): TypedValue
final def decimal[A](attributes: A, value: BigDecimal): Value[Nothing, A]
final def decimal(value: BigDecimal): RawValue
final def destructure[TA, VA](attributes: VA, pattern: Pattern[VA], valueToDestruct: Value[TA, VA], inValue: Value[TA, VA]): Value[TA, VA]
final def destructure(pattern: UPattern, valueToDestruct: RawValue, inValue: RawValue): RawValue
final def emptyTuple[VA](attributes: VA): Value[Nothing, VA]
final def field[TA, VA](attributes: VA, target: Value[TA, VA], name: Name): Value[TA, VA]
final def field[TA, VA](attributes: VA, target: Value[TA, VA], name: String): Value[TA, VA]
final def field(target: RawValue, name: Name): RawValue
final def field(target: RawValue, name: String): RawValue
final def fieldFunction[A](attributes: A, name: String): Value[Nothing, A]
final def fieldFunction[A](attributes: A, name: Name): Value[Nothing, A]
final def fieldFunction(name: String, tpe: UType): TypedValue
final def fieldFunction(name: Name, tpe: UType): TypedValue
final def fieldFunction(name: String): RawValue
final def fieldFunction(name: Name): RawValue
final def fields[TA, VA](all: (String, Value[TA, VA])*): Chunk[(Name, Value[TA, VA])]
final def float[A](attributes: A, value: Double): Value[Nothing, A]
final def float(value: Double): RawValue
final def float[A](attributes: A, value: Float): Value[Nothing, A]
final def float(value: Float): RawValue
def functionDef(firstArg: (String, UType), otherArgs: (String, UType)*): FunctionDefInputsClause[Unit, UType]
final def ifThenElse[TA, VA](attributes: VA, condition: Value[TA, VA], thenBranch: Value[TA, VA], elseBranch: Value[TA, VA]): Value[TA, VA]
final def ifThenElse(condition: RawValue, thenBranch: RawValue, elseBranch: RawValue): RawValue
final def int[A](attributes: A, value: Int): Value[Nothing, A]
final def int(value: Int): RawValue
final def intTyped(value: Int): TypedValue
final def lambda[TA, VA](attributes: VA, argumentPattern: Pattern[VA], body: Value[TA, VA]): Value[TA, VA]
final def lambda(argumentPattern: UPattern, body: RawValue): RawValue
final def let[TA, VA](attributes: VA, name: String, valueDefinition: ValueDefinition[TA, VA], body: Value[TA, VA]): Value[TA, VA]
final def let[TA, VA](attributes: VA, name: Name, valueDefinition: ValueDefinition[TA, VA], body: Value[TA, VA]): Value[TA, VA]
final def let(name: Name, valueDefinition: Raw, body: RawValue): RawValue
final def let(name: String, valueDefinition: Raw, body: RawValue): RawValue
final def let(varName: String, value: Int, block: TypedValue): TypedValue
final def let(varName: String, value: String, block: TypedValue): TypedValue
final def let(varName: String, value: Boolean, block: TypedValue): TypedValue
final def let(varName: String, value: Float, block: TypedValue): TypedValue
final def let(varName: String, value: Double, block: TypedValue): TypedValue
final def let(varName: String, value: BigDecimal, block: TypedValue): TypedValue
final def let(varName: String, value: BigDecimal, block: TypedValue): TypedValue
final def letDef[TA, VA](attributes: VA, name: Name, valueDefinition: ValueDefinition[TA, VA], body: Value[TA, VA]): Value[TA, VA]
final def letDef[TA, VA](attributes: VA, name: String, valueDefinition: ValueDefinition[TA, VA], body: Value[TA, VA]): Value[TA, VA]
final def letDef(name: Name, valueDefinition: Raw, body: RawValue): RawValue
final def letDef(name: String, valueDefinition: Raw, body: RawValue): RawValue
final def letDestruct[TA, VA](attributes: VA, pattern: Pattern[VA], valueToDestruct: Value[TA, VA], inValue: Value[TA, VA]): Value[TA, VA]
final def letDestruct(pattern: UPattern, valueToDestruct: RawValue, inValue: RawValue): RawValue
final def letRec[TA, VA](attributes: VA, valueDefinitions: Map[Name, ValueDefinition[TA, VA]], inValue: Value[TA, VA]): Value[TA, VA]
final def letRec[TA, VA](attributes: VA, valueDefinitions: (String, ValueDefinition[TA, VA])*)(inValue: Value[TA, VA]): Value[TA, VA]
final def letRec(valueDefinitions: Map[Name, Raw], inValue: RawValue): RawValue
final def letRec(valueDefinitions: (String, Raw)*)(inValue: RawValue): RawValue
final def list[TA, VA](attributes: VA, values: Chunk[Value[TA, VA]]): Value[TA, VA]
final def list[TA, VA](attributes: VA, values: Value[TA, VA]*)(implicit ev: IsNotAValue[VA]): Value[TA, VA]
final def list(elements: Chunk[RawValue]): RawValue
final def list(elements: RawValue*): RawValue
final def listOf[TA](elementType: UType, elements: Value[TA, UType]*): Value[TA, UType]
final def listOf(elements: RawValue*)(elementType: UType): TypedValue
final def literal[VA](attributes: VA, literal: Lit): Value[Nothing, VA]
final def literal(literal: Lit): RawValue
final def literal(value: String): TypedValue
final def literal(value: Int): TypedValue
final def literal(value: Long): TypedValue
final def literal(value: Float): TypedValue
final def literal(value: Double): TypedValue
final def literal(value: Boolean): TypedValue
final def literal(value: BigDecimal): TypedValue
final def literal(value: BigDecimal): TypedValue
final def literalTyped[A](literal: Lit): TypedValue
final def patternMatch[TA, VA](attributes: VA, branchOutOn: Value[TA, VA], cases: Chunk[(Pattern[VA], Value[TA, VA])]): Value[TA, VA]
final def patternMatch[TA, VA](attributes: VA, branchOutOn: Value[TA, VA], cases: (Pattern[VA], Value[TA, VA])*): Value[TA, VA]
final def patternMatch(branchOutOn: RawValue, cases: Chunk[(UPattern, RawValue)]): RawValue
final def patternMatch(branchOutOn: RawValue, cases: (UPattern, RawValue)*): RawValue
final def record[TA, VA](attributes: VA, fields: (String, Value[TA, VA])*)(implicit ev: Not[VA =:= (String, Value[TA, VA])]): Value[TA, VA]
final def record[TA, VA](attributes: VA, f: Builder[TA, VA] => Any)(implicit ev: IsNotAValue[VA]): Value[TA, VA]
final def recordRaw(fields: (String, RawValue)*): RawValue
final def recordRaw(f: Builder[Unit, Unit] => Any): RawValue
def reference[VA](attributes: VA, fullyQualifiedName: FQName)(implicit ev: NeedsAttributes[VA]): Value[Nothing, VA]
final def reference[A](attributes: A, fullyQualifiedName: String)(implicit ev: NeedsAttributes[A]): Value[Nothing, A]
final def reference(fullyQualifiedName: String, tpe: UType): TypedValue
final def reference(fullyQualifiedName: FQName, tpe: UType): TypedValue
final def reference[A](attributes: A, packageName: String, moduleName: String, localName: String): Value[Nothing, A]
final def reference(fullyQualifiedName: String): RawValue
final def reference(fullyQualifiedName: FQName): RawValue
final def reference(packageName: String, moduleName: String, localName: String): RawValue
final def string[VA](attributes: VA, value: String): Value[Nothing, VA]
final def string(value: String): RawValue
final def toRawValue(literal: Lit): RawValue
final def toTypedValue(literal: Lit): TypedValue
final def tuple[TA, VA](attributes: VA, elements: Chunk[Value[TA, VA]]): Value[TA, VA]
final def tuple[TA, VA](attributes: VA, first: Value[TA, VA], second: Value[TA, VA], otherElements: Value[TA, VA]*)(implicit ev: IsNotAValue[VA]): Value[TA, VA]
final def tuple(elements: RawValue*): RawValue
final def tuple(elements: Chunk[RawValue]): RawValue
final def tuple(element: (RawValue, UType), elements: (RawValue, UType)*): TypedValue
def unit[VA](attributes: VA)(implicit ev: NeedsAttributes[VA]): Value[Nothing, VA]
def update[TA, VA](attributes: VA, valueToUpdate: Value[TA, VA], fieldsToUpdate: Map[Name, Value[TA, VA]])(implicit ev: NeedsAttributes[VA]): Value[TA, VA]
final def update[TA, VA](attributes: VA, valueToUpdate: Value[TA, VA], fields: Chunk[(Name, Value[TA, VA])]): Value[TA, VA]
final def update[TA, VA](attributes: VA, valueToUpdate: Value[TA, VA], fields: (String, Value[TA, VA])*): Value[TA, VA]
final def update(valueToUpdate: RawValue, fields: Chunk[(Name, RawValue)]): RawValue
final def update(valueToUpdate: RawValue, fields: (String, RawValue)*): RawValue
final def valueDef[TA](returnType: Type[TA]): ValueDefClause[TA]
final def variable[A](attributes: A, name: Name): Value[Nothing, A]
final def variable[A](attributes: A, name: String): Value[Nothing, A]
final def variable(name: Name): RawValue
final def variable(name: String): RawValue
final def variable(name: String, tpe: UType): TypedValue
final def variable(name: Name, tpe: UType): TypedValue
final def wholeNumber(value: Long): RawValue
final def wholeNumber(value: Int): RawValue

Inherited methods

final def asAlias(alias: Name): UPattern

Attributes

Inherited from:
PatternModule
final def asAlias(alias: String): UPattern

Attributes

Inherited from:
PatternModule
final def asAlias[A](attributes: A, alias: Name): Pattern[A]

Attributes

Inherited from:
PatternModule
final def asAlias[A](attributes: A, alias: String): Pattern[A]

Attributes

Inherited from:
PatternModule
final def asPattern(pattern: UPattern, alias: String): UPattern

Attributes

Inherited from:
PatternModule
def asPattern(pattern: UPattern, name: Name): UPattern

Attributes

Inherited from:
PatternModule
final def asPattern[A](attributes: A, pattern: Pattern[A], alias: String): Pattern[A]

Attributes

Inherited from:
PatternModule
def asPattern[A](attributes: A, pattern: Pattern[A], name: Name)(implicit ev: NeedsAttributes[A]): Pattern[A]

Attributes

Inherited from:
PatternModule
final def booleanPattern(value: Boolean): UPattern

Attributes

Inherited from:
PatternModule
final def booleanPattern[A](attributes: A, value: Boolean): Pattern[A]

Attributes

Inherited from:
PatternModule
final def constructorPattern(constructorName: FQName, argumentPatterns: Chunk[UPattern]): UPattern

Attributes

Inherited from:
PatternModule
final def constructorPattern(constructorName: String, argumentPatterns: Chunk[UPattern]): UPattern

Attributes

Inherited from:
PatternModule
final def constructorPattern[A](attributes: A, constructorName: String, argumentPatterns: Chunk[Pattern[A]]): Pattern[A]

Attributes

Inherited from:
PatternModule
final def constructorPattern[A](attributes: A, constructorName: FQName, argumentPatterns: Chunk[Pattern[A]]): Pattern[A]

Attributes

Inherited from:
PatternModule
final def decimalPattern(value: BigDecimal): UPattern

Attributes

Inherited from:
PatternModule
final def decimalPattern[A](attributes: A, value: BigDecimal): Pattern[A]

Attributes

Inherited from:
PatternModule

Attributes

Inherited from:
PatternModule
final def emptyListPattern[A](attributes: A): Pattern[A]

Attributes

Inherited from:
PatternModule
final def falsePattern: UPattern

Attributes

Inherited from:
PatternModule
final def falsePattern[A](attributes: A): Pattern[A]

Attributes

Inherited from:
PatternModule
final def floatPattern(value: Float): UPattern

Attributes

Inherited from:
PatternModule
final def floatPattern[A](attributes: A, value: Float): Pattern[A]

Attributes

Inherited from:
PatternModule
def headTailPattern(headPattern: UPattern, tailPattern: UPattern): UPattern

Attributes

Inherited from:
PatternModule
final def headTailPattern[A](attributes: A, headPattern: Pattern[A], tailPattern: Pattern[A]): Pattern[A]

Attributes

Inherited from:
PatternModule
final def intPattern(value: Int): UPattern

Attributes

Inherited from:
PatternModule
final def intPattern[A](attributes: A, value: Int): Pattern[A]

Attributes

Inherited from:
PatternModule
final def literalPattern(value: Literal): UPattern

Attributes

Inherited from:
PatternModule
final def literalPattern[A](attributes: A, value: Literal): Pattern[A]

Attributes

Inherited from:
PatternModule
final def stringPattern(value: String): UPattern

Attributes

Inherited from:
PatternModule
final def stringPattern[A](attributes: A, value: String): Pattern[A]

Attributes

Inherited from:
PatternModule
final def toString[A](pattern: Pattern[A]): String

Attributes

Inherited from:
PatternModule
final def truePattern: UPattern

Attributes

Inherited from:
PatternModule
final def truePattern[A](attributes: A): Pattern[A]

Attributes

Inherited from:
PatternModule
final def tuplePattern(patterns: UPattern*): UPattern

Attributes

Inherited from:
PatternModule
final def tuplePattern(patterns: Chunk[UPattern]): UPattern

Attributes

Inherited from:
PatternModule
final def tuplePattern[A](attributes: A, patterns: Pattern[A]*)(implicit ev: Not[A <:< Pattern[_]]): Pattern[A]

Attributes

Inherited from:
PatternModule
final def tuplePattern[A](attributes: A, patterns: Chunk[Pattern[A]]): Pattern[A]

Destructure a tuple using a pattern for every element

Destructure a tuple using a pattern for every element

Attributes

Inherited from:
PatternModule
final def unitPattern[A](attributes: A): Pattern[A]

Attributes

Inherited from:
PatternModule
final def unitPattern: UPattern

Attributes

Inherited from:
PatternModule
def wildcardPattern[A](attributes: A)(implicit ev: NeedsAttributes[A]): Pattern[A]

Attributes

Inherited from:
PatternModule

Concrete fields

final val Definition: ValueDefinition.type
final val Specification: ValueSpecification.type
final val Value: Value.type
final val unit: RawValue
lazy val unitTyped: TypedValue

Inherited fields

final val Pattern: Pattern.type

Attributes

Inherited from:
PatternModule

Attributes

Inherited from:
PatternModule

Implicits

Implicits

final implicit def RawValueExtensions(self: RawValue): RawValueExtensions