From aa7412ea163ff1219e9188e2114e5d4f34252fd7 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Mon, 14 Aug 2023 15:29:24 -0700 Subject: [PATCH 001/323] Incremental --- .../runtime/src/org/finos/morphir/runtime/Utils.scala | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala index 3a09d80c6..d20860d30 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala @@ -299,15 +299,5 @@ object Utils { curryTypeFunction(Type.Function(getattributes(inner), chunk.head._2, inner), chunk.tail) } - def getattributes[TA](tpe: Type[TA]): TA = - tpe match { - case Type.ExtensibleRecord(attributes, _, _) => attributes - case Type.Function(attributes, _, _) => attributes - case Type.Record(attributes, _) => attributes - case Type.Reference(attributes, _, _) => attributes // TODO: Ignored type arguments here might be an issue - case Type.Tuple(attributes, _) => attributes - case Type.Unit(attributes) => attributes - case Type.Variable(attributes, _) => attributes - } } From 1241f6c3b8e61917c0f980e306aa492765e02ab9 Mon Sep 17 00:00:00 2001 From: EdwardPeters Date: Mon, 14 Aug 2023 16:18:54 -0700 Subject: [PATCH 002/323] Files and templates --- .../finos/morphir/runtime/Distributions.scala | 41 ++ .../finos/morphir/runtime/Extractors.scala | 124 ++++ .../morphir/runtime/MorphirTypeError.scala | 26 + .../finos/morphir/runtime/TypeChecker.scala | 123 ++++ .../src/org/finos/morphir/runtime/Utils.scala | 137 +---- .../runtime/TypeCheckerTests.scala.scala | 579 ++++++++++++++++++ 6 files changed, 898 insertions(+), 132 deletions(-) create mode 100644 morphir/runtime/src/org/finos/morphir/runtime/Distributions.scala create mode 100644 morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala create mode 100644 morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala create mode 100644 morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala create mode 100644 morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Distributions.scala b/morphir/runtime/src/org/finos/morphir/runtime/Distributions.scala new file mode 100644 index 000000000..fcec41585 --- /dev/null +++ b/morphir/runtime/src/org/finos/morphir/runtime/Distributions.scala @@ -0,0 +1,41 @@ +package org.finos.morphir.runtime + +import org.finos.morphir.naming._ +import org.finos.morphir.naming._ +import org.finos.morphir.ir.{Type as T, Value as V} +import org.finos.morphir.ir.Value.{Value, Pattern, TypedValue, USpecification => UValueSpec} +import org.finos.morphir.ir.Type.{Type, UType, USpecification => UTypeSpec} +import org.finos.morphir.ir.sdk +import org.finos.morphir.ir.sdk.Basics +import org.finos.morphir.ir.Field +import org.finos.morphir.runtime.exports.* +import zio.Chunk + +class Distributions(dists: Map[PackageName, Distribution]){ + def lookupModuleSpecification(packageName: PackageName, module: ModuleName): Option[ModSpec.Raw] = + dists.get(packageName) match { + case Some(Library(_, _, packageDef)) => + packageDef.toSpecification.modules.get(module) + case None => None + } + + def lookupValueSpecification( + packageName: PackageName, + module: ModuleName, + localName: Name + ): Option[UValueSpec] = + lookupModuleSpecification(packageName, module).flatMap(_.lookupValueSpecification(localName)) + + def lookupValueSpecification(fqName: FQName): Option[UValueSpec] = {} + + def lookupTypeSpecification(pName: PackageName, module: ModuleName, localName: Name): Option[UTypeSpec] = + lookupModuleSpecification(pName, module).flatMap(_.lookupTypeSpecification(localName)) + + def lookupTypeSpecification(fqName: FQName): Option[UTypeSpec] = {} + def getDists : Map[PackageName, Distribution] = dists +} + +object Distributions { + def apply(dists: Distribution*): Distributions = + new Distributions(dists.map { case (lib: Library) => lib.packageName -> lib }.toMap) +} diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala b/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala new file mode 100644 index 000000000..2f52d298b --- /dev/null +++ b/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala @@ -0,0 +1,124 @@ +package org.finos.morphir.runtime + +import org.finos.morphir.naming._ +import org.finos.morphir.naming._ +import org.finos.morphir.ir.{Type as T, Value as V} +import org.finos.morphir.ir.Value.{Value, Pattern, TypedValue, USpecification => UValueSpec} +import org.finos.morphir.ir.Type.{Type, UType, USpecification => UTypeSpec} +import org.finos.morphir.ir.sdk +import org.finos.morphir.ir.sdk.Basics +import org.finos.morphir.ir.Field +import org.finos.morphir.runtime.exports.* +import zio.Chunk + +object Extractors { + + object FQString { + def unapply(fqName: FQName): Option[String] = Some(fqName.toString()) + } + object Types { + object ListRef { + def unapply(tpe: UType): Option[UType] = + tpe match { + case Type.Reference(_, FQString("Morphir.SDK:List:list"), Chunk(elementType)) => + Some(elementType) + case _ => None + } + } + object MaybeRef { + def unapply(tpe: UType): Option[UType] = + tpe match { + case Type.Reference(_, FQString("Morphir.SDK:Maybe:maybe"), Chunk(elementType)) => + Some(elementType) + case _ => None + } + } + + object ResultRef { + def unapply(tpe: UType): Option[(UType, UType)] = + tpe match { + case Type.Reference(attributes, FQString("Morphir.SDK:Result:result"), Chunk(keyType, valType)) => + Some((keyType, valType)) + case _ => None + } + } + object DictRef { + def unapply(tpe: UType): Option[(UType, UType)] = + tpe match { + case Type.Reference(attributes, FQString("Morphir.SDK:Dict:dict"), Chunk(keyType, valType)) => + Some((keyType, valType)) + case _ => None + } + } + trait CommonReference { + val tpe: UType + def unapply(argTpe: UType): Boolean = + argTpe match { + case Type.Reference(_, fqName, Chunk()) if fqName == tpe.asInstanceOf[Type.Reference[Unit]].typeName => true + case _ => false + } + } + object IntRef extends CommonReference { + final val tpe = Basics.intType + } + object Int32Ref extends CommonReference { + final val tpe = sdk.Int.int32Type + } + object BoolRef extends CommonReference { + final val tpe = Basics.boolType + } + object FloatRef extends CommonReference { + final val tpe = Basics.floatType + } + object DecimalRef extends CommonReference { + final val tpe = sdk.Decimal.decimalType + } + object StringRef extends CommonReference { + final val tpe = sdk.String.stringType + } + object CharRef extends CommonReference { + final val tpe = sdk.Char.charType + } + object LocalDateRef extends CommonReference { + final val tpe = sdk.LocalDate.localDateType + } + object LocalTimeRef extends CommonReference { + final val tpe = sdk.LocalTime.localTimeType + } + // Matches references to known SDK-defined types + object SDKRef { + def unapply(tpe: UType): Boolean = tpe match { + case IntRef() => true + case Int32Ref() => true + case BoolRef() => true + case FloatRef() => true + case StringRef() => true + case CharRef() => true + case LocalDateRef() => true + case LocalTimeRef() => true + case ListRef(_) => true + case MaybeRef(_) => true + case DictRef(_, _) => true + case ResultRef(_, _) => true + case _ => false + } + } + // Extractor object that unwraps a single layer of aliasing, and gives any type names that were bound in the process + class Dealiased(dists: Distributions) { + def unapply(tpe: UType): Option[(UType, Map[Name, UType])] = // If it's aliased we may need to grab bindings + tpe match { + case SDKRef() => None + case Type.Reference(_, typeName, typeArgs) => + val lookedUp = dists.lookupTypeSpecification(typeName.packagePath, typeName.modulePath, typeName.localName) + lookedUp match { + case Some(T.Specification.TypeAliasSpecification(typeParams, expr)) => + val newBindings = typeParams.zip(typeArgs).toMap + Some(expr, newBindings) + case _ => None + } + case _ => None + } + } + } + object Values {} +} diff --git a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala new file mode 100644 index 000000000..2daaef670 --- /dev/null +++ b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala @@ -0,0 +1,26 @@ +package org.finos.morphir.runtime + +import org.finos.morphir.naming._ +import org.finos.morphir.naming._ +import org.finos.morphir.ir.{Type as T, Value as V} +import org.finos.morphir.ir.Value.{Value, Pattern, TypedValue, USpecification => UValueSpec} +import org.finos.morphir.ir.Type.{Type, UType, USpecification => UTypeSpec} +import org.finos.morphir.ir.sdk +import org.finos.morphir.ir.sdk.Basics +import org.finos.morphir.ir.Field +import org.finos.morphir.runtime.exports.* +import zio.Chunk + +trait MorphirTypeError extends MorphirRuntimeError +object MorphirTypeError { + case class TypesMismatch(tpe1: UType, tpe2: UType) extends GoodTypeError("Todo") + case class ArgumentDoesNotMatchParameter(arg: TypedValue, param: TypedValue) extends GoodTypeError("Todo") + case class ImproperType(tpe: UType, message: String) extends GoodTypeError("Todo") + case class TypeMissing(tpe: UType) extends GoodTypeError("Todo") + case class ValueMissing(value: TypedValue) extends GoodTypeError("Todo") + case class ConstructorMissing(fqn: FQName, tpe: UType) extends GoodTypeError("Todo") + case class ModuleMissing(modName: ModuleName) extends GoodTypeError("Todo") + case class PackageMissing(pckName: PackageName) extends GoodTypeError("Todo") + case class Unimplemented(s: String) extends GoodTypeError(s) + +} diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala new file mode 100644 index 000000000..8e399c6ff --- /dev/null +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -0,0 +1,123 @@ +package org.finos.morphir.runtime + +import org.finos.morphir.naming._ +import org.finos.morphir.naming._ +import org.finos.morphir.ir.{Type as T, Value as V} +import org.finos.morphir.ir.Value.{Value, Pattern, TypedValue, USpecification => UValueSpec} +import org.finos.morphir.ir.Type.{Type, UType, USpecification => UTypeSpec} +import org.finos.morphir.ir.sdk +import org.finos.morphir.ir.sdk.Basics +import org.finos.morphir.ir.Field +import org.finos.morphir.runtime.exports.* +import zio.Chunk + +object TypeChecker { + type TypeCheckerResult = List[GoodTypeError] + case class Context( + bindings: Map[Name, UType], + depth: Int, + prefix: String + ) { + def withBindings(bindings: Map[Name, UType]) = this.copy(bindings = bindings) + def withDepth(depth: Int) = this.copy(depth = depth) + def withPrefix(prefix: String) = this.copy(prefix = prefix) + } + object Context { + def empty = Context(Map(), 0, "") + } + def helper(condition: Boolean, error: GoodTypeError) = if (condition) List(error) else List() +} + +class TypeChecker(dists: Distributions) { + private val functionOnion = FunctionOnion(dists) + private def nameThatMismatch(tpe1: UType, tpe2: UType): String = {} + private def nameMissingValue(value: TypedValue, dists: Distributions): MorphirTypeError = {} + private def nameMissingType(fqn: FQName, dists: Distributions): MorphirTypeError = {} + private def nameMissingConstructor(fqn: FQName, tpe: UType, dists: Distributions): MorphirTypeError = {} + private def pretty(tpe: UType, depthBudget: Int): String = {} + private def pretty(tpe: UType): String = pretty(tpe, 2) + def check(suspect: TypedValue): TypeCheckerResult = + check(suspect, Context.empty) + def check(suspect: TypedValue, parentContext: Context) = { + import Value.{Unit as UnitValue, List as ListValue, Field as FieldValue, *} + val context = parentContext.withDepth(parentContext.depth + 1) + suspect match{ + case Literal(tpe, lit) => handleLiteral(tpe, lit, context) + case Apply(tpe, function, argument) => handleApply(tpe, function, argument, store, context) + case Destructure(tpe, pattern, valueToDestruct, inValue) => + handleDestructure(tpe, pattern, valueToDestruct, inValue, store, context) + case Constructor(tpe, name) => handleConstructor(tpe, name, store, context) + case FieldValue(tpe, recordValue, name) => handleField(tpe, recordValue, name, store, context) + case FieldFunction(tpe, name) => handleFieldFunction(tpe, name, context) + case IfThenElse(tpe, condition, thenValue, elseValue) => + handleIfThenElse(tpe, condition, thenValue, elseValue, store, context) + case Lambda(tpe, pattern, body) => handleLambda(tpe, pattern, body, store, context) + case LetDefinition(tpe, name, definition, inValue) => + handleLetDefinition(tpe, name, definition, inValue, store, context) + case LetRecursion(tpe, definitions, inValue) => handleLetRecursion(tpe, definitions, inValue, store, context) + case ListValue(tpe, elements) => handleListValue(tpe, elements.toList, store, context) + case PatternMatch(tpe, value, cases) => handlePatternMatch(tpe, value, cases.toList, store, context) + case Record(tpe, fields) => handleRecord(tpe, fields.toList, store, context) + case Reference(tpe, name) => handleReference(tpe, name, store, context) + case Tuple(tpe, elements) => handleTuple(tpe, elements.toList, store, context) + case UnitValue(va) => handleUnit(va, context) + case UpdateRecord(tpe, valueToUpdate, fields) => handleUpdateRecord(tpe, valueToUpdate, fields, store, context) + case Variable(tpe, name) => handleVariable(tpe, name, store) + } + def handleLiteral(tpe : UType, function: TypedValue, argument : TypedValue, context : Context) : TypeCheckerResult = { + List() + } + def handleApply(tpe : UType, function: TypedValue, argument : TypedValue, context : Context) : TypeCheckerResult = { + List() + } + def handleDestructure(tpe : UType, function: TypedValue, argument : TypedValue, context : Context) : TypeCheckerResult = { + List() + } + def handleConstructor(tpe : UType, function: TypedValue, argument : TypedValue, context : Context) : TypeCheckerResult = { + List() + } + def handleFieldValue(tpe : UType, recordValue : TypedValue, name : Name, context : Context) : TypeCheckerResult = { + List() + } + def handleFieldFunction(tpe : UType, name : Name, context : Context) : TypeCheckerResult = { + List() + } + def handleIfThenElse(tpe : UType, condition : TypedValue, thenValue : TypedValue, elseValue : TypedValue, context : Context) : TypeCheckerResult = { + List() + } + def handleLambda(tpe : UType, pattern, body : TypedValue, context : Context) : TypeCheckerResult = { + List() + } + def handleLetDefinition(tpe : UType, name : Name, definition, inValue : TypedValue, context : Context) : TypeCheckerResult = { + List() + } + def handleLetRecursion(tpe : UType, definitions, inValue : TypedValue, context : Context) : TypeCheckerResult = { + List() + } + def handleListValue(tpe : UType, elements, context : Context) : TypeCheckerResult = { + List() + } + def handlePatternMatch(tpe : UType, value : TypedValue, cases, context : Context) : TypeCheckerResult = { + List() + } + def handleRecord(tpe : UType, fields, context : Context) : TypeCheckerResult = { + List() + } + def handleReference(tpe : UType, fqn : FQName, context : Context) : TypeCheckerResult = { + List() + } + def handleTuple(tpe : UType, elements, context : Context) : TypeCheckerResult = { + List() + } + def handleUnitValue(tpe : UType, context : Context) : TypeCheckerResult = { + List() + } + def handlepdateRecord(tpe : UType, valueToUpdate, fields, context : Context) : TypeCheckerResult = { + List() + } + def handleVariable(tpe : UType, name : Name, context : Context) : TypeCheckerResult = { + List() + } + } + +} diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala index d20860d30..a30de7ed9 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala @@ -4,11 +4,13 @@ import org.finos.morphir.naming.* import org.finos.morphir.naming._ import org.finos.morphir.ir.{Type as T, Value as V} -import V.Value -import T.Type +import org.finos.morphir.ir.Value.{Value, Pattern, TypedValue} +import org.finos.morphir.ir.Type.{Type, UType} +import org.finos.morphir.ir.sdk +import org.finos.morphir.ir.sdk.Basics import org.finos.morphir.ir.Field import org.finos.morphir.runtime.exports.* -import org.finos.morphir.ir.Type.UType +import zio.Chunk import org.finos.morphir.ir.Module.{Specification => ModSpec} import zio.Chunk import org.finos.morphir.ir.sdk.Basics @@ -18,137 +20,8 @@ import org.finos.morphir.ir.sdk import org.finos.morphir.ir.Value.{USpecification => UValueSpec, Definition => ValueDefinition} import org.finos.morphir.ir.Type.{USpecification => UTypeSpec} -class Distributions(dists: Map[PackageName, Distribution]) { - - def lookupModuleSpecification(packageName: PackageName, module: ModuleName): Option[ModSpec.Raw] = - dists.get(packageName) match { - case Some(Library(_, _, packageDef)) => - packageDef.toSpecification.modules.get(module) - case None => None - } - - def lookupValueSpecification( - packageName: PackageName, - module: ModuleName, - localName: Name - ): Option[UValueSpec] = - lookupModuleSpecification(packageName, module).flatMap(_.lookupValueSpecification(localName)) - def lookupTypeSpecification(pName: PackageName, module: ModuleName, localName: Name): Option[UTypeSpec] = - lookupModuleSpecification(pName, module).flatMap(_.lookupTypeSpecification(localName)) -} -object Distributions { - def apply(dists: Distribution*): Distributions = - new Distributions(dists.map { case (lib: Library) => lib.packageName -> lib }.toMap) -} - -object Extractors { - object FQString { - def unapply(fqName: FQName): Option[String] = Some(fqName.toString()) - } - object ListRef { - def unapply(tpe: UType): Option[UType] = - tpe match { - case Type.Reference(_, FQString("Morphir.SDK:List:list"), Chunk(elementType)) => - Some(elementType) - case _ => None - } - } - object MaybeRef { - def unapply(tpe: UType): Option[UType] = - tpe match { - case Type.Reference(_, FQString("Morphir.SDK:Maybe:maybe"), Chunk(elementType)) => - Some(elementType) - case _ => None - } - } - object ResultRef { - def unapply(tpe: UType): Option[(UType, UType)] = - tpe match { - case Type.Reference(attributes, FQString("Morphir.SDK:Result:result"), Chunk(keyType, valType)) => - Some((keyType, valType)) - case _ => None - } - } - object DictRef { - def unapply(tpe: UType): Option[(UType, UType)] = - tpe match { - case Type.Reference(attributes, FQString("Morphir.SDK:Dict:dict"), Chunk(keyType, valType)) => - Some((keyType, valType)) - case _ => None - } - } - trait CommonReference { - val tpe: UType - def unapply(argTpe: UType): Boolean = - argTpe match { - case Type.Reference(_, fqName, Chunk()) if fqName == tpe.asInstanceOf[Type.Reference[Unit]].typeName => true - case _ => false - } - } - object IntRef extends CommonReference { - final val tpe = Basics.intType - } - object Int32Ref extends CommonReference { - final val tpe = sdk.Int.int32Type - } - object BoolRef extends CommonReference { - final val tpe = Basics.boolType - } - object FloatRef extends CommonReference { - final val tpe = Basics.floatType - } - object DecimalRef extends CommonReference { - final val tpe = sdk.Decimal.decimalType - } - object StringRef extends CommonReference { - final val tpe = sdk.String.stringType - } - object CharRef extends CommonReference { - final val tpe = sdk.Char.charType - } - object LocalDateRef extends CommonReference { - final val tpe = sdk.LocalDate.localDateType - } - object LocalTimeRef extends CommonReference { - final val tpe = sdk.LocalTime.localTimeType - } - // Matches references to known SDK-defined types - object SDKRef { - def unapply(tpe: UType): Boolean = tpe match { - case IntRef() => true - case Int32Ref() => true - case BoolRef() => true - case FloatRef() => true - case StringRef() => true - case CharRef() => true - case LocalDateRef() => true - case LocalTimeRef() => true - case ListRef(_) => true - case MaybeRef(_) => true - case DictRef(_, _) => true - case ResultRef(_, _) => true - case _ => false - } - } - // Extractor object that unwraps a single layer of aliasing, and gives any type names that were bound in the process - class Dealiased(dists: Distributions) { - def unapply(tpe: UType): Option[(UType, Map[Name, UType])] = // If it's aliased we may need to grab bindings - tpe match { - case SDKRef() => None - case Type.Reference(_, typeName, typeArgs) => - val lookedUp = dists.lookupTypeSpecification(typeName.packagePath, typeName.modulePath, typeName.localName) - lookedUp match { - case Some(T.Specification.TypeAliasSpecification(typeParams, expr)) => - val newBindings = typeParams.zip(typeArgs).toMap - Some(expr, newBindings) - case _ => None - } - case _ => None - } - } -} object Utils { import Extractors.* diff --git a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala new file mode 100644 index 000000000..d6a02b76b --- /dev/null +++ b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala @@ -0,0 +1,579 @@ +package org.finos.morphir.runtime + +import org.finos.morphir.datamodel.Util.* +import org.finos.morphir.datamodel.* +import org.finos.morphir.ir.Type +import org.finos.morphir.naming.* +import org.finos.morphir.runtime.environment.MorphirEnv +import org.finos.morphir.testing.MorphirBaseSpec +import zio.test.* +import zio.test.TestAspect.{ignore, tag} +import zio.{Console, ZIO, ZLayer} + +object TypeCheckerTests extends MorphirBaseSpec { + type MorphirRuntimeTyped = MorphirRuntime[Unit, Type.UType] + + val morphirRuntimeLayer: ZLayer[Any, Throwable, MorphirRuntime[Unit, Type.UType]] = + ZLayer(for { + irFilePath <- ZIO.succeed(os.pwd / "examples" / "morphir-elm-projects" / "evaluator-tests" / "morphir-ir.json") + _ <- Console.printLine(s"Loading distribution from $irFilePath") + dist <- EvaluationLibrary.loadDistributionFromFileZIO(irFilePath.toString) + } yield MorphirRuntime.quick(dist)) + + val localDate = java.time.LocalDate.of(1900, 1, 20) + val localTime = java.time.LocalTime.of(10, 43, 26) + def deriveData(input: Any): Data = + input match { + case u: Unit => Deriver.toData(u) + case i: Int => Deriver.toData(i) + case s: String => Deriver.toData(s) + case ld: java.time.LocalDate => Deriver.toData(ld) + case lt: java.time.LocalTime => Deriver.toData(lt) + case Right(i: Int) => Data.Result.Ok(Data.Int(i), resultBoolIntShape) + case Left(b: Boolean) => Data.Result.Err(Data.Boolean(b), resultBoolIntShape) + case (i: Int, s: String) => Data.Tuple(Deriver.toData(i), Deriver.toData(s)) + case other => throw new Exception(s"Couldn't derive $other") + } + + def checkEvaluation( + moduleName: String, + functionName: String + )(expected: => Data): ZIO[MorphirRuntimeTyped, Throwable, TestResult] = + runTest(moduleName, functionName).map { actual => + assertTrue(actual == expected) + } + + def checkEvaluation( + moduleName: String, + functionName: String, + value: Any + )(expected: => Data): ZIO[MorphirRuntimeTyped, Throwable, TestResult] = + runTest(moduleName, functionName, value).map { actual => + assertTrue(actual == expected) + } + + def testEvaluation(label: String)(moduleName: String, functionName: String)(expected: => Data) = + test(label) { + checkEvaluation(moduleName, functionName)(expected) + } + + def testEval(label: String)(moduleName: String, functionName: String, value: Any)(expected: => Data) = + test(label) { + checkEvaluation(moduleName, functionName, value)(expected) + } + + def runTest(moduleName: String, functionName: String): ZIO[MorphirRuntimeTyped, Throwable, Data] = + runTest(moduleName, functionName, ()) + def runTest( + moduleName: String, + functionName: String, + value: Any + ): ZIO[MorphirRuntimeTyped, Throwable, Data] = + ZIO.serviceWithZIO[MorphirRuntimeTyped] { runtime => + val fullName = s"Morphir.Examples.App:$moduleName:$functionName" + val data = deriveData(value) + + runtime.evaluate(FQName.fromString(fullName), data) + .provideEnvironment(MorphirEnv.live) + .toZIOWith(RTExecutionContext.default) + } + + val dogRecordConceptRaw = Concept.Struct( + List( + (Label("name"), Concept.String), + (Label("number"), Concept.Int32) + ) + ) + def dogRecordData(name: String, number: Int) = Data.Record( + qn"Morphir/Examples/App:RecordTests:RecordType", + (Label("name"), Data.String(name)), + (Label("number"), Data.Int32(number)) + ) +// val dogRecordConcept = Concept.Alias( +// qn"Morphir/Examples/App:RecordTests:RecordType", +// dogRecordConceptRaw +// ) +// def dogRecordData(name: String, number: Int) = Data.Aliased( +// dogRecordDataRaw(name, number), +// dogRecordConcept +// ) + + def resultStringIntShape = Concept.Result(Concept.String, Concept.Int32) + + def resultBoolIntShape = Concept.Result(Concept.Boolean, Concept.Int32) + def unionEnumShape: Concept.Enum = Concept.Enum( + qn"Morphir/Examples/App:ConstructorTests:UnionType", + List( + Concept.Enum.Case( + Label("OneArg"), + List( + (EnumLabel.Named("arg1"), Concept.Int32) + ) + ), + Concept.Enum.Case( + Label("TwoArg"), + List( + (EnumLabel.Named("arg1"), Concept.Int32), + (EnumLabel.Named("arg2"), Concept.String) + ) + ), + Concept.Enum.Case( + Label("ZeroArg"), + List() + ) + ) + ) + + def typeArgUnionShape(c1: Concept, c2: Concept): Concept.Enum = Concept.Enum( + qn"Morphir/Examples/App:ExampleModule:TypeArgUnion", + List( + Concept.Enum.Case( + Label("B"), + List(Tuple2( + EnumLabel.Named("arg1"), + c2 + )) + ), + Concept.Enum.Case( + Label("AB"), + List( + ( + EnumLabel.Named("arg1"), + c1 + ), + ( + EnumLabel.Named("arg2"), + c2 + ) + ) + ), + Concept.Enum.Case( + Label("A"), + List(( + EnumLabel.Named("arg1"), + c1 + )) + ), + Concept.Enum.Case( + Label("DictBA"), + List(( + EnumLabel.Named("arg1"), + Concept.Map( + c2, + c1 + ) + )) + ), + Concept.Enum.Case( + Label("MaybeA"), + List(( + EnumLabel.Named("arg1"), + Concept.Optional(c1) + )) + ) + ) + ) + + val zeroArg: Data = Data.Case( + List(), + "ZeroArg", + unionEnumShape + ) + def oneArg(i: Int): Data = Data.Case( + List((EnumLabel.Named("arg1"), Data.Int(i))), + "OneArg", + unionEnumShape + ) + def twoArg(i: Int, s: String): Data = Data.Case( + List( + (EnumLabel.Named("arg1"), Data.Int(i)), + (EnumLabel.Named("arg2"), Data.String(s)) + ), + "TwoArg", + unionEnumShape + ) + + def spec = + suite("Evaluator MDM Specs")( + suite("Constructor Tests")( + test("Zero Arg") { + for { + actual <- runTest("constructorTests", "constructorZeroArgTest") + expected = zeroArg + } yield assertTrue(actual == expected) + }, + test("One Arg") { + for { + actual <- runTest("constructorTests", "constructorOneArgAppliedTest") + expected = oneArg(5) + } yield assertTrue(actual == expected) + }, + test("Two Arg") { + for { + actual <- runTest("constructorTests", "constructorTwoArgAppliedTest") + expected = twoArg(5, "Red") + } yield assertTrue(actual == expected) + }, + test("Two Arg Curried") { + for { + actual <- runTest("constructorTests", "constructorTwoArgCurriedTest") + expected = twoArg(5, "Blue") + } yield assertTrue(actual == expected) + }, + test("Lazy Function") { + for { + actual <- runTest("constructorTests", "lazyFunctionTest") + expected = Data.Tuple(Data.Int(5), Data.Int(5)) + } yield assertTrue(actual == expected) + } + ), + suite("Destructure Tests")( + test("As") { + for { + actual <- runTest("destructureTests", "destructureAsTest") + expected = Data.Int(5) + } yield assertTrue(actual == expected) + }, + test("Tuple") { + for { + actual <- runTest("destructureTests", "destructureTupleTest") + expected = Data.Tuple(Data.Int(1), Data.Int(2)) + } yield assertTrue(actual == expected) + }, + test("Constructor") { + for { + actual <- runTest("destructureTests", "destructureConstructorTest") + expected = Data.Tuple(Data.Int(5), Data.String("red")) + } yield assertTrue(actual == expected) + }, + testEvaluation("Unit")("destructureTests", "destructureUnitTest")(Data.Int(4)), + testEvaluation("AsTwice")("destructureTests", "destructureAsTwiceTest")(Data.Tuple(Data.Int(5), Data.Int(5))), + testEvaluation("Tuple Twice")("destructureTests", "destructureTupleTwiceTest")(Data.Tuple( + Data.String("Blue"), + Data.Int(5), + Data.Tuple(Data.Int(5), Data.String("Blue")) + )), + testEvaluation("Directly Nested")("destructureTests", "destructureDirectTest")(Data.Tuple( + Data.Int(6), + Data.String("Green") + )) + ), + suite("IfThenElse Tests")( + testEvaluation("True Branch")("ifThenElseTests", "ifThenElseTrueTest")(Data.String("Correct")), + testEvaluation("False Branch")("ifThenElseTests", "ifThenElseFalseTest")(Data.String("Correct")), + testEvaluation("Else Unevaluated")("ifThenElseTests", "ifThenElseElseBranchUnevaluatedTest")( + Data.String("Correct") + ), + testEvaluation("Then Unevaluated")("ifThenElseTests", "ifThenElseThenBranchUnevaluatedTest")( + Data.String("Correct") + ) + ), + suite("Lambda Tests")( + testEvaluation("As")("lambdaTests", "lambdaAsTest")(Data.Tuple(Data.Int(5), Data.Int(5))), + testEvaluation("Tuple")("lambdaTests", "lambdaTupleTest")(Data.Tuple(Data.Int(0), Data.Int(1))), + testEvaluation("Constructor")("lambdaTests", "lambdaConstructorTest")(Data.Tuple( + Data.String("Red"), + Data.Int(5) + )), + testEvaluation("Unit")("lambdaTests", "lambdaUnitTest")(Data.String("Correct")), + testEvaluation("Directly Nested")("lambdaTests", "lambdaDirectTest")(Data.Tuple(Data.Int(0), Data.Int(1))), + testEvaluation("Scope")("lambdaTests", "lambdaScopeTest")(Data.Tuple( + Data.Int(3), + Data.Tuple(Data.Int(4), Data.Int(5)) + )), + testEvaluation("Higher Order")("lambdaTests", "lambdaHigherOrderTest")(Data.Tuple( + Data.Int(3), + Data.Int(4), + Data.Int(5) + )), + testEvaluation("User Defined Constructor")("lambdaTests", "lambdaUserDefinedTest")(Data.Tuple( + Data.Int(5), + Data.String("Red") + )) + ), + suite("Let Definition")( + testEvaluation("Make Tuple")("letDefinitionTests", "letDefinitionMakeTupleTest")(Data.Tuple( + Data.Int(1), + Data.Int(1) + )), + testEvaluation("Nested")("letDefinitionTests", "letDefinitionNestedTest")(Data.Tuple(Data.Int(2), Data.Int(2))), + testEvaluation("Simple Function")("letDefinitionTests", "letDefinitionSimpleFunctionTest")(Data.Tuple( + Data.Int(3), + Data.Int(3) + )), + testEvaluation("Two Argument Function")("letDefinitionTests", "letDefinitionTwoArgFunctionFunctionTest")( + Data.Tuple( + Data.Int(3), + Data.Int(2) + ) + ), + testEvaluation("Curried Function")("letDefinitionTests", "letDefinitionCurriedTest")(Data.Tuple( + Data.Int(2), + Data.Int(0) + )), + testEvaluation("Apply Twice")("letDefinitionTests", "letDefinitionApplyTwiceTest")(Data.Tuple( + Data.Tuple(Data.Int(1), Data.Int(0)), + Data.Tuple(Data.Int(2), Data.Int(0)) + )), + testEvaluation("Only runs if applied")("letDefinitionTests", "letDefinitionDoNotRunTest")( + Data.String("Correct") + ), + testEvaluation("Lexical scope")("letDefinitionTests", "letDefinitionScopeTest")(Data.Tuple( + Data.Int(3), + Data.Tuple(Data.Int(4), Data.Int(5)) + )) + ), + suite("Let Recursion")( + testEvaluation("Fibbonacci")("letRecursionTests", "letRecursionFibonacciTest")(Data.Int(34)), + testEvaluation("Mutual Recursion")("letRecursionTests", "letRecursionMutualTest")(Data.Tuple( + Data.Int(8), + Data.Int(9) + )) + ), + suite("Lists")( + testEvaluation("Empty")("listTests", "listEmptyTest")(Data.List(List(), Concept.Int32)), + testEvaluation("Single")("listTests", "listSingleTest")(Data.List(Data.Int(0))), + testEvaluation("Several")("listTests", "listSeveralTest")(Data.List( + Data.Int(0), + Data.Int(1), + Data.Int(2), + Data.Int(3), + Data.Int(4), + Data.Int(5) + )), + testEvaluation("Nested")("listTests", "listNestedTest")(Data.List( + Data.List(Data.String("Red"), Data.String("Blue")), + Data.List(List(), Concept.String), + Data.List(Data.String("Car"), Data.String("Plane"), Data.String("Truck")) + )), + testEvaluation("Concat")("listTests", "listConcatTest")(Data.List( + Data.Int(1), + Data.Int(2), + Data.Int(3), + Data.Int(4), + Data.Int(5) + )), + testEvaluation("Flatten")("listTests", "listFlattenTest")(Data.List( + Data.String("Red"), + Data.String("Blue"), + Data.String("Car"), + Data.String("Plane"), + Data.String("Truck") + )), + testEvaluation("Map")("listTests", "listMapTest")(Data.List( + Data.Decimal(3.0), + Data.Decimal(4.0), + Data.Decimal(5.0) + )), + testEvaluation("Singleton")("listTests", "listSingletonTest")( + Data.List(Data.Int(6)) + ) @@ ignore @@ TestAspect.tag("Not Implemented yet") + ), + suite("Literals")( + testEvaluation("String")("literalTests", "litStringTest")(Data.String("Bloop")), + testEvaluation("Float")("literalTests", "litFloatTest")(Data.Decimal(scala.BigDecimal("5.0"))), + testEvaluation("Char")("literalTests", "litCharTest")(Data.Char('f')), + testEvaluation("Boolean")("literalTests", "litBoolTest")(Data.Boolean(true)), + testEvaluation("Whole Number")("literalTests", "litWholeNumberLiteralTest")(Data.Int(5)) + ), + suite("LocalDate")( + // TODO: Need to fix implementation of Optional LocalDate + testEvaluation("fromParts")("localDateTests", "fromPartsTest")( + Data.Optional.Some(Data.LocalDate(localDate)) + ) @@ ignore @@ TestAspect.tag("Not Implemented yet") + ), + suite("LocalTime")( + testEvaluation("fromMilliseconds")("localTimeTests", "fromMillisecondsTest")(Data.LocalTime(localTime)) + ), + suite("Native References")( + testEvaluation("Map")("nativeReferenceTests", "nativeReferenceMapTest")(Data.List( + Data.Tuple(Data.Int(1), Data.Int(1)), + Data.Tuple(Data.Int(2), Data.Int(2)), + Data.Tuple(Data.Int(3), Data.Int(3)) + )), + testEvaluation("Add")("nativeReferenceTests", "nativeReferenceAddTest")(Data.Int(3)), +// test("Curried Log") { +// val actual = runTest("nativeReferenceTests", "nativeReferenceCurriedLogTest") +// val expected = Double.PositiveInfinity +// assertTrue(actual == expected) +// }, //No DDL equivalent + testEvaluation("Pi")("nativeReferenceTests", "nativeReferencePiTest")(Data.Decimal(scala.BigDecimal("3"))), + testEval("ModBy")("nativeReferenceTests", "nativeReferenceModByTest", 7)( + Data.Int(1) + ) /* @@ TestAspect.ignore @@ TestAspect.tag("ignore until we complete wiring up native functions")*/ + ), + suite("Morphir Types")( + testEval("LocalDate")("nativeReferenceTests", "localDatePassthrough", localDate)(Data.LocalDate(localDate)), + testEval("LocalDate")("nativeReferenceTests", "localTimePassthrough", localTime)(Data.LocalTime(localTime)) + ), + suite("Patern Matching")( + testEvaluation("Wildcard")("patternMatchTests", "patternMatchWildcardTest")(Data.String("Correct")), + testEvaluation("Tuple")("patternMatchTests", "patternMatchTupleTest")(Data.String("Correct")), + testEvaluation("Constructor")("patternMatchTests", "patternMatchConstructorTest")(Data.String("Correct")), + testEvaluation("Zero Arg Constructor")("patternMatchTests", "patternMatchEmptyListTest")( + Data.String("Correct") + ), + testEvaluation("Head Tail")("patternMatchTests", "patternMatchHeadTailTest")(Data.Tuple( + Data.String("Dog"), + Data.String("Red") + )), + testEvaluation("Literal")("patternMatchTests", "patternMatchLiteralTest")(Data.String("Correct")), + testEvaluation("Repeated As")("patternMatchTests", "patternMatchRepeatedAsTest")(Data.Tuple( + Data.Int(2), + Data.Tuple(Data.Int(1), Data.Int(2)) + )) + ), + suite("Records")( + testEvaluation("Field")("recordTests", "recordFieldTest")(Data.String("Correct")), + testEvaluation("Field from Bound Record")("recordTests", "recordFieldFromBoundTest")(Data.String("Correct")), + testEvaluation("Field Function Apply")("recordTests", "fieldFunctionApplyTest")(Data.String("Correct")), + testEvaluation("Field Function Apply Twice")("recordTests", "fieldFunctionApplyTwiceTest")(Data.Tuple( + Data.Int(1), + Data.Int(2) + )), + testEvaluation("Field")("recordTests", "fieldFunctionMapTest")(Data.List( + Data.String("Soso"), + Data.String("Ponyo"), + Data.String("Odin") + )), + testEvaluation("Simple Record")("recordTests", "recordSimpleTest")(dogRecordData("Fido", 5)), + testEvaluation("Nested Record")("recordTests", "recordNestedTest")(Data.Record( + qn"Morphir/Examples/App:RecordTests:NestedRecordType", + (Label("name"), Data.String("Dogs")), + ( + Label("records"), + Data.List( + dogRecordData("Ponyo", 3), + dogRecordData("Soso", 3) + ) + ) + )), + testEvaluation("Record Update Single Field")("recordTests", "updateRecordSimpleTest")(Data.String("Soso")), + testEvaluation("Record Update Full")("recordTests", "updateRecordFullTest")(dogRecordData("Soso", 5)), + testEvaluation("Record Updates are not mutation")("recordTests", "updateRecordImmutableTest")( + Data.List( + dogRecordData("Soso", 4), + dogRecordData("Ponyo", 5) + ) + ) + ), + suite("Simple")( + testEvaluation("Unit")("simpleTests", "simpleUnitTest")(Data.Unit) + ), + suite("Simple[Tuple]")( + testEvaluation("Tuple(2)")("tupleTests", "tupleTwoTest")(Data.Tuple(List(Data.Int(5), Data.Int(4)))), + testEvaluation("Tuple(3)")("tupleTests", "tupleThreeTest")(Data.Tuple( + Data.Int(0), + Data.Boolean(true), + Data.String("Green") + )), + testEvaluation("Nested Tuple")("tupleTests", "tupleNestedTest")(Data.Tuple( + Data.Int(5), + Data.Tuple( + Data.String("Four"), + Data.Tuple(Data.Int(4), Data.String("Five")) + ) + )) + ), + suite("References To user Defined Members")( + testEvaluation("Reference to value")("userDefinedReferenceTests", "userDefinedReferenceValueTest")(Data.Int(5)), + testEvaluation("Curried Function Application")("userDefinedReferenceTests", "userDefinedReferenceCurriedTest")( + Data.String("Correct") + ), + testEvaluation("Simple Function Application")( + "userDefinedReferenceTests", + "userDefinedReferenceSimpleFunctionTest" + )(Data.Tuple(List( + Data.Int(1), + Data.Int(2) + ))), + testEvaluation("Calling public function which calls private function")( + "userDefinedReferenceTests", + "userDefinedReferencePublicPrivateTest" + )(Data.Int(10)), + testEvaluation("Reference to Record")("userDefinedReferenceTests", "userDefinedReferenceRecordTest")( + Data.String("Tom Tit Tot") + ), + testEvaluation("Reference to Union Type")("userDefinedReferenceTests", "userDefinedReferenceUnionTest")( + Data.Int(-6) + ), + testEval("Reference to Union with type args")( + "userDefinedReferenceTests", + "typeArgUnionTest", + (1, "Red") + )(Data.Case( + List( + (EnumLabel.Named("arg1"), Data.Int(1)), + (EnumLabel.Named("arg2"), Data.String("Red")) + ), + "Morphir.Examples.App:ExampleModule:aB", + typeArgUnionShape(Concept.Int32, Concept.String) + )) @@ ignore @@ tag("Failing because of non-matching order of union cases") + ), + suite("Dictionary Tests")( + testEvaluation("Returns a dictionary")("dictionaryTests", "returnDictionaryTest")(Data.Map( + (Data.Int(1), Data.String("Red")), + (Data.Int(2), Data.String("Blue")) + )), + testEvaluation("Get")("dictionaryTests", "dictGetTest")(Data.Optional.Some(Data.String("Cat"))) + ), + suite("Optional Tests")( + testEvaluation("Returns a Just 1")("optionTests", "returnJustIntTest")(Data.Optional.Some(Data.Int(1))), + testEvaluation("Option String")("optionTests", "returnJustStringTest")( + Data.Optional.Some(Data.String("Hello")) + ), + testEvaluation("Returns a None")("optionTests", "returnNoneIntTest")(Data.Optional.None(Concept.Int32)), + testEval("Returns success result")("optionTests", "returnResultType", 0)(Data.Result.Ok( + Data.Int(0), + resultStringIntShape + )), + testEval("Returns error result")("optionTests", "returnResultType", -1)(Data.Result.Err( + Data.String("Negative"), + resultStringIntShape + )), + testEval("Resolves success input")("optionTests", "resolveResultType", Right(5))(Data.Int(5)), + testEval("Resolves error input")("optionTests", "resolveResultType", Left(true))(Data.Int(1)) + ), + suite("SDK Basics Tests")( + testEvaluation("Plus")("sdkBasicsTests", "sdkAddTest")(Data.Int(3)), + testEvaluation("Minus")("sdkBasicsTests", "sdkSubtractTest")(Data.Int(2)), + testEvaluation("Divide")("sdkBasicsTests", "sdkDivideTest")(Data.Decimal(2.0)), + testEvaluation("ModBy")("sdkBasicsTests", "sdkModByTest")(Data.Int(2)), + testEvaluation("And")("sdkBasicsTests", "sdkAndTest")(Data.Boolean(false)), + testEvaluation("LessThanInt")("sdkBasicsTests", "sdkLessThanTestInt")(Data.Boolean(true)), + testEvaluation("ToFloat")("sdkBasicsTests", "toFloatTest")(Data.Decimal(2.0)), + testEvaluation("Negate")("sdkBasicsTests", "sdkNegateTest")(Data.Int(-3)), + testEvaluation("Negate")("sdkBasicsTests", "sdkNegateTest2")(Data.Int(3)), + testEvaluation("Equal")("sdkBasicsTests", "sdkEqualTest")(Data.Boolean(true)), + testEvaluation("Equal")("sdkBasicsTests", "sdkEqualTest2")(Data.Boolean(true)), + testEvaluation("Equal")("sdkBasicsTests", "sdkEqualTest3")(Data.Boolean(true)), + testEvaluation("Equal")("sdkBasicsTests", "sdkEqualTest4")(Data.Boolean(true)), + testEvaluation("Equal")("sdkBasicsTests", "sdkEqualTest5")(Data.Boolean(true)), + testEvaluation("Equal")("sdkBasicsTests", "sdkEqualTest6")(Data.Boolean(true)), + testEvaluation("Equal")("sdkBasicsTests", "sdkEqualTest7")(Data.Boolean(true)), + testEvaluation("Or")("sdkBasicsTests", "sdkOrTest")(Data.Boolean(true)), + testEvaluation("LogBase")("sdkBasicsTests", "sdkLogBaseTest")(Data.Decimal(2.0)), + testEvaluation("Plus overflow")("sdkBasicsTests", "sdkIntOverflowTest")( + Data.Int(3) + ) @@ ignore @@ TestAspect.tag("Not Implemented yet"), + testEvaluation("Plus Float")("sdkBasicsTests", "sdkAddFloatTest")( + Data.Decimal(3.0) + ) @@ ignore @@ TestAspect.tag("Not Implemented yet"), + testEvaluation("Multiply")("sdkBasicsTests", "sdkMultiplyTest")(Data.Int(6)) @@ ignore @@ TestAspect.tag( + "Not Implemented yet" + ), + testEvaluation("Integer Divide")("sdkBasicsTests", "sdkIntegerDivideTest")( + Data.Decimal(2.0) + ) @@ ignore @@ TestAspect.tag("Not Implemented yet"), + testEvaluation("Divide by 0")("sdkBasicsTests", "sdkDivideByZeroTest")( + Data.Decimal(2.0) + ) @@ ignore @@ TestAspect.tag("Not Implemented yet"), + testEvaluation("LessThanFloat")("sdkBasicsTests", "sdkLessThanTestFloat")( + Data.Boolean(true) + ) @@ ignore @@ TestAspect.tag("Not Implemented yet"), + testEvaluation("LessThanChar")("sdkBasicsTests", "sdkLessThanTestChar")( + Data.Boolean(true) + ) @@ ignore @@ TestAspect.tag("Not Implemented yet") + ) + ).provideLayerShared(morphirRuntimeLayer) +} From eabdb56701b4fb74338571ae642760d2d6cc6d8e Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Mon, 14 Aug 2023 16:30:18 -0700 Subject: [PATCH 003/323] Helper function --- .../runtime/EvaluationLibraryPlatformSpecific.scala | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/morphir/runtime/jvm/src/org/finos/morphir/runtime/EvaluationLibraryPlatformSpecific.scala b/morphir/runtime/jvm/src/org/finos/morphir/runtime/EvaluationLibraryPlatformSpecific.scala index 96d802b31..3310592fc 100644 --- a/morphir/runtime/jvm/src/org/finos/morphir/runtime/EvaluationLibraryPlatformSpecific.scala +++ b/morphir/runtime/jvm/src/org/finos/morphir/runtime/EvaluationLibraryPlatformSpecific.scala @@ -52,4 +52,11 @@ trait EvaluationLibraryPlatformSpecific { .mapError(MorphirIRDecodingError(_)) } yield morphirIRFile.distribution + def loadValueFromFileZIO(fileName: String): Task[TypedValue] = + for { + fileContents <- ZIO.readFile(fileName) + value <- ZIO.fromEither(fileContents.fromJson[TypedValue]) + .mapError(MorphirIRDecodingError(_)) + } yield value + } From 36584110f77ccfa2f42cbdc44f7da3665e9f6426 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Mon, 14 Aug 2023 16:31:42 -0700 Subject: [PATCH 004/323] Combined errors --- .../src/org/finos/morphir/runtime/MorphirRuntimeError.scala | 3 +++ 1 file changed, 3 insertions(+) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntimeError.scala b/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntimeError.scala index 62fafceb8..82ccd9236 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntimeError.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntimeError.scala @@ -9,6 +9,7 @@ final case class MorphirIRDecodingError(message: String) extends MorphirRuntimeE sealed abstract class EvaluationError(message: String) extends MorphirRuntimeError(message) sealed abstract class TypeError(message: String) extends MorphirRuntimeError(message) + final case class UnsupportedType(message: String) extends TypeError(message) final case class TooManyArgs(message: String) extends TypeError(message) final case class NativeFunctionTypeError(message: String) extends TypeError(message) @@ -17,6 +18,8 @@ final case class InferenceConflict(message: String) extends TypeError(mess final case class NotImplementedType(message: String) extends TypeError(message) final case class TypeMismatch(message: String) extends TypeError(message) final case class TypeNotFound(message: String) extends TypeError(message) +final case class ManyErrors(errors : TypeError*) extends TypeError("\n"+errors.map(_.toString).mkString("\n")) +final case class TypeCheckerErrors(errors : List[GoodTypeError]) extends EvaluationError("\n"+errors.map(_.toString).mkString("\n")) final case class IrToDatamodelError(message: String) extends EvaluationError(message) final case class MissingField(message: String) extends EvaluationError(message) From 6abe38dcad6b59c5e8af00eceffdf3ead5d7dcd6 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Mon, 14 Aug 2023 16:35:18 -0700 Subject: [PATCH 005/323] Type checker call site --- .../morphir/runtime/quick/QuickMorphirRuntime.scala | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala b/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala index 41ccbda3d..7ffc5927c 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala @@ -32,7 +32,13 @@ private[runtime] case class QuickMorphirRuntime(dists: Distributions, store: Sto } yield res def evaluate(value: Value[scala.Unit, UType]): RTAction[MorphirEnv, EvaluationError, Data] = - EvaluatorQuick.evalAction(value, store, dists) + val errors = new TypeChecker(dists).check(value) + for { + ctx <- ZPure.get[RTExecutionContext] + _ <- if (errors.length == 0) RTAction.succeed(()) else RTAction.fail(TypeCheckerErrors(errors)) + res <- EvaluatorQuick.evalAction(value, store, dists) + } yield res + def fetchType(ref: FQName): RTAction[MorphirEnv, MorphirRuntimeError, UType] = { val (pkg, mod, loc) = (ref.getPackagePath, ref.getModulePath, ref.localName) @@ -53,7 +59,7 @@ private[runtime] case class QuickMorphirRuntime(dists: Distributions, store: Sto entryPoint match { case Value.Reference.Typed(tpe, entryName) => for { - tpe <- unCurryTypeFunction(tpe, params.toList.map(_.attributes), dists, Map())(ctx.options) + tpe <- unCurryTypeFunction(tpe, params.toList, dists, Map())(ctx.options) } yield V.apply(tpe, entryPoint, params.head, params.tail: _*) case other => RTAction.fail(UnsupportedType(s"Entry point must be a Reference, instead found $other")) } From 5267202fa54309d3edc2ff7a14842bfba53ac030 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Mon, 14 Aug 2023 16:42:13 -0700 Subject: [PATCH 006/323] Incremental --- morphir/src/org/finos/morphir/runtime/MorphirRuntimeError.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/morphir/src/org/finos/morphir/runtime/MorphirRuntimeError.scala b/morphir/src/org/finos/morphir/runtime/MorphirRuntimeError.scala index b086c7b46..6ee138af9 100644 --- a/morphir/src/org/finos/morphir/runtime/MorphirRuntimeError.scala +++ b/morphir/src/org/finos/morphir/runtime/MorphirRuntimeError.scala @@ -21,7 +21,7 @@ final case class VariableNotFound(message: String) extends VariableAcc final case class DefinitionNotFound(message: String) extends EvaluationError(message) final case class SpecificationNotFound(message: String) extends EvaluationError(message) final case class ConstructorNotFound(message: String) extends EvaluationError(message) -final case class TypeNotFound(message: String) extends EvaluationError(message) +//final case class TypeNotFound(message: String) extends EvaluationError(message) final case class ResultDoesNotMatchType(message: String) extends EvaluationError(message) final case class FunctionReturnedToTopLevel(message: String) extends EvaluationError(message) final case class UnsupportedTypeParameter(message: String) extends EvaluationError(message) From 71043bacc356b8422c016b783e618fefee02f634 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Mon, 14 Aug 2023 16:43:31 -0700 Subject: [PATCH 007/323] Incremental --- .../runtime/src/org/finos/morphir/runtime/quick/Result.scala | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/quick/Result.scala b/morphir/runtime/src/org/finos/morphir/runtime/quick/Result.scala index 0f218592a..db034b77d 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/quick/Result.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/quick/Result.scala @@ -6,7 +6,10 @@ import org.finos.morphir.ir.Value.Value.{List as ListValue, Unit as UnitValue, * import org.finos.morphir.ir.Value.{Pattern, Value} import Name.toTitleCase -sealed trait Result[TA, VA] +sealed trait Result[TA, VA]{ + def succinct(depth : Int) : String = s"${this.getClass} (Default implementation)" + def succinct : String = succinct(2) +} object Result { From 38491af391cc20bdb7d35933d09a7400f3fcf27a Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Mon, 14 Aug 2023 16:44:12 -0700 Subject: [PATCH 008/323] Incremental --- .../src/org/finos/morphir/runtime/quick/Result.scala | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/quick/Result.scala b/morphir/runtime/src/org/finos/morphir/runtime/quick/Result.scala index db034b77d..0bc606424 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/quick/Result.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/quick/Result.scala @@ -30,8 +30,14 @@ object Result { s"$other returned to top level, only Unit, Primitive, List, Tuples, Constructed Types and Records are supported" ) } - case class Unit[TA, VA]() extends Result[TA, VA] - case class Primitive[TA, VA](value: Any) extends Result[TA, VA] + + case class Unit[TA, VA]() extends Result[TA, VA] { + override def succinct(depth: Int) = "Unit" + } + + case class Primitive[TA, VA](value: Any) extends Result[TA, VA] { + override def succinct(depth: Int) = s"Primitive($value)" + } case class LocalDate[TA, VA](value: java.time.LocalDate) extends Result[TA, VA] From 9501de35e4dc3f5f56811a308fd9f86bce967278 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Mon, 14 Aug 2023 16:44:35 -0700 Subject: [PATCH 009/323] Incremental --- .../src/org/finos/morphir/runtime/quick/Result.scala | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/quick/Result.scala b/morphir/runtime/src/org/finos/morphir/runtime/quick/Result.scala index 0bc606424..d011592dc 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/quick/Result.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/quick/Result.scala @@ -39,10 +39,13 @@ object Result { override def succinct(depth: Int) = s"Primitive($value)" } - case class LocalDate[TA, VA](value: java.time.LocalDate) extends Result[TA, VA] - - case class LocalTime[TA, VA](value: java.time.LocalTime) extends Result[TA, VA] + case class LocalDate[TA, VA](value: java.time.LocalDate) extends Result[TA, VA] { + override def succinct(depth: Int) = s"LocalDate($value)" + } + case class LocalTime[TA, VA](value: java.time.LocalTime) extends Result[TA, VA] { + override def succinct(depth: Int) = s"LocalTime($value)" + } case class Tuple[TA, VA](elements: Any) extends Result[TA, VA] case class Record[TA, VA](elements: Map[Name, Result[TA, VA]]) extends Result[TA, VA] From 8737ec16843818737040579025a9d002285f40d2 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Mon, 14 Aug 2023 16:44:58 -0700 Subject: [PATCH 010/323] Incremental --- .../src/org/finos/morphir/runtime/quick/Result.scala | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/quick/Result.scala b/morphir/runtime/src/org/finos/morphir/runtime/quick/Result.scala index d011592dc..e33bd3a24 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/quick/Result.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/quick/Result.scala @@ -46,10 +46,18 @@ object Result { case class LocalTime[TA, VA](value: java.time.LocalTime) extends Result[TA, VA] { override def succinct(depth: Int) = s"LocalTime($value)" } - case class Tuple[TA, VA](elements: Any) extends Result[TA, VA] - case class Record[TA, VA](elements: Map[Name, Result[TA, VA]]) extends Result[TA, VA] + case class Tuple[TA, VA](elements: Any) extends Result[TA, VA] { + override def succinct(depth: Int) = if (depth == 0) "Tuple(...)" else { + s"Tuple(${Helpers.tupleToList(elements).map(_.asInstanceOf[Result[TA, VA]]).map(_.succinct(depth - 1)).mkString(", ")})" + } + } + case class Record[TA, VA](elements: Map[Name, Result[TA, VA]]) extends Result[TA, VA] { + override def succinct(depth: Int) = if (depth == 0) "Record(..)" else { + s"Record(${elements.map { case (key, value) => s"$key -> ${value.succinct(depth - 1)}" }.mkString(", ")})" + } + } case class ListResult[TA, VA](elements: List[Result[TA, VA]]) extends Result[TA, VA] case class MapResult[TA, VA](elements: Map[Result[TA, VA], Result[TA, VA]]) extends Result[TA, VA] From 1e9e0a31524c6c123c1a0c9f51fcfe2ab79f0a62 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Mon, 14 Aug 2023 16:45:26 -0700 Subject: [PATCH 011/323] Incremental --- .../org/finos/morphir/runtime/quick/Result.scala | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/quick/Result.scala b/morphir/runtime/src/org/finos/morphir/runtime/quick/Result.scala index e33bd3a24..5f5bb8b24 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/quick/Result.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/quick/Result.scala @@ -58,9 +58,18 @@ object Result { s"Record(${elements.map { case (key, value) => s"$key -> ${value.succinct(depth - 1)}" }.mkString(", ")})" } } - case class ListResult[TA, VA](elements: List[Result[TA, VA]]) extends Result[TA, VA] - case class MapResult[TA, VA](elements: Map[Result[TA, VA], Result[TA, VA]]) extends Result[TA, VA] + case class ListResult[TA, VA](elements: List[Result[TA, VA]]) extends Result[TA, VA] { + override def succinct(depth: Int) = if (depth == 0) "List(..)" else { + s"List(${elements.map(value => value.succinct(depth - 1)).mkString(", ")})" + } + } + + case class MapResult[TA, VA](elements: Map[Result[TA, VA], Result[TA, VA]]) extends Result[TA, VA] { + override def succinct(depth: Int) = if (depth == 0) "Dict(..)" else { + s"Dict(${elements.map { case (key, value) => s"${key.succinct(depth - 1)} -> ${value.succinct(depth - 1)}" }.mkString(", ")})" + } + } case class Applied[TA, VA]( body: Value[TA, VA], curried: List[(Name, Result[TA, VA])], From 90928059b6ac6f5b3532811524412633bd81e28f Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Mon, 14 Aug 2023 16:46:01 -0700 Subject: [PATCH 012/323] Incremental --- .../src/org/finos/morphir/runtime/quick/Result.scala | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/quick/Result.scala b/morphir/runtime/src/org/finos/morphir/runtime/quick/Result.scala index 5f5bb8b24..af6a9cc89 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/quick/Result.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/quick/Result.scala @@ -90,7 +90,12 @@ object Result { case class ConstructorFunction[TA, VA](name: FQName, arguments: List[VA], curried: List[Result[TA, VA]]) extends Result[TA, VA] - case class ConstructorResult[TA, VA](name: FQName, values: List[Result[TA, VA]]) extends Result[TA, VA] + + case class ConstructorResult[TA, VA](name: FQName, values: List[Result[TA, VA]]) extends Result[TA, VA] { + override def succinct(depth: Int) = if (depth == 0) s"${name.toString}(..)" else { + s"${name.toString}(${values.map(value => value.succinct(depth - 1)).mkString(", ")})" + } + } case class NativeFunction[TA, VA](arguments: Int, curried: List[Result[TA, VA]], function: Any) extends Result[TA, VA] {} From 13a35a3d57570459cd058f84183585a629d4f500 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Mon, 14 Aug 2023 16:50:57 -0700 Subject: [PATCH 013/323] Formatting --- .../finos/morphir/runtime/Distributions.scala | 4 ++-- .../morphir/runtime/MorphirRuntimeError.scala | 6 ++--- .../finos/morphir/runtime/TypeChecker.scala | 12 +++++----- .../src/org/finos/morphir/runtime/Utils.scala | 4 ---- .../runtime/quick/QuickMorphirRuntime.scala | 3 +-- .../finos/morphir/runtime/quick/Result.scala | 21 +++++++++++------- .../morphir/runtime/MorphirRuntimeError.scala | 22 +++++++++---------- 7 files changed, 36 insertions(+), 36 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Distributions.scala b/morphir/runtime/src/org/finos/morphir/runtime/Distributions.scala index fcec41585..7b9c65dbf 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Distributions.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Distributions.scala @@ -11,7 +11,7 @@ import org.finos.morphir.ir.Field import org.finos.morphir.runtime.exports.* import zio.Chunk -class Distributions(dists: Map[PackageName, Distribution]){ +class Distributions(dists: Map[PackageName, Distribution]) { def lookupModuleSpecification(packageName: PackageName, module: ModuleName): Option[ModSpec.Raw] = dists.get(packageName) match { case Some(Library(_, _, packageDef)) => @@ -32,7 +32,7 @@ class Distributions(dists: Map[PackageName, Distribution]){ lookupModuleSpecification(pName, module).flatMap(_.lookupTypeSpecification(localName)) def lookupTypeSpecification(fqName: FQName): Option[UTypeSpec] = {} - def getDists : Map[PackageName, Distribution] = dists + def getDists: Map[PackageName, Distribution] = dists } object Distributions { diff --git a/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntimeError.scala b/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntimeError.scala index 82ccd9236..f86d86502 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntimeError.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntimeError.scala @@ -9,7 +9,6 @@ final case class MorphirIRDecodingError(message: String) extends MorphirRuntimeE sealed abstract class EvaluationError(message: String) extends MorphirRuntimeError(message) sealed abstract class TypeError(message: String) extends MorphirRuntimeError(message) - final case class UnsupportedType(message: String) extends TypeError(message) final case class TooManyArgs(message: String) extends TypeError(message) final case class NativeFunctionTypeError(message: String) extends TypeError(message) @@ -18,8 +17,9 @@ final case class InferenceConflict(message: String) extends TypeError(mess final case class NotImplementedType(message: String) extends TypeError(message) final case class TypeMismatch(message: String) extends TypeError(message) final case class TypeNotFound(message: String) extends TypeError(message) -final case class ManyErrors(errors : TypeError*) extends TypeError("\n"+errors.map(_.toString).mkString("\n")) -final case class TypeCheckerErrors(errors : List[GoodTypeError]) extends EvaluationError("\n"+errors.map(_.toString).mkString("\n")) +final case class ManyErrors(errors: TypeError*) extends TypeError("\n" + errors.map(_.toString).mkString("\n")) +final case class TypeCheckerErrors(errors: List[GoodTypeError]) + extends EvaluationError("\n" + errors.map(_.toString).mkString("\n")) final case class IrToDatamodelError(message: String) extends EvaluationError(message) final case class MissingField(message: String) extends EvaluationError(message) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 8e399c6ff..5f9345b4f 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -3,7 +3,7 @@ package org.finos.morphir.runtime import org.finos.morphir.naming._ import org.finos.morphir.naming._ import org.finos.morphir.ir.{Type as T, Value as V} -import org.finos.morphir.ir.Value.{Value, Pattern, TypedValue, USpecification => UValueSpec} +import org.finos.morphir.ir.Value.{Value, Pattern, TypedValue, USpecification => UValueSpec, UDefinition => UValueDef} import org.finos.morphir.ir.Type.{Type, UType, USpecification => UTypeSpec} import org.finos.morphir.ir.sdk import org.finos.morphir.ir.sdk.Basics @@ -85,19 +85,19 @@ class TypeChecker(dists: Distributions) { def handleIfThenElse(tpe : UType, condition : TypedValue, thenValue : TypedValue, elseValue : TypedValue, context : Context) : TypeCheckerResult = { List() } - def handleLambda(tpe : UType, pattern, body : TypedValue, context : Context) : TypeCheckerResult = { + def handleLambda(tpe : UType, pattern : Pattern, body : TypedValue, context : Context) : TypeCheckerResult = { List() } - def handleLetDefinition(tpe : UType, name : Name, definition, inValue : TypedValue, context : Context) : TypeCheckerResult = { + def handleLetDefinition(tpe : UType, name : Name, definition : UValueDef, inValue : TypedValue, context : Context) : TypeCheckerResult = { List() } - def handleLetRecursion(tpe : UType, definitions, inValue : TypedValue, context : Context) : TypeCheckerResult = { + def handleLetRecursion(tpe : UType, definitions: Map[Name, UValueDef], inValue : TypedValue, context : Context) : TypeCheckerResult = { List() } - def handleListValue(tpe : UType, elements, context : Context) : TypeCheckerResult = { + def handleListValue(tpe : UType, elements : List[TypedValue], context : Context) : TypeCheckerResult = { List() } - def handlePatternMatch(tpe : UType, value : TypedValue, cases, context : Context) : TypeCheckerResult = { + def handlePatternMatch(tpe : UType, value : TypedValue, cases : , context : Context) : TypeCheckerResult = { List() } def handleRecord(tpe : UType, fields, context : Context) : TypeCheckerResult = { diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala index a30de7ed9..f54ae9f92 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala @@ -20,9 +20,6 @@ import org.finos.morphir.ir.sdk import org.finos.morphir.ir.Value.{USpecification => UValueSpec, Definition => ValueDefinition} import org.finos.morphir.ir.Type.{USpecification => UTypeSpec} - - - object Utils { import Extractors.* @@ -172,5 +169,4 @@ object Utils { curryTypeFunction(Type.Function(getattributes(inner), chunk.head._2, inner), chunk.tail) } - } diff --git a/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala b/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala index 7ffc5927c..efaf6bdaa 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala @@ -35,11 +35,10 @@ private[runtime] case class QuickMorphirRuntime(dists: Distributions, store: Sto val errors = new TypeChecker(dists).check(value) for { ctx <- ZPure.get[RTExecutionContext] - _ <- if (errors.length == 0) RTAction.succeed(()) else RTAction.fail(TypeCheckerErrors(errors)) + _ <- if (errors.length == 0) RTAction.succeed(()) else RTAction.fail(TypeCheckerErrors(errors)) res <- EvaluatorQuick.evalAction(value, store, dists) } yield res - def fetchType(ref: FQName): RTAction[MorphirEnv, MorphirRuntimeError, UType] = { val (pkg, mod, loc) = (ref.getPackagePath, ref.getModulePath, ref.localName) val maybeSpec = dists.lookupValueSpecification(PackageName(pkg), ModuleName(mod), loc) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/quick/Result.scala b/morphir/runtime/src/org/finos/morphir/runtime/quick/Result.scala index af6a9cc89..0f8b8c454 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/quick/Result.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/quick/Result.scala @@ -6,9 +6,9 @@ import org.finos.morphir.ir.Value.Value.{List as ListValue, Unit as UnitValue, * import org.finos.morphir.ir.Value.{Pattern, Value} import Name.toTitleCase -sealed trait Result[TA, VA]{ - def succinct(depth : Int) : String = s"${this.getClass} (Default implementation)" - def succinct : String = succinct(2) +sealed trait Result[TA, VA] { + def succinct(depth: Int): String = s"${this.getClass} (Default implementation)" + def succinct: String = succinct(2) } object Result { @@ -48,25 +48,29 @@ object Result { } case class Tuple[TA, VA](elements: Any) extends Result[TA, VA] { - override def succinct(depth: Int) = if (depth == 0) "Tuple(...)" else { + override def succinct(depth: Int) = if (depth == 0) "Tuple(...)" + else { s"Tuple(${Helpers.tupleToList(elements).map(_.asInstanceOf[Result[TA, VA]]).map(_.succinct(depth - 1)).mkString(", ")})" } } case class Record[TA, VA](elements: Map[Name, Result[TA, VA]]) extends Result[TA, VA] { - override def succinct(depth: Int) = if (depth == 0) "Record(..)" else { + override def succinct(depth: Int) = if (depth == 0) "Record(..)" + else { s"Record(${elements.map { case (key, value) => s"$key -> ${value.succinct(depth - 1)}" }.mkString(", ")})" } } case class ListResult[TA, VA](elements: List[Result[TA, VA]]) extends Result[TA, VA] { - override def succinct(depth: Int) = if (depth == 0) "List(..)" else { + override def succinct(depth: Int) = if (depth == 0) "List(..)" + else { s"List(${elements.map(value => value.succinct(depth - 1)).mkString(", ")})" } } case class MapResult[TA, VA](elements: Map[Result[TA, VA], Result[TA, VA]]) extends Result[TA, VA] { - override def succinct(depth: Int) = if (depth == 0) "Dict(..)" else { + override def succinct(depth: Int) = if (depth == 0) "Dict(..)" + else { s"Dict(${elements.map { case (key, value) => s"${key.succinct(depth - 1)} -> ${value.succinct(depth - 1)}" }.mkString(", ")})" } } @@ -92,7 +96,8 @@ object Result { extends Result[TA, VA] case class ConstructorResult[TA, VA](name: FQName, values: List[Result[TA, VA]]) extends Result[TA, VA] { - override def succinct(depth: Int) = if (depth == 0) s"${name.toString}(..)" else { + override def succinct(depth: Int) = if (depth == 0) s"${name.toString}(..)" + else { s"${name.toString}(${values.map(value => value.succinct(depth - 1)).mkString(", ")})" } } diff --git a/morphir/src/org/finos/morphir/runtime/MorphirRuntimeError.scala b/morphir/src/org/finos/morphir/runtime/MorphirRuntimeError.scala index 6ee138af9..974cedddb 100644 --- a/morphir/src/org/finos/morphir/runtime/MorphirRuntimeError.scala +++ b/morphir/src/org/finos/morphir/runtime/MorphirRuntimeError.scala @@ -10,17 +10,17 @@ sealed abstract class EvaluationError(message: String) extends MorphirRuntim sealed abstract class TypeError(message: String) extends MorphirRuntimeError(message) sealed abstract class VariableAccessError(message: String) extends EvaluationError(message) -final case class UnsupportedType(message: String) extends TypeError(message) -final case class TooManyArgs(message: String) extends TypeError(message) -final case class IrToDatamodelError(message: String) extends EvaluationError(message) -final case class MissingField(message: String) extends EvaluationError(message) -final case class UnexpectedType(message: String) extends EvaluationError(message) -final case class UnmatchedPattern(message: String) extends EvaluationError(message) -final case class FunctionWithoutParameters(message: String) extends EvaluationError(message) -final case class VariableNotFound(message: String) extends VariableAccessError(message) -final case class DefinitionNotFound(message: String) extends EvaluationError(message) -final case class SpecificationNotFound(message: String) extends EvaluationError(message) -final case class ConstructorNotFound(message: String) extends EvaluationError(message) +final case class UnsupportedType(message: String) extends TypeError(message) +final case class TooManyArgs(message: String) extends TypeError(message) +final case class IrToDatamodelError(message: String) extends EvaluationError(message) +final case class MissingField(message: String) extends EvaluationError(message) +final case class UnexpectedType(message: String) extends EvaluationError(message) +final case class UnmatchedPattern(message: String) extends EvaluationError(message) +final case class FunctionWithoutParameters(message: String) extends EvaluationError(message) +final case class VariableNotFound(message: String) extends VariableAccessError(message) +final case class DefinitionNotFound(message: String) extends EvaluationError(message) +final case class SpecificationNotFound(message: String) extends EvaluationError(message) +final case class ConstructorNotFound(message: String) extends EvaluationError(message) //final case class TypeNotFound(message: String) extends EvaluationError(message) final case class ResultDoesNotMatchType(message: String) extends EvaluationError(message) final case class FunctionReturnedToTopLevel(message: String) extends EvaluationError(message) From fc62e11e5f9a8882e59854079156011e337089c5 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Mon, 14 Aug 2023 16:53:39 -0700 Subject: [PATCH 014/323] Formatting --- .../src/org/finos/morphir/runtime/TypeChecker.scala | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 5f9345b4f..a1640b663 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -97,22 +97,22 @@ class TypeChecker(dists: Distributions) { def handleListValue(tpe : UType, elements : List[TypedValue], context : Context) : TypeCheckerResult = { List() } - def handlePatternMatch(tpe : UType, value : TypedValue, cases : , context : Context) : TypeCheckerResult = { + def handlePatternMatch(tpe : UType, value : TypedValue, cases : List[(Pattern[UType], TypedValue)], context : Context) : TypeCheckerResult = { List() } - def handleRecord(tpe : UType, fields, context : Context) : TypeCheckerResult = { + def handleRecord(tpe : UType, List[(Name, TypedValue)], context : Context) : TypeCheckerResult = { List() } def handleReference(tpe : UType, fqn : FQName, context : Context) : TypeCheckerResult = { List() } - def handleTuple(tpe : UType, elements, context : Context) : TypeCheckerResult = { + def handleTuple(tpe : UType, elements: List[TypedValue], context : Context) : TypeCheckerResult = { List() } def handleUnitValue(tpe : UType, context : Context) : TypeCheckerResult = { List() } - def handlepdateRecord(tpe : UType, valueToUpdate, fields, context : Context) : TypeCheckerResult = { + def handleUpdateRecord(tpe : UType, valueToUpdate : Name, Map[Name, TypedValue], context : Context) : TypeCheckerResult = { List() } def handleVariable(tpe : UType, name : Name, context : Context) : TypeCheckerResult = { From e8816c77dca998b19e26fc36fe79fd4fcff504c8 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Mon, 14 Aug 2023 16:58:22 -0700 Subject: [PATCH 015/323] New extractors --- .../finos/morphir/runtime/Extractors.scala | 19 ++++++++++++++++++- .../finos/morphir/runtime/TypeChecker.scala | 2 +- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala b/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala index 2f52d298b..1c146dd45 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala @@ -120,5 +120,22 @@ object Extractors { } } } - object Values {} + object Values { + object SomeConstructor { + def unapply(value: TypedValue): Option[TypedValue] = + value match { + case Value.Apply(attributes, Value.Constructor(_, FQString("Morphir.SDK:Maybe:just")), something) => + Some(something) + case _ => None + } + } + object NoneConstructor { + def unapply(value: TypedValue): Boolean = + value match { + case Value.Constructor(_, FQString("Morphir.SDK:Maybe:nothing")) => + true + case _ => false + } + } + } } diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index a1640b663..40c34a6ad 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -112,7 +112,7 @@ class TypeChecker(dists: Distributions) { def handleUnitValue(tpe : UType, context : Context) : TypeCheckerResult = { List() } - def handleUpdateRecord(tpe : UType, valueToUpdate : Name, Map[Name, TypedValue], context : Context) : TypeCheckerResult = { + def handleUpdateRecord(tpe : UType, valueToUpdate : Name, fields : Map[Name, TypedValue], context : Context) : TypeCheckerResult = { List() } def handleVariable(tpe : UType, name : Name, context : Context) : TypeCheckerResult = { From 7a707ccbccb9c1f8b3d84803c85ef1c620148b8d Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Mon, 14 Aug 2023 16:59:03 -0700 Subject: [PATCH 016/323] New extractors --- .../runtime/src/org/finos/morphir/runtime/Extractors.scala | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala b/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala index 1c146dd45..abfc56ca2 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala @@ -121,6 +121,12 @@ object Extractors { } } object Values { + object ApplyChain { + def unapply(value: TypedValue): Option[(TypedValue, List[TypedValue])] = value match { + case Value.Apply(_, ApplyChain(inner, args), arg) => Some(inner, args :+ arg) + case other => Some(other, List()) + } + } object SomeConstructor { def unapply(value: TypedValue): Option[TypedValue] = value match { From dd0f6667f297b8616acbae52db33e879f6157b12 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Mon, 14 Aug 2023 16:59:36 -0700 Subject: [PATCH 017/323] New extractors --- .../runtime/src/org/finos/morphir/runtime/Extractors.scala | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala b/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala index abfc56ca2..c7e0909a4 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala @@ -119,6 +119,10 @@ object Extractors { case _ => None } } + + class FunctionOnion(dists: Distributions) { + val dealiaser = Dealiased(dists) + } } object Values { object ApplyChain { From 29f4e633dd7574afda86987f48f7f50d3141f9ac Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Mon, 14 Aug 2023 17:00:28 -0700 Subject: [PATCH 018/323] New extractors --- .../src/org/finos/morphir/runtime/Extractors.scala | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala b/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala index c7e0909a4..f2431ff28 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala @@ -122,6 +122,19 @@ object Extractors { class FunctionOnion(dists: Distributions) { val dealiaser = Dealiased(dists) + + def unapply(tpe: UType): Option[(UType, List[UType])] = { + val myself = this + tpe match { + case fun@Type.Function(_, arg, myself(inner, args)) => + Some(inner, args :+ arg) + case ref@dealiaser(myself(inner, args), bindings) => + Some(inner, args) + // TODO: BINDINGS + case other => + Some(other, List()) + } + } } } object Values { From 0934b7626e56a9f119dd1f534a9b4b77c82e71ef Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Mon, 14 Aug 2023 17:01:37 -0700 Subject: [PATCH 019/323] New extractors --- .../finos/morphir/runtime/Extractors.scala | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala b/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala index f2431ff28..de6dd02cc 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala @@ -160,5 +160,25 @@ object Extractors { case _ => false } } + + object NonNativeRef { + def unapply(value: TypedValue): Option[(UType, FQName)] = + value match { + case Value.Reference(tpe, name) + if (name.packagePath != Basics.intType.asInstanceOf[Type.Reference[Unit]].typeName.packagePath) => + Some(tpe, name) + case _ => None + } + } + + object NativeRef { + def unapply(value: TypedValue): Option[(UType, FQName)] = + value match { + case Value.Reference(tpe, name) + if (name.packagePath == Basics.intType.asInstanceOf[Type.Reference[Unit]].typeName.packagePath) => + Some(tpe, name) + case _ => None + } + } } } From 804c63f280a3bc6d36a1a343f05c902c7faf9f74 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Mon, 14 Aug 2023 17:03:36 -0700 Subject: [PATCH 020/323] New extractors --- .../finos/morphir/runtime/Extractors.scala | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala b/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala index de6dd02cc..293944490 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala @@ -85,23 +85,23 @@ object Extractors { object LocalTimeRef extends CommonReference { final val tpe = sdk.LocalTime.localTimeType } - // Matches references to known SDK-defined types - object SDKRef { - def unapply(tpe: UType): Boolean = tpe match { - case IntRef() => true - case Int32Ref() => true - case BoolRef() => true - case FloatRef() => true - case StringRef() => true - case CharRef() => true - case LocalDateRef() => true - case LocalTimeRef() => true - case ListRef(_) => true - case MaybeRef(_) => true - case DictRef(_, _) => true - case ResultRef(_, _) => true - case _ => false - } + + object NonNativeRef { + def unapply(tpe: UType): Option[(FQName, Chunk[UType])] = + tpe match { + case Type.Reference(_, name, args) + if (name.packagePath != Basics.intType.asInstanceOf[Type.Reference[Unit]].typeName.packagePath) => + Some((name, args)) + case _ => None + } + } + object NativeRef { + def unapply(tpe: UType): Boolean = + tpe match { + case Type.Reference(_, name, _) + if (name.packagePath == Basics.intType.asInstanceOf[Type.Reference[Unit]].typeName.packagePath) => true + case _ => false + } } // Extractor object that unwraps a single layer of aliasing, and gives any type names that were bound in the process class Dealiased(dists: Distributions) { From acb75305e66f313d5ab6b9b656836c3990c496db Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Mon, 14 Aug 2023 17:06:58 -0700 Subject: [PATCH 021/323] Incremental --- .../runtime/src/org/finos/morphir/runtime/Distributions.scala | 2 ++ morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Distributions.scala b/morphir/runtime/src/org/finos/morphir/runtime/Distributions.scala index 7b9c65dbf..b32e87164 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Distributions.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Distributions.scala @@ -9,6 +9,8 @@ import org.finos.morphir.ir.sdk import org.finos.morphir.ir.sdk.Basics import org.finos.morphir.ir.Field import org.finos.morphir.runtime.exports.* +import org.finos.morphir.ir.distribution.Distribution +import org.finos.morphir.ir.distribution.Distribution.Library import zio.Chunk class Distributions(dists: Map[PackageName, Distribution]) { diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 40c34a6ad..c31af606c 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -100,7 +100,7 @@ class TypeChecker(dists: Distributions) { def handlePatternMatch(tpe : UType, value : TypedValue, cases : List[(Pattern[UType], TypedValue)], context : Context) : TypeCheckerResult = { List() } - def handleRecord(tpe : UType, List[(Name, TypedValue)], context : Context) : TypeCheckerResult = { + def handleRecord(tpe : UType, fields : List[(Name, TypedValue)], context : Context) : TypeCheckerResult = { List() } def handleReference(tpe : UType, fqn : FQName, context : Context) : TypeCheckerResult = { From 11a81a1e65ce7c5f11475de2020c436208e2cad9 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Mon, 14 Aug 2023 17:09:08 -0700 Subject: [PATCH 022/323] Incremental --- .../org/finos/morphir/runtime/Distributions.scala | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Distributions.scala b/morphir/runtime/src/org/finos/morphir/runtime/Distributions.scala index b32e87164..f185256c6 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Distributions.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Distributions.scala @@ -5,6 +5,7 @@ import org.finos.morphir.naming._ import org.finos.morphir.ir.{Type as T, Value as V} import org.finos.morphir.ir.Value.{Value, Pattern, TypedValue, USpecification => UValueSpec} import org.finos.morphir.ir.Type.{Type, UType, USpecification => UTypeSpec} +import org.finos.morphir.ir.Module.{Specification => ModSpec} import org.finos.morphir.ir.sdk import org.finos.morphir.ir.sdk.Basics import org.finos.morphir.ir.Field @@ -28,12 +29,22 @@ class Distributions(dists: Map[PackageName, Distribution]) { ): Option[UValueSpec] = lookupModuleSpecification(packageName, module).flatMap(_.lookupValueSpecification(localName)) - def lookupValueSpecification(fqName: FQName): Option[UValueSpec] = {} + + def lookupValueSpecification( + packageName: PackageName, + module: ModuleName, + localName: Name + ): Option[UValueSpec] = + lookupModuleSpecification(packageName, module).flatMap(_.lookupValueSpecification(localName)) + + def lookupValueSpecification(fqn: FQName): Option[UValueSpec] = + lookupValueSpecification(fqn.packagePath, fqn.modulePath, fqn.localName) def lookupTypeSpecification(pName: PackageName, module: ModuleName, localName: Name): Option[UTypeSpec] = lookupModuleSpecification(pName, module).flatMap(_.lookupTypeSpecification(localName)) - def lookupTypeSpecification(fqName: FQName): Option[UTypeSpec] = {} + def lookupTypeSpecification(fqn: FQName): Option[UTypeSpec] = + lookupTypeSpecification(fqn.packagePath, fqn.modulePath, fqn.localName) def getDists: Map[PackageName, Distribution] = dists } From 26f6ce55c59fe95df1cc6db99c01f1c9b4aa0572 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Mon, 14 Aug 2023 17:10:20 -0700 Subject: [PATCH 023/323] Incremental --- .../org/finos/morphir/runtime/Distributions.scala | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Distributions.scala b/morphir/runtime/src/org/finos/morphir/runtime/Distributions.scala index f185256c6..351c53510 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Distributions.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Distributions.scala @@ -40,11 +40,16 @@ class Distributions(dists: Map[PackageName, Distribution]) { def lookupValueSpecification(fqn: FQName): Option[UValueSpec] = lookupValueSpecification(fqn.packagePath, fqn.modulePath, fqn.localName) - def lookupTypeSpecification(pName: PackageName, module: ModuleName, localName: Name): Option[UTypeSpec] = - lookupModuleSpecification(pName, module).flatMap(_.lookupTypeSpecification(localName)) - def lookupTypeSpecification(fqn: FQName): Option[UTypeSpec] = - lookupTypeSpecification(fqn.packagePath, fqn.modulePath, fqn.localName) + def lookupValueDefinition( + packageName: PackageName, + module: ModuleName, + localName: Name + ): Option[ValueDefinition[scala.Unit, UType]] = + lookupModuleDefinition(packageName, module).flatMap(_.lookupValueDefinition(localName)) + + def lookupValueDefinition(fqn: FQName): Option[ValueDefinition[scala.Unit, UType]] = + lookupValueDefinition(fqn.packagePath, fqn.modulePath, fqn.localName) def getDists: Map[PackageName, Distribution] = dists } From 202dc36bc1837226404c35f9e7770a8f163f4f4e Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Mon, 14 Aug 2023 17:10:54 -0700 Subject: [PATCH 024/323] Incremental --- .../src/org/finos/morphir/runtime/Distributions.scala | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Distributions.scala b/morphir/runtime/src/org/finos/morphir/runtime/Distributions.scala index 351c53510..552b98034 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Distributions.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Distributions.scala @@ -22,6 +22,12 @@ class Distributions(dists: Map[PackageName, Distribution]) { case None => None } + def lookupTypeSpecification(pName: PackageName, module: ModuleName, localName: Name): Option[UTypeSpec] = + lookupModuleSpecification(pName, module).flatMap(_.lookupTypeSpecification(localName)) + + def lookupTypeSpecification(fqn: FQName): Option[UTypeSpec] = + lookupTypeSpecification(fqn.packagePath, fqn.modulePath, fqn.localName) + def lookupValueSpecification( packageName: PackageName, module: ModuleName, From 045b7f4245191f3c562461451483d38fb3ff650a Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Mon, 14 Aug 2023 17:12:34 -0700 Subject: [PATCH 025/323] Formatting --- .../finos/morphir/runtime/Distributions.scala | 20 ++- .../finos/morphir/runtime/Extractors.scala | 14 +- .../morphir/runtime/MorphirTypeError.scala | 2 +- .../finos/morphir/runtime/TypeChecker.scala | 125 ++++++++++-------- 4 files changed, 84 insertions(+), 77 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Distributions.scala b/morphir/runtime/src/org/finos/morphir/runtime/Distributions.scala index 552b98034..211c056cf 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Distributions.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Distributions.scala @@ -35,28 +35,26 @@ class Distributions(dists: Map[PackageName, Distribution]) { ): Option[UValueSpec] = lookupModuleSpecification(packageName, module).flatMap(_.lookupValueSpecification(localName)) - def lookupValueSpecification( - packageName: PackageName, - module: ModuleName, - localName: Name - ): Option[UValueSpec] = + packageName: PackageName, + module: ModuleName, + localName: Name + ): Option[UValueSpec] = lookupModuleSpecification(packageName, module).flatMap(_.lookupValueSpecification(localName)) def lookupValueSpecification(fqn: FQName): Option[UValueSpec] = lookupValueSpecification(fqn.packagePath, fqn.modulePath, fqn.localName) - def lookupValueDefinition( - packageName: PackageName, - module: ModuleName, - localName: Name - ): Option[ValueDefinition[scala.Unit, UType]] = + packageName: PackageName, + module: ModuleName, + localName: Name + ): Option[ValueDefinition[scala.Unit, UType]] = lookupModuleDefinition(packageName, module).flatMap(_.lookupValueDefinition(localName)) def lookupValueDefinition(fqn: FQName): Option[ValueDefinition[scala.Unit, UType]] = lookupValueDefinition(fqn.packagePath, fqn.modulePath, fqn.localName) - def getDists: Map[PackageName, Distribution] = dists + def getDists: Map[PackageName, Distribution] = dists } object Distributions { diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala b/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala index 293944490..bcce419cd 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala @@ -90,7 +90,7 @@ object Extractors { def unapply(tpe: UType): Option[(FQName, Chunk[UType])] = tpe match { case Type.Reference(_, name, args) - if (name.packagePath != Basics.intType.asInstanceOf[Type.Reference[Unit]].typeName.packagePath) => + if (name.packagePath != Basics.intType.asInstanceOf[Type.Reference[Unit]].typeName.packagePath) => Some((name, args)) case _ => None } @@ -99,7 +99,7 @@ object Extractors { def unapply(tpe: UType): Boolean = tpe match { case Type.Reference(_, name, _) - if (name.packagePath == Basics.intType.asInstanceOf[Type.Reference[Unit]].typeName.packagePath) => true + if (name.packagePath == Basics.intType.asInstanceOf[Type.Reference[Unit]].typeName.packagePath) => true case _ => false } } @@ -126,9 +126,9 @@ object Extractors { def unapply(tpe: UType): Option[(UType, List[UType])] = { val myself = this tpe match { - case fun@Type.Function(_, arg, myself(inner, args)) => + case fun @ Type.Function(_, arg, myself(inner, args)) => Some(inner, args :+ arg) - case ref@dealiaser(myself(inner, args), bindings) => + case ref @ dealiaser(myself(inner, args), bindings) => Some(inner, args) // TODO: BINDINGS case other => @@ -141,7 +141,7 @@ object Extractors { object ApplyChain { def unapply(value: TypedValue): Option[(TypedValue, List[TypedValue])] = value match { case Value.Apply(_, ApplyChain(inner, args), arg) => Some(inner, args :+ arg) - case other => Some(other, List()) + case other => Some(other, List()) } } object SomeConstructor { @@ -165,7 +165,7 @@ object Extractors { def unapply(value: TypedValue): Option[(UType, FQName)] = value match { case Value.Reference(tpe, name) - if (name.packagePath != Basics.intType.asInstanceOf[Type.Reference[Unit]].typeName.packagePath) => + if (name.packagePath != Basics.intType.asInstanceOf[Type.Reference[Unit]].typeName.packagePath) => Some(tpe, name) case _ => None } @@ -175,7 +175,7 @@ object Extractors { def unapply(value: TypedValue): Option[(UType, FQName)] = value match { case Value.Reference(tpe, name) - if (name.packagePath == Basics.intType.asInstanceOf[Type.Reference[Unit]].typeName.packagePath) => + if (name.packagePath == Basics.intType.asInstanceOf[Type.Reference[Unit]].typeName.packagePath) => Some(tpe, name) case _ => None } diff --git a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala index 2daaef670..1a59f38e9 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala @@ -11,7 +11,7 @@ import org.finos.morphir.ir.Field import org.finos.morphir.runtime.exports.* import zio.Chunk -trait MorphirTypeError extends MorphirRuntimeError +trait MorphirTypeError(msg: String) extends MorphirRuntimeError(msg) object MorphirTypeError { case class TypesMismatch(tpe1: UType, tpe2: UType) extends GoodTypeError("Todo") case class ArgumentDoesNotMatchParameter(arg: TypedValue, param: TypedValue) extends GoodTypeError("Todo") diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index c31af606c..d07e0b141 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -41,14 +41,14 @@ class TypeChecker(dists: Distributions) { def check(suspect: TypedValue, parentContext: Context) = { import Value.{Unit as UnitValue, List as ListValue, Field as FieldValue, *} val context = parentContext.withDepth(parentContext.depth + 1) - suspect match{ + suspect match { case Literal(tpe, lit) => handleLiteral(tpe, lit, context) case Apply(tpe, function, argument) => handleApply(tpe, function, argument, store, context) case Destructure(tpe, pattern, valueToDestruct, inValue) => handleDestructure(tpe, pattern, valueToDestruct, inValue, store, context) - case Constructor(tpe, name) => handleConstructor(tpe, name, store, context) + case Constructor(tpe, name) => handleConstructor(tpe, name, store, context) case FieldValue(tpe, recordValue, name) => handleField(tpe, recordValue, name, store, context) - case FieldFunction(tpe, name) => handleFieldFunction(tpe, name, context) + case FieldFunction(tpe, name) => handleFieldFunction(tpe, name, context) case IfThenElse(tpe, condition, thenValue, elseValue) => handleIfThenElse(tpe, condition, thenValue, elseValue, store, context) case Lambda(tpe, pattern, body) => handleLambda(tpe, pattern, body, store, context) @@ -60,64 +60,73 @@ class TypeChecker(dists: Distributions) { case Record(tpe, fields) => handleRecord(tpe, fields.toList, store, context) case Reference(tpe, name) => handleReference(tpe, name, store, context) case Tuple(tpe, elements) => handleTuple(tpe, elements.toList, store, context) - case UnitValue(va) => handleUnit(va, context) + case UnitValue(va) => handleUnit(va, context) case UpdateRecord(tpe, valueToUpdate, fields) => handleUpdateRecord(tpe, valueToUpdate, fields, store, context) case Variable(tpe, name) => handleVariable(tpe, name, store) } - def handleLiteral(tpe : UType, function: TypedValue, argument : TypedValue, context : Context) : TypeCheckerResult = { - List() - } - def handleApply(tpe : UType, function: TypedValue, argument : TypedValue, context : Context) : TypeCheckerResult = { - List() - } - def handleDestructure(tpe : UType, function: TypedValue, argument : TypedValue, context : Context) : TypeCheckerResult = { - List() - } - def handleConstructor(tpe : UType, function: TypedValue, argument : TypedValue, context : Context) : TypeCheckerResult = { - List() - } - def handleFieldValue(tpe : UType, recordValue : TypedValue, name : Name, context : Context) : TypeCheckerResult = { - List() - } - def handleFieldFunction(tpe : UType, name : Name, context : Context) : TypeCheckerResult = { - List() - } - def handleIfThenElse(tpe : UType, condition : TypedValue, thenValue : TypedValue, elseValue : TypedValue, context : Context) : TypeCheckerResult = { - List() - } - def handleLambda(tpe : UType, pattern : Pattern, body : TypedValue, context : Context) : TypeCheckerResult = { - List() - } - def handleLetDefinition(tpe : UType, name : Name, definition : UValueDef, inValue : TypedValue, context : Context) : TypeCheckerResult = { - List() - } - def handleLetRecursion(tpe : UType, definitions: Map[Name, UValueDef], inValue : TypedValue, context : Context) : TypeCheckerResult = { - List() - } - def handleListValue(tpe : UType, elements : List[TypedValue], context : Context) : TypeCheckerResult = { - List() - } - def handlePatternMatch(tpe : UType, value : TypedValue, cases : List[(Pattern[UType], TypedValue)], context : Context) : TypeCheckerResult = { - List() - } - def handleRecord(tpe : UType, fields : List[(Name, TypedValue)], context : Context) : TypeCheckerResult = { - List() - } - def handleReference(tpe : UType, fqn : FQName, context : Context) : TypeCheckerResult = { - List() - } - def handleTuple(tpe : UType, elements: List[TypedValue], context : Context) : TypeCheckerResult = { - List() - } - def handleUnitValue(tpe : UType, context : Context) : TypeCheckerResult = { - List() - } - def handleUpdateRecord(tpe : UType, valueToUpdate : Name, fields : Map[Name, TypedValue], context : Context) : TypeCheckerResult = { - List() - } - def handleVariable(tpe : UType, name : Name, context : Context) : TypeCheckerResult = { - List() - } + def handleLiteral(tpe: UType, function: TypedValue, argument: TypedValue, context: Context): TypeCheckerResult = + List() + def handleApply(tpe: UType, function: TypedValue, argument: TypedValue, context: Context): TypeCheckerResult = + List() + def handleDestructure(tpe: UType, function: TypedValue, argument: TypedValue, context: Context): TypeCheckerResult = + List() + def handleConstructor(tpe: UType, function: TypedValue, argument: TypedValue, context: Context): TypeCheckerResult = + List() + def handleFieldValue(tpe: UType, recordValue: TypedValue, name: Name, context: Context): TypeCheckerResult = + List() + def handleFieldFunction(tpe: UType, name: Name, context: Context): TypeCheckerResult = + List() + def handleIfThenElse( + tpe: UType, + condition: TypedValue, + thenValue: TypedValue, + elseValue: TypedValue, + context: Context + ): TypeCheckerResult = + List() + def handleLambda(tpe: UType, pattern: Pattern, body: TypedValue, context: Context): TypeCheckerResult = + List() + def handleLetDefinition( + tpe: UType, + name: Name, + definition: UValueDef, + inValue: TypedValue, + context: Context + ): TypeCheckerResult = + List() + def handleLetRecursion( + tpe: UType, + definitions: Map[Name, UValueDef], + inValue: TypedValue, + context: Context + ): TypeCheckerResult = + List() + def handleListValue(tpe: UType, elements: List[TypedValue], context: Context): TypeCheckerResult = + List() + def handlePatternMatch( + tpe: UType, + value: TypedValue, + cases: List[(Pattern[UType], TypedValue)], + context: Context + ): TypeCheckerResult = + List() + def handleRecord(tpe: UType, fields: List[(Name, TypedValue)], context: Context): TypeCheckerResult = + List() + def handleReference(tpe: UType, fqn: FQName, context: Context): TypeCheckerResult = + List() + def handleTuple(tpe: UType, elements: List[TypedValue], context: Context): TypeCheckerResult = + List() + def handleUnitValue(tpe: UType, context: Context): TypeCheckerResult = + List() + def handleUpdateRecord( + tpe: UType, + valueToUpdate: Name, + fields: Map[Name, TypedValue], + context: Context + ): TypeCheckerResult = + List() + def handleVariable(tpe: UType, name: Name, context: Context): TypeCheckerResult = + List() } } From 95cbdcbc6318861f0e93f98c265c2e079ff5cfc5 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Mon, 14 Aug 2023 17:20:05 -0700 Subject: [PATCH 026/323] Incremental --- .../finos/morphir/runtime/Distributions.scala | 19 +++++++++++++------ .../finos/morphir/runtime/Extractors.scala | 2 +- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Distributions.scala b/morphir/runtime/src/org/finos/morphir/runtime/Distributions.scala index 211c056cf..fbcdcbc77 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Distributions.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Distributions.scala @@ -3,7 +3,7 @@ package org.finos.morphir.runtime import org.finos.morphir.naming._ import org.finos.morphir.naming._ import org.finos.morphir.ir.{Type as T, Value as V} -import org.finos.morphir.ir.Value.{Value, Pattern, TypedValue, USpecification => UValueSpec} +import org.finos.morphir.ir.Value.{Value, Pattern, TypedValue, USpecification => UValueSpec, UDefinition => UValueDef} import org.finos.morphir.ir.Type.{Type, UType, USpecification => UTypeSpec} import org.finos.morphir.ir.Module.{Specification => ModSpec} import org.finos.morphir.ir.sdk @@ -22,11 +22,18 @@ class Distributions(dists: Map[PackageName, Distribution]) { case None => None } - def lookupTypeSpecification(pName: PackageName, module: ModuleName, localName: Name): Option[UTypeSpec] = - lookupModuleSpecification(pName, module).flatMap(_.lookupTypeSpecification(localName)) + def lookupModuleDefinition(packageName: PackageName, module: ModuleName): Option[ModDef[Unit, UType]] = + dists.get(packageName) match { + case Some(Library(_, _, packageDef)) => + packageDef.modules.get(module).map(_.value) + case None => None + } + + def lookupTypeSpecification(pName: PackageName, module: ModuleName, localName: Name): Option[UTypeSpec] = + lookupModuleSpecification(pName, module).flatMap(_.lookupTypeSpecification(localName)) - def lookupTypeSpecification(fqn: FQName): Option[UTypeSpec] = - lookupTypeSpecification(fqn.packagePath, fqn.modulePath, fqn.localName) + def lookupTypeSpecification(fqn: FQName): Option[UTypeSpec] = + lookupTypeSpecification(fqn.packagePath, fqn.modulePath, fqn.localName) def lookupValueSpecification( packageName: PackageName, @@ -49,7 +56,7 @@ class Distributions(dists: Map[PackageName, Distribution]) { packageName: PackageName, module: ModuleName, localName: Name - ): Option[ValueDefinition[scala.Unit, UType]] = + ): Option[UValueDef] = lookupModuleDefinition(packageName, module).flatMap(_.lookupValueDefinition(localName)) def lookupValueDefinition(fqn: FQName): Option[ValueDefinition[scala.Unit, UType]] = diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala b/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala index bcce419cd..bbd6ac912 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala @@ -107,7 +107,7 @@ object Extractors { class Dealiased(dists: Distributions) { def unapply(tpe: UType): Option[(UType, Map[Name, UType])] = // If it's aliased we may need to grab bindings tpe match { - case SDKRef() => None + case NativeRef(_, _) => None case Type.Reference(_, typeName, typeArgs) => val lookedUp = dists.lookupTypeSpecification(typeName.packagePath, typeName.modulePath, typeName.localName) lookedUp match { From 63e63a1f7b9fac246a54af5bc1a15719b6802f68 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Mon, 14 Aug 2023 17:23:48 -0700 Subject: [PATCH 027/323] Incremental --- .../runtime/src/org/finos/morphir/runtime/Distributions.scala | 4 ++-- morphir/toolkit/core/src/org/finos/morphir/ir/Value.scala | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Distributions.scala b/morphir/runtime/src/org/finos/morphir/runtime/Distributions.scala index fbcdcbc77..a075575bf 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Distributions.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Distributions.scala @@ -3,7 +3,7 @@ package org.finos.morphir.runtime import org.finos.morphir.naming._ import org.finos.morphir.naming._ import org.finos.morphir.ir.{Type as T, Value as V} -import org.finos.morphir.ir.Value.{Value, Pattern, TypedValue, USpecification => UValueSpec, UDefinition => UValueDef} +import org.finos.morphir.ir.Value.{Value, Pattern, TypedValue, USpecification => UValueSpec, TypedDefinition => TypedValueDef} import org.finos.morphir.ir.Type.{Type, UType, USpecification => UTypeSpec} import org.finos.morphir.ir.Module.{Specification => ModSpec} import org.finos.morphir.ir.sdk @@ -59,7 +59,7 @@ class Distributions(dists: Map[PackageName, Distribution]) { ): Option[UValueDef] = lookupModuleDefinition(packageName, module).flatMap(_.lookupValueDefinition(localName)) - def lookupValueDefinition(fqn: FQName): Option[ValueDefinition[scala.Unit, UType]] = + def lookupValueDefinition(fqn: FQName): Option[TypedValueDef] = lookupValueDefinition(fqn.packagePath, fqn.modulePath, fqn.localName) def getDists: Map[PackageName, Distribution] = dists } diff --git a/morphir/toolkit/core/src/org/finos/morphir/ir/Value.scala b/morphir/toolkit/core/src/org/finos/morphir/ir/Value.scala index b1fb9940c..fc62d8154 100644 --- a/morphir/toolkit/core/src/org/finos/morphir/ir/Value.scala +++ b/morphir/toolkit/core/src/org/finos/morphir/ir/Value.scala @@ -56,6 +56,7 @@ object Value extends internal.PatternModule { final type RawValue = Value.RawValue final type TypedValue = Value.TypedValue final type USpecification = ValueSpecification[scala.Unit] + final type TypedDefinition = ValueDefinition[Type.UType, scala.Unit] import Type.{Type, UType} import Value.{Literal => LiteralValue, _} From c1edc88fc566e204b0579654d7a52420e558844b Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Mon, 14 Aug 2023 17:26:27 -0700 Subject: [PATCH 028/323] Incremental --- .../src/org/finos/morphir/runtime/Distributions.scala | 11 ++--------- .../toolkit/core/src/org/finos/morphir/ir/Value.scala | 2 +- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Distributions.scala b/morphir/runtime/src/org/finos/morphir/runtime/Distributions.scala index a075575bf..00008035e 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Distributions.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Distributions.scala @@ -5,7 +5,7 @@ import org.finos.morphir.naming._ import org.finos.morphir.ir.{Type as T, Value as V} import org.finos.morphir.ir.Value.{Value, Pattern, TypedValue, USpecification => UValueSpec, TypedDefinition => TypedValueDef} import org.finos.morphir.ir.Type.{Type, UType, USpecification => UTypeSpec} -import org.finos.morphir.ir.Module.{Specification => ModSpec} +import org.finos.morphir.ir.Module.{Specification => ModSpec, Definition => ModDef} import org.finos.morphir.ir.sdk import org.finos.morphir.ir.sdk.Basics import org.finos.morphir.ir.Field @@ -42,13 +42,6 @@ class Distributions(dists: Map[PackageName, Distribution]) { ): Option[UValueSpec] = lookupModuleSpecification(packageName, module).flatMap(_.lookupValueSpecification(localName)) - def lookupValueSpecification( - packageName: PackageName, - module: ModuleName, - localName: Name - ): Option[UValueSpec] = - lookupModuleSpecification(packageName, module).flatMap(_.lookupValueSpecification(localName)) - def lookupValueSpecification(fqn: FQName): Option[UValueSpec] = lookupValueSpecification(fqn.packagePath, fqn.modulePath, fqn.localName) @@ -56,7 +49,7 @@ class Distributions(dists: Map[PackageName, Distribution]) { packageName: PackageName, module: ModuleName, localName: Name - ): Option[UValueDef] = + ): Option[TypedValueDef] = lookupModuleDefinition(packageName, module).flatMap(_.lookupValueDefinition(localName)) def lookupValueDefinition(fqn: FQName): Option[TypedValueDef] = diff --git a/morphir/toolkit/core/src/org/finos/morphir/ir/Value.scala b/morphir/toolkit/core/src/org/finos/morphir/ir/Value.scala index fc62d8154..67e393118 100644 --- a/morphir/toolkit/core/src/org/finos/morphir/ir/Value.scala +++ b/morphir/toolkit/core/src/org/finos/morphir/ir/Value.scala @@ -56,7 +56,7 @@ object Value extends internal.PatternModule { final type RawValue = Value.RawValue final type TypedValue = Value.TypedValue final type USpecification = ValueSpecification[scala.Unit] - final type TypedDefinition = ValueDefinition[Type.UType, scala.Unit] + final type TypedDefinition = ValueDefinition[scala.Unit, Type.UType] import Type.{Type, UType} import Value.{Literal => LiteralValue, _} From 07765f1eabf3af7bf98fd103074a5ef89cb8c059 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Mon, 14 Aug 2023 17:28:10 -0700 Subject: [PATCH 029/323] Incremental --- morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala | 2 +- .../src/org/finos/morphir/runtime/MorphirRuntimeError.scala | 2 +- .../src/org/finos/morphir/runtime/MorphirTypeError.scala | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala b/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala index bbd6ac912..0f2f88e00 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala @@ -107,7 +107,7 @@ object Extractors { class Dealiased(dists: Distributions) { def unapply(tpe: UType): Option[(UType, Map[Name, UType])] = // If it's aliased we may need to grab bindings tpe match { - case NativeRef(_, _) => None + case NativeRef() => None case Type.Reference(_, typeName, typeArgs) => val lookedUp = dists.lookupTypeSpecification(typeName.packagePath, typeName.modulePath, typeName.localName) lookedUp match { diff --git a/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntimeError.scala b/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntimeError.scala index f86d86502..c61b2c23f 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntimeError.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntimeError.scala @@ -18,7 +18,7 @@ final case class NotImplementedType(message: String) extends TypeError(mess final case class TypeMismatch(message: String) extends TypeError(message) final case class TypeNotFound(message: String) extends TypeError(message) final case class ManyErrors(errors: TypeError*) extends TypeError("\n" + errors.map(_.toString).mkString("\n")) -final case class TypeCheckerErrors(errors: List[GoodTypeError]) +final case class TypeCheckerErrors(errors: List[MorphirTypeError]) extends EvaluationError("\n" + errors.map(_.toString).mkString("\n")) final case class IrToDatamodelError(message: String) extends EvaluationError(message) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala index 1a59f38e9..4db07416c 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala @@ -11,7 +11,7 @@ import org.finos.morphir.ir.Field import org.finos.morphir.runtime.exports.* import zio.Chunk -trait MorphirTypeError(msg: String) extends MorphirRuntimeError(msg) +trait MorphirTypeError(msg: String) extends Exception(msg) object MorphirTypeError { case class TypesMismatch(tpe1: UType, tpe2: UType) extends GoodTypeError("Todo") case class ArgumentDoesNotMatchParameter(arg: TypedValue, param: TypedValue) extends GoodTypeError("Todo") From c00fe9ac84c85013232e8a09833d113a9fdcb690 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Mon, 14 Aug 2023 17:28:57 -0700 Subject: [PATCH 030/323] Incremental --- .../morphir/runtime/MorphirTypeError.scala | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala index 4db07416c..005ff7139 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala @@ -13,14 +13,13 @@ import zio.Chunk trait MorphirTypeError(msg: String) extends Exception(msg) object MorphirTypeError { - case class TypesMismatch(tpe1: UType, tpe2: UType) extends GoodTypeError("Todo") - case class ArgumentDoesNotMatchParameter(arg: TypedValue, param: TypedValue) extends GoodTypeError("Todo") - case class ImproperType(tpe: UType, message: String) extends GoodTypeError("Todo") - case class TypeMissing(tpe: UType) extends GoodTypeError("Todo") - case class ValueMissing(value: TypedValue) extends GoodTypeError("Todo") - case class ConstructorMissing(fqn: FQName, tpe: UType) extends GoodTypeError("Todo") - case class ModuleMissing(modName: ModuleName) extends GoodTypeError("Todo") - case class PackageMissing(pckName: PackageName) extends GoodTypeError("Todo") - case class Unimplemented(s: String) extends GoodTypeError(s) - + case class TypesMismatch(tpe1: UType, tpe2: UType) extends MorphirTypeError("Todo") + case class ArgumentDoesNotMatchParameter(arg: TypedValue, param: TypedValue) extends MorphirTypeError("Todo") + case class ImproperType(tpe: UType, message: String) extends MorphirTypeError("Todo") + case class TypeMissing(tpe: UType) extends MorphirTypeError("Todo") + case class ValueMissing(value: TypedValue) extends MorphirTypeError("Todo") + case class ConstructorMissing(fqn: FQName, tpe: UType) extends MorphirTypeError("Todo") + case class ModuleMissing(modName: ModuleName) extends MorphirTypeError("Todo") + case class PackageMissing(pckName: PackageName) extends MorphirTypeError("Todo") + case class Unimplemented(s: String) extends MorphirTypeError(s) } From 96a80ffb326daa042d406d8319474e3bf17f46f3 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Mon, 14 Aug 2023 17:30:10 -0700 Subject: [PATCH 031/323] Incremental --- .../src/org/finos/morphir/runtime/MorphirTypeError.scala | 2 +- .../runtime/src/org/finos/morphir/runtime/TypeChecker.scala | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala index 005ff7139..30be73003 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala @@ -11,7 +11,7 @@ import org.finos.morphir.ir.Field import org.finos.morphir.runtime.exports.* import zio.Chunk -trait MorphirTypeError(msg: String) extends Exception(msg) +abstract class MorphirTypeError(msg: String) extends Exception(msg) object MorphirTypeError { case class TypesMismatch(tpe1: UType, tpe2: UType) extends MorphirTypeError("Todo") case class ArgumentDoesNotMatchParameter(arg: TypedValue, param: TypedValue) extends MorphirTypeError("Todo") diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index d07e0b141..008ed0637 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -12,7 +12,7 @@ import org.finos.morphir.runtime.exports.* import zio.Chunk object TypeChecker { - type TypeCheckerResult = List[GoodTypeError] + type TypeCheckerResult = List[MorphirTypeError] case class Context( bindings: Map[Name, UType], depth: Int, @@ -25,7 +25,7 @@ object TypeChecker { object Context { def empty = Context(Map(), 0, "") } - def helper(condition: Boolean, error: GoodTypeError) = if (condition) List(error) else List() + def helper(condition: Boolean, error: MorphirTypeError) = if (condition) List(error) else List() } class TypeChecker(dists: Distributions) { From 7792f3fcb5517923d98d5f68947372236e79f662 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Mon, 14 Aug 2023 17:30:51 -0700 Subject: [PATCH 032/323] Incremental --- morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 008ed0637..c39173257 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -29,7 +29,7 @@ object TypeChecker { } class TypeChecker(dists: Distributions) { - private val functionOnion = FunctionOnion(dists) + private val functionOnion = Extractors.Types.FunctionOnion(dists) private def nameThatMismatch(tpe1: UType, tpe2: UType): String = {} private def nameMissingValue(value: TypedValue, dists: Distributions): MorphirTypeError = {} private def nameMissingType(fqn: FQName, dists: Distributions): MorphirTypeError = {} From 0a504357fec0cc3a65e89f00ba988b6c35828566 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Mon, 14 Aug 2023 17:32:10 -0700 Subject: [PATCH 033/323] Incremental --- .../org/finos/morphir/runtime/TypeChecker.scala | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index c39173257..54e44d6ba 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -30,7 +30,21 @@ object TypeChecker { class TypeChecker(dists: Distributions) { private val functionOnion = Extractors.Types.FunctionOnion(dists) - private def nameThatMismatch(tpe1: UType, tpe2: UType): String = {} + private def nameThatMismatch(tpe1: UType, tpe2: UType): String = { + import Extractors.Types.* + (tpe1, tpe2) match { + case (NonNativeRef(fqn1, args1), NonNativeRef(fqn2, args2)) if fqn1 == fqn2 => + s"Refs to $fqn1 have different type args" + case (NonNativeRef(fqn1, _), NonNativeRef(fqn2, _)) => + val (pack1, mod1, loc1) = (fqn1.packagePath, fqn1.modulePath, fqn1.localName) + val (pack2, mod2, loc2) = (fqn2.packagePath, fqn2.modulePath, fqn2.localName) + val packPart = if (pack1 != pack2) s"{$pack1 $pack2}" else pack1 + val modPart = if (mod1 != mod2) s"{$mod1 $mod2}" else mod1 + val locPart = if (loc1 != loc2) s"{${loc1.toTitleCase} ${loc2.toTitleCase}" else loc1.toTitleCase + s"$packPart:$modPart:$locPart" + case _ => s"(${pretty(tpe1, 2)} vs ${pretty(tpe2, 2)})" + } + } private def nameMissingValue(value: TypedValue, dists: Distributions): MorphirTypeError = {} private def nameMissingType(fqn: FQName, dists: Distributions): MorphirTypeError = {} private def nameMissingConstructor(fqn: FQName, tpe: UType, dists: Distributions): MorphirTypeError = {} From 30d380caf109d813fd6b4a5d19bfa3c48c12e403 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Mon, 14 Aug 2023 17:32:39 -0700 Subject: [PATCH 034/323] Incremental --- .../src/org/finos/morphir/runtime/TypeChecker.scala | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 54e44d6ba..325a0310a 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -45,10 +45,10 @@ class TypeChecker(dists: Distributions) { case _ => s"(${pretty(tpe1, 2)} vs ${pretty(tpe2, 2)})" } } - private def nameMissingValue(value: TypedValue, dists: Distributions): MorphirTypeError = {} - private def nameMissingType(fqn: FQName, dists: Distributions): MorphirTypeError = {} - private def nameMissingConstructor(fqn: FQName, tpe: UType, dists: Distributions): MorphirTypeError = {} - private def pretty(tpe: UType, depthBudget: Int): String = {} + private def nameMissingValue(value: TypedValue, dists: Distributions): MorphirTypeError = {"Todo"} + private def nameMissingType(fqn: FQName, dists: Distributions): MorphirTypeError = {"Todo"} + private def nameMissingConstructor(fqn: FQName, tpe: UType, dists: Distributions): MorphirTypeError = {"TOdo"} + private def pretty(tpe: UType, depthBudget: Int): String = {"Todo"} private def pretty(tpe: UType): String = pretty(tpe, 2) def check(suspect: TypedValue): TypeCheckerResult = check(suspect, Context.empty) From 1ab56a26ef755b78af7862944ecf70a4c6e3bfbf Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Mon, 14 Aug 2023 17:34:53 -0700 Subject: [PATCH 035/323] Incremental --- .../finos/morphir/runtime/TypeChecker.scala | 33 ++++++++++--------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 325a0310a..53eead066 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -29,26 +29,27 @@ object TypeChecker { } class TypeChecker(dists: Distributions) { + import TypeChecker.* private val functionOnion = Extractors.Types.FunctionOnion(dists) private def nameThatMismatch(tpe1: UType, tpe2: UType): String = { import Extractors.Types.* - (tpe1, tpe2) match { - case (NonNativeRef(fqn1, args1), NonNativeRef(fqn2, args2)) if fqn1 == fqn2 => - s"Refs to $fqn1 have different type args" - case (NonNativeRef(fqn1, _), NonNativeRef(fqn2, _)) => - val (pack1, mod1, loc1) = (fqn1.packagePath, fqn1.modulePath, fqn1.localName) - val (pack2, mod2, loc2) = (fqn2.packagePath, fqn2.modulePath, fqn2.localName) - val packPart = if (pack1 != pack2) s"{$pack1 $pack2}" else pack1 - val modPart = if (mod1 != mod2) s"{$mod1 $mod2}" else mod1 - val locPart = if (loc1 != loc2) s"{${loc1.toTitleCase} ${loc2.toTitleCase}" else loc1.toTitleCase - s"$packPart:$modPart:$locPart" - case _ => s"(${pretty(tpe1, 2)} vs ${pretty(tpe2, 2)})" - } + (tpe1, tpe2) match { + case (NonNativeRef(fqn1, args1), NonNativeRef(fqn2, args2)) if fqn1 == fqn2 => + s"Refs to $fqn1 have different type args" + case (NonNativeRef(fqn1, _), NonNativeRef(fqn2, _)) => + val (pack1, mod1, loc1) = (fqn1.packagePath, fqn1.modulePath, fqn1.localName) + val (pack2, mod2, loc2) = (fqn2.packagePath, fqn2.modulePath, fqn2.localName) + val packPart = if (pack1 != pack2) s"{$pack1 $pack2}" else pack1 + val modPart = if (mod1 != mod2) s"{$mod1 $mod2}" else mod1 + val locPart = if (loc1 != loc2) s"{${loc1.toTitleCase} ${loc2.toTitleCase}" else loc1.toTitleCase + s"$packPart:$modPart:$locPart" + case _ => s"(${pretty(tpe1, 2)} vs ${pretty(tpe2, 2)})" + } } - private def nameMissingValue(value: TypedValue, dists: Distributions): MorphirTypeError = {"Todo"} - private def nameMissingType(fqn: FQName, dists: Distributions): MorphirTypeError = {"Todo"} - private def nameMissingConstructor(fqn: FQName, tpe: UType, dists: Distributions): MorphirTypeError = {"TOdo"} - private def pretty(tpe: UType, depthBudget: Int): String = {"Todo"} + private def nameMissingValue(value: TypedValue, dists: Distributions): MorphirTypeError = {???} + private def nameMissingType(fqn: FQName, dists: Distributions): MorphirTypeError = {???} + private def nameMissingConstructor(fqn: FQName, tpe: UType, dists: Distributions): MorphirTypeError = {???} + private def pretty(tpe: UType, depthBudget: Int): String = {???} private def pretty(tpe: UType): String = pretty(tpe, 2) def check(suspect: TypedValue): TypeCheckerResult = check(suspect, Context.empty) From 4ff66a31ac10c7071aab2495fa65ca7f42c9a33d Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Mon, 14 Aug 2023 17:36:09 -0700 Subject: [PATCH 036/323] Incremental --- .../finos/morphir/runtime/TypeChecker.scala | 33 ++++++++++--------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 53eead066..762a94136 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -3,6 +3,7 @@ package org.finos.morphir.runtime import org.finos.morphir.naming._ import org.finos.morphir.naming._ import org.finos.morphir.ir.{Type as T, Value as V} +import org.finos.morphir.ir.Literal.Lit import org.finos.morphir.ir.Value.{Value, Pattern, TypedValue, USpecification => UValueSpec, UDefinition => UValueDef} import org.finos.morphir.ir.Type.{Type, UType, USpecification => UTypeSpec} import org.finos.morphir.ir.sdk @@ -58,32 +59,32 @@ class TypeChecker(dists: Distributions) { val context = parentContext.withDepth(parentContext.depth + 1) suspect match { case Literal(tpe, lit) => handleLiteral(tpe, lit, context) - case Apply(tpe, function, argument) => handleApply(tpe, function, argument, store, context) + case Apply(tpe, function, argument) => handleApply(tpe, function, argument, context) case Destructure(tpe, pattern, valueToDestruct, inValue) => - handleDestructure(tpe, pattern, valueToDestruct, inValue, store, context) - case Constructor(tpe, name) => handleConstructor(tpe, name, store, context) - case FieldValue(tpe, recordValue, name) => handleField(tpe, recordValue, name, store, context) + handleDestructure(tpe, pattern, valueToDestruct, inValue, context) + case Constructor(tpe, name) => handleConstructor(tpe, name, context) + case FieldValue(tpe, recordValue, name) => handleField(tpe, recordValue, name, context) case FieldFunction(tpe, name) => handleFieldFunction(tpe, name, context) case IfThenElse(tpe, condition, thenValue, elseValue) => - handleIfThenElse(tpe, condition, thenValue, elseValue, store, context) - case Lambda(tpe, pattern, body) => handleLambda(tpe, pattern, body, store, context) + handleIfThenElse(tpe, condition, thenValue, elseValue, context) + case Lambda(tpe, pattern, body) => handleLambda(tpe, pattern, body, context) case LetDefinition(tpe, name, definition, inValue) => - handleLetDefinition(tpe, name, definition, inValue, store, context) - case LetRecursion(tpe, definitions, inValue) => handleLetRecursion(tpe, definitions, inValue, store, context) - case ListValue(tpe, elements) => handleListValue(tpe, elements.toList, store, context) - case PatternMatch(tpe, value, cases) => handlePatternMatch(tpe, value, cases.toList, store, context) - case Record(tpe, fields) => handleRecord(tpe, fields.toList, store, context) - case Reference(tpe, name) => handleReference(tpe, name, store, context) - case Tuple(tpe, elements) => handleTuple(tpe, elements.toList, store, context) + handleLetDefinition(tpe, name, definition, inValue, context) + case LetRecursion(tpe, definitions, inValue) => handleLetRecursion(tpe, definitions, inValue, context) + case ListValue(tpe, elements) => handleListValue(tpe, elements.toList, context) + case PatternMatch(tpe, value, cases) => handlePatternMatch(tpe, value, cases.toList, context) + case Record(tpe, fields) => handleRecord(tpe, fields.toList, context) + case Reference(tpe, name) => handleReference(tpe, name, context) + case Tuple(tpe, elements) => handleTuple(tpe, elements.toList, context) case UnitValue(va) => handleUnit(va, context) - case UpdateRecord(tpe, valueToUpdate, fields) => handleUpdateRecord(tpe, valueToUpdate, fields, store, context) + case UpdateRecord(tpe, valueToUpdate, fields) => handleUpdateRecord(tpe, valueToUpdate, fields, context) case Variable(tpe, name) => handleVariable(tpe, name, store) } - def handleLiteral(tpe: UType, function: TypedValue, argument: TypedValue, context: Context): TypeCheckerResult = + def handleLiteral(tpe: UType, literal : Lit, context: Context): TypeCheckerResult = List() def handleApply(tpe: UType, function: TypedValue, argument: TypedValue, context: Context): TypeCheckerResult = List() - def handleDestructure(tpe: UType, function: TypedValue, argument: TypedValue, context: Context): TypeCheckerResult = + def handleDestructure(tpe: UType, pattern: Pattern, value : TypedValue, inValue : Value, context: Context): TypeCheckerResult = List() def handleConstructor(tpe: UType, function: TypedValue, argument: TypedValue, context: Context): TypeCheckerResult = List() From 51be3c866bff7597196d672a1f3038ba249dba85 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Mon, 14 Aug 2023 17:38:52 -0700 Subject: [PATCH 037/323] Incremental --- .../src/org/finos/morphir/runtime/TypeChecker.scala | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 762a94136..4ab24dca1 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -4,7 +4,7 @@ import org.finos.morphir.naming._ import org.finos.morphir.naming._ import org.finos.morphir.ir.{Type as T, Value as V} import org.finos.morphir.ir.Literal.Lit -import org.finos.morphir.ir.Value.{Value, Pattern, TypedValue, USpecification => UValueSpec, UDefinition => UValueDef} +import org.finos.morphir.ir.Value.{Value, Pattern, TypedValue, USpecification => UValueSpec, TypeDefinition => TypedValueDef} import org.finos.morphir.ir.Type.{Type, UType, USpecification => UTypeSpec} import org.finos.morphir.ir.sdk import org.finos.morphir.ir.sdk.Basics @@ -63,7 +63,7 @@ class TypeChecker(dists: Distributions) { case Destructure(tpe, pattern, valueToDestruct, inValue) => handleDestructure(tpe, pattern, valueToDestruct, inValue, context) case Constructor(tpe, name) => handleConstructor(tpe, name, context) - case FieldValue(tpe, recordValue, name) => handleField(tpe, recordValue, name, context) + case FieldValue(tpe, recordValue, name) => handleFieldValue(tpe, recordValue, name, context) case FieldFunction(tpe, name) => handleFieldFunction(tpe, name, context) case IfThenElse(tpe, condition, thenValue, elseValue) => handleIfThenElse(tpe, condition, thenValue, elseValue, context) @@ -84,9 +84,9 @@ class TypeChecker(dists: Distributions) { List() def handleApply(tpe: UType, function: TypedValue, argument: TypedValue, context: Context): TypeCheckerResult = List() - def handleDestructure(tpe: UType, pattern: Pattern, value : TypedValue, inValue : Value, context: Context): TypeCheckerResult = + def handleDestructure(tpe: UType, pattern: Pattern[UType], value : TypedValue, inValue : TypedValue, context: Context): TypeCheckerResult = List() - def handleConstructor(tpe: UType, function: TypedValue, argument: TypedValue, context: Context): TypeCheckerResult = + def handleConstructor(tpe: UType, fqn : FQName, context: Context): TypeCheckerResult = List() def handleFieldValue(tpe: UType, recordValue: TypedValue, name: Name, context: Context): TypeCheckerResult = List() @@ -100,7 +100,7 @@ class TypeChecker(dists: Distributions) { context: Context ): TypeCheckerResult = List() - def handleLambda(tpe: UType, pattern: Pattern, body: TypedValue, context: Context): TypeCheckerResult = + def handleLambda(tpe: UType, pattern: Pattern[UType], body: TypedValue, context: Context): TypeCheckerResult = List() def handleLetDefinition( tpe: UType, From 7dcadde8280b22d1a9d8e0d9bc40ce01357dd79a Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Mon, 14 Aug 2023 17:40:17 -0700 Subject: [PATCH 038/323] Incremental --- .../src/org/finos/morphir/runtime/TypeChecker.scala | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 4ab24dca1..9a9d43309 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -4,7 +4,7 @@ import org.finos.morphir.naming._ import org.finos.morphir.naming._ import org.finos.morphir.ir.{Type as T, Value as V} import org.finos.morphir.ir.Literal.Lit -import org.finos.morphir.ir.Value.{Value, Pattern, TypedValue, USpecification => UValueSpec, TypeDefinition => TypedValueDef} +import org.finos.morphir.ir.Value.{Value, Pattern, TypedValue, USpecification => UValueSpec, TypedDefinition => TypedValueDef} import org.finos.morphir.ir.Type.{Type, UType, USpecification => UTypeSpec} import org.finos.morphir.ir.sdk import org.finos.morphir.ir.sdk.Basics @@ -76,7 +76,7 @@ class TypeChecker(dists: Distributions) { case Record(tpe, fields) => handleRecord(tpe, fields.toList, context) case Reference(tpe, name) => handleReference(tpe, name, context) case Tuple(tpe, elements) => handleTuple(tpe, elements.toList, context) - case UnitValue(va) => handleUnit(va, context) + case UnitValue(va) => handleUnitValue(va, context) case UpdateRecord(tpe, valueToUpdate, fields) => handleUpdateRecord(tpe, valueToUpdate, fields, context) case Variable(tpe, name) => handleVariable(tpe, name, store) } @@ -105,14 +105,14 @@ class TypeChecker(dists: Distributions) { def handleLetDefinition( tpe: UType, name: Name, - definition: UValueDef, + definition: TypedValueDef, inValue: TypedValue, context: Context ): TypeCheckerResult = List() def handleLetRecursion( tpe: UType, - definitions: Map[Name, UValueDef], + definitions: Map[Name, TypedValueDef], inValue: TypedValue, context: Context ): TypeCheckerResult = From 12dfe8cecec18ef903c073832be61264376c6487 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Mon, 14 Aug 2023 17:41:32 -0700 Subject: [PATCH 039/323] Incremental --- .../runtime/src/org/finos/morphir/runtime/TypeChecker.scala | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 9a9d43309..ef727b5b6 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -54,7 +54,7 @@ class TypeChecker(dists: Distributions) { private def pretty(tpe: UType): String = pretty(tpe, 2) def check(suspect: TypedValue): TypeCheckerResult = check(suspect, Context.empty) - def check(suspect: TypedValue, parentContext: Context) = { + def check(suspect: TypedValue, parentContext: Context): TypeCheckerResult = { import Value.{Unit as UnitValue, List as ListValue, Field as FieldValue, *} val context = parentContext.withDepth(parentContext.depth + 1) suspect match { @@ -78,7 +78,7 @@ class TypeChecker(dists: Distributions) { case Tuple(tpe, elements) => handleTuple(tpe, elements.toList, context) case UnitValue(va) => handleUnitValue(va, context) case UpdateRecord(tpe, valueToUpdate, fields) => handleUpdateRecord(tpe, valueToUpdate, fields, context) - case Variable(tpe, name) => handleVariable(tpe, name, store) + case Variable(tpe, name) => handleVariable(tpe, name, context) } def handleLiteral(tpe: UType, literal : Lit, context: Context): TypeCheckerResult = List() @@ -136,7 +136,7 @@ class TypeChecker(dists: Distributions) { List() def handleUpdateRecord( tpe: UType, - valueToUpdate: Name, + valueToUpdate: TypedValue, fields: Map[Name, TypedValue], context: Context ): TypeCheckerResult = From 543534937f26e2f3580ac3dcf16bada226dc05fe Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Mon, 14 Aug 2023 17:42:20 -0700 Subject: [PATCH 040/323] Incremental --- morphir/runtime/src/org/finos/morphir/runtime/Utils.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala index f54ae9f92..c33ca231d 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala @@ -21,12 +21,12 @@ import org.finos.morphir.ir.Value.{USpecification => UValueSpec, Definition => V import org.finos.morphir.ir.Type.{USpecification => UTypeSpec} object Utils { - import Extractors.* + import Extractors.Types* def dealias(original_tpe: UType, dists: Distributions, bindings: Map[Name, UType]): UType = { def loop(tpe: UType, bindings: Map[Name, UType]): UType = tpe match { - case SDKRef() => applyBindings(tpe, bindings) // nothing further to look up + case NativeRef() => applyBindings(tpe, bindings) // nothing further to look up case Type.Reference(_, typeName, typeArgs) => val lookedUp = dists.lookupTypeSpecification(typeName.packagePath, typeName.modulePath, typeName.localName) lookedUp match { From 26e692fb4939713ab9729d49b05dd47d14c1e206 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Mon, 14 Aug 2023 17:45:24 -0700 Subject: [PATCH 041/323] Incremental --- .../finos/morphir/runtime/TypeChecker.scala | 149 +++++++++--------- .../src/org/finos/morphir/runtime/Utils.scala | 2 +- .../runtime/quick/EvaluatorQuick.scala | 32 ++-- 3 files changed, 92 insertions(+), 91 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index ef727b5b6..30fbef9c4 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -58,91 +58,92 @@ class TypeChecker(dists: Distributions) { import Value.{Unit as UnitValue, List as ListValue, Field as FieldValue, *} val context = parentContext.withDepth(parentContext.depth + 1) suspect match { - case Literal(tpe, lit) => handleLiteral(tpe, lit, context) + case Literal(tpe, lit) => handleLiteral(tpe, lit, context) case Apply(tpe, function, argument) => handleApply(tpe, function, argument, context) case Destructure(tpe, pattern, valueToDestruct, inValue) => handleDestructure(tpe, pattern, valueToDestruct, inValue, context) - case Constructor(tpe, name) => handleConstructor(tpe, name, context) + case Constructor(tpe, name) => handleConstructor(tpe, name, context) case FieldValue(tpe, recordValue, name) => handleFieldValue(tpe, recordValue, name, context) - case FieldFunction(tpe, name) => handleFieldFunction(tpe, name, context) + case FieldFunction(tpe, name) => handleFieldFunction(tpe, name, context) case IfThenElse(tpe, condition, thenValue, elseValue) => handleIfThenElse(tpe, condition, thenValue, elseValue, context) case Lambda(tpe, pattern, body) => handleLambda(tpe, pattern, body, context) case LetDefinition(tpe, name, definition, inValue) => handleLetDefinition(tpe, name, definition, inValue, context) - case LetRecursion(tpe, definitions, inValue) => handleLetRecursion(tpe, definitions, inValue, context) - case ListValue(tpe, elements) => handleListValue(tpe, elements.toList, context) - case PatternMatch(tpe, value, cases) => handlePatternMatch(tpe, value, cases.toList, context) - case Record(tpe, fields) => handleRecord(tpe, fields.toList, context) - case Reference(tpe, name) => handleReference(tpe, name, context) - case Tuple(tpe, elements) => handleTuple(tpe, elements.toList, context) - case UnitValue(va) => handleUnitValue(va, context) + case LetRecursion(tpe, definitions, inValue) => handleLetRecursion(tpe, definitions, inValue, context) + case ListValue(tpe, elements) => handleListValue(tpe, elements.toList, context) + case PatternMatch(tpe, value, cases) => handlePatternMatch(tpe, value, cases.toList, context) + case Record(tpe, fields) => handleRecord(tpe, fields.toList, context) + case Reference(tpe, name) => handleReference(tpe, name, context) + case Tuple(tpe, elements) => handleTuple(tpe, elements.toList, context) + case UnitValue(va) => handleUnitValue(va, context) case UpdateRecord(tpe, valueToUpdate, fields) => handleUpdateRecord(tpe, valueToUpdate, fields, context) - case Variable(tpe, name) => handleVariable(tpe, name, context) + case Variable(tpe, name) => handleVariable(tpe, name, context) } - def handleLiteral(tpe: UType, literal : Lit, context: Context): TypeCheckerResult = - List() - def handleApply(tpe: UType, function: TypedValue, argument: TypedValue, context: Context): TypeCheckerResult = - List() - def handleDestructure(tpe: UType, pattern: Pattern[UType], value : TypedValue, inValue : TypedValue, context: Context): TypeCheckerResult = - List() - def handleConstructor(tpe: UType, fqn : FQName, context: Context): TypeCheckerResult = - List() - def handleFieldValue(tpe: UType, recordValue: TypedValue, name: Name, context: Context): TypeCheckerResult = - List() - def handleFieldFunction(tpe: UType, name: Name, context: Context): TypeCheckerResult = - List() - def handleIfThenElse( - tpe: UType, - condition: TypedValue, - thenValue: TypedValue, - elseValue: TypedValue, - context: Context - ): TypeCheckerResult = - List() - def handleLambda(tpe: UType, pattern: Pattern[UType], body: TypedValue, context: Context): TypeCheckerResult = - List() - def handleLetDefinition( - tpe: UType, - name: Name, - definition: TypedValueDef, - inValue: TypedValue, - context: Context - ): TypeCheckerResult = - List() - def handleLetRecursion( - tpe: UType, - definitions: Map[Name, TypedValueDef], - inValue: TypedValue, - context: Context - ): TypeCheckerResult = - List() - def handleListValue(tpe: UType, elements: List[TypedValue], context: Context): TypeCheckerResult = - List() - def handlePatternMatch( - tpe: UType, - value: TypedValue, - cases: List[(Pattern[UType], TypedValue)], - context: Context - ): TypeCheckerResult = - List() - def handleRecord(tpe: UType, fields: List[(Name, TypedValue)], context: Context): TypeCheckerResult = - List() - def handleReference(tpe: UType, fqn: FQName, context: Context): TypeCheckerResult = - List() - def handleTuple(tpe: UType, elements: List[TypedValue], context: Context): TypeCheckerResult = - List() - def handleUnitValue(tpe: UType, context: Context): TypeCheckerResult = - List() - def handleUpdateRecord( - tpe: UType, - valueToUpdate: TypedValue, - fields: Map[Name, TypedValue], - context: Context - ): TypeCheckerResult = - List() - def handleVariable(tpe: UType, name: Name, context: Context): TypeCheckerResult = - List() + } + def handleLiteral(tpe: UType, literal : Lit, context: Context): TypeCheckerResult = + List() + def handleApply(tpe: UType, function: TypedValue, argument: TypedValue, context: Context): TypeCheckerResult = + List() + def handleDestructure(tpe: UType, pattern: Pattern[UType], value : TypedValue, inValue : TypedValue, context: Context): TypeCheckerResult = + List() + def handleConstructor(tpe: UType, fqn : FQName, context: Context): TypeCheckerResult = + List() + def handleFieldValue(tpe: UType, recordValue: TypedValue, name: Name, context: Context): TypeCheckerResult = + List() + def handleFieldFunction(tpe: UType, name: Name, context: Context): TypeCheckerResult = + List() + def handleIfThenElse( + tpe: UType, + condition: TypedValue, + thenValue: TypedValue, + elseValue: TypedValue, + context: Context + ): TypeCheckerResult = + List() + def handleLambda(tpe: UType, pattern: Pattern[UType], body: TypedValue, context: Context): TypeCheckerResult = + List() + def handleLetDefinition( + tpe: UType, + name: Name, + definition: TypedValueDef, + inValue: TypedValue, + context: Context + ): TypeCheckerResult = + List() + def handleLetRecursion( + tpe: UType, + definitions: Map[Name, TypedValueDef], + inValue: TypedValue, + context: Context + ): TypeCheckerResult = + List() + def handleListValue(tpe: UType, elements: List[TypedValue], context: Context): TypeCheckerResult = + List() + def handlePatternMatch( + tpe: UType, + value: TypedValue, + cases: List[(Pattern[UType], TypedValue)], + context: Context + ): TypeCheckerResult = + List() + def handleRecord(tpe: UType, fields: List[(Name, TypedValue)], context: Context): TypeCheckerResult = + List() + def handleReference(tpe: UType, fqn: FQName, context: Context): TypeCheckerResult = + List() + def handleTuple(tpe: UType, elements: List[TypedValue], context: Context): TypeCheckerResult = + List() + def handleUnitValue(tpe: UType, context: Context): TypeCheckerResult = + List() + def handleUpdateRecord( + tpe: UType, + valueToUpdate: TypedValue, + fields: Map[Name, TypedValue], + context: Context + ): TypeCheckerResult = + List() + def handleVariable(tpe: UType, name: Name, context: Context): TypeCheckerResult = + List() } } diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala index c33ca231d..fcee97041 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala @@ -21,7 +21,7 @@ import org.finos.morphir.ir.Value.{USpecification => UValueSpec, Definition => V import org.finos.morphir.ir.Type.{USpecification => UTypeSpec} object Utils { - import Extractors.Types* + import Extractors.Types.* def dealias(original_tpe: UType, dists: Distributions, bindings: Map[Name, UType]): UType = { def loop(tpe: UType, bindings: Map[Name, UType]): UType = diff --git a/morphir/runtime/src/org/finos/morphir/runtime/quick/EvaluatorQuick.scala b/morphir/runtime/src/org/finos/morphir/runtime/quick/EvaluatorQuick.scala index cfa4d9e16..2fe594118 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/quick/EvaluatorQuick.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/quick/EvaluatorQuick.scala @@ -9,7 +9,7 @@ import org.finos.morphir.ir.{Type as T, Value as V} import org.finos.morphir.ir.Value.* import org.finos.morphir.ir.distribution.Distribution import org.finos.morphir.naming.* -import org.finos.morphir.runtime.Extractors.* +import org.finos.morphir.runtime.Extractors.Types.* import org.finos.morphir.runtime.Distributions import org.finos.morphir.runtime.environment.MorphirEnv import org.finos.morphir.runtime.exports.* @@ -95,22 +95,22 @@ object EvaluatorQuick { SDKValue.SDKNativeFunction(nf.arity, f) } - def typeToConcept(tpe: Type.Type[Unit], dists: Distributions, boundTypes: Map[Name, Concept]): Concept = + def typeToConcept(tpe: Type.Type[Unit], dists: Distributions, boundTypes: Map[Name, Concept]): Concept = { tpe match { case TT.ExtensibleRecord(attributes, name, fields) => throw UnsupportedType("Extensible records not supported for DDL") case TT.Function(attributes, argumentType, returnType) => throw UnsupportedType("Functiom types not supported for DDL") case TT.Record(attributes, fields) => Concept.Struct(fields.map(field => - (Label(field.name.toCamelCase), typeToConcept(field.data, dists, boundTypes)) - ).toList) - case IntRef() => Concept.Int32 - case Int32Ref() => Concept.Int32 - case StringRef() => Concept.String - case BoolRef() => Concept.Boolean - case CharRef() => Concept.Char - case FloatRef() => Concept.Decimal - case DecimalRef() => Concept.Decimal + (Label(field.name.toCamelCase), typeToConcept(field.data, dists, boundTypes)) + ).toList) + case IntRef() => Concept.Int32 + case Int32Ref() => Concept.Int32 + case StringRef() => Concept.String + case BoolRef() => Concept.Boolean + case CharRef() => Concept.Char + case FloatRef() => Concept.Decimal + case DecimalRef() => Concept.Decimal case LocalDateRef() => Concept.LocalDate case LocalTimeRef() => Concept.LocalTime @@ -123,14 +123,14 @@ object EvaluatorQuick { case DictRef(keyType, valType) => Concept.Map(typeToConcept(keyType, dists, boundTypes), typeToConcept(valType, dists, boundTypes)) case TT.Reference(attributes, typeName, typeArgs) => - val lookedUp = dists.lookupTypeSpecification(typeName.packagePath, typeName.modulePath, typeName.localName) + val lookedUp = dists.lookupTypeSpecification(typeName.packagePath, typeName.modulePath, typeName.localName) val conceptArgs = typeArgs.map(typeToConcept(_, dists, boundTypes)) lookedUp.getOrElse(throw new Exception(s"Could not find spec for $typeName")) match { case Type.Specification.TypeAliasSpecification(typeParams, expr) => val newBindings = typeParams.zip(conceptArgs).toMap typeToConcept(expr, dists, newBindings) match { case Concept.Struct(fields) => Concept.Record(typeName, fields) - case other => Concept.Alias(typeName, other) + case other => Concept.Alias(typeName, other) } case Type.Specification.CustomTypeSpecification(typeParams, ctors) => val newBindings = typeParams.zip(conceptArgs).toMap @@ -138,7 +138,7 @@ object EvaluatorQuick { val argTuples = args.map { case (argName: Name, argType: Type.UType) => (EnumLabel.Named(argName.toCamelCase), typeToConcept(argType, dists, newBindings)) } - val conceptName: String = caseName.toTitleCase + val conceptName: String = caseName.toTitleCase val concepts: List[(EnumLabel, Concept)] = argTuples.toList Concept.Enum.Case(Label(conceptName), concepts) } @@ -147,10 +147,10 @@ object EvaluatorQuick { } case TT.Tuple(attributes, elements) => Concept.Tuple(elements.map(element => typeToConcept(element, dists, boundTypes)).toList) - case TT.Unit(attributes) => Concept.Unit + case TT.Unit(attributes) => Concept.Unit case TT.Variable(attributes, name) => boundTypes(name) } - + } def resultAndConceptToData(result: Result[Unit, Type.UType], concept: Concept): Data = (concept, result) match { case (Concept.Struct(fields), Result.Record(elements)) => From 90ccaa9b78e2df22ea75727a42d3efea6dcf1a2d Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Mon, 14 Aug 2023 17:47:38 -0700 Subject: [PATCH 042/323] Incremental --- morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala | 1 - morphir/runtime/src/org/finos/morphir/runtime/Utils.scala | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 30fbef9c4..1e6677201 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -144,6 +144,5 @@ class TypeChecker(dists: Distributions) { List() def handleVariable(tpe: UType, name: Name, context: Context): TypeCheckerResult = List() - } } diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala index fcee97041..581f2a77c 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala @@ -166,7 +166,7 @@ object Utils { params match { case Chunk() => inner case chunk => - curryTypeFunction(Type.Function(getattributes(inner), chunk.head._2, inner), chunk.tail) + curryTypeFunction(Type.Function(inner.attributes, chunk.head._2, inner), chunk.tail) } } From d160d66d24a20a754d6f64c1fa85272994193cc7 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Mon, 14 Aug 2023 17:49:31 -0700 Subject: [PATCH 043/323] Incremental --- .../src/org/finos/morphir/runtime/Utils.scala | 41 +++++++++++-------- .../runtime/quick/EvaluatorQuick.scala | 1 + 2 files changed, 24 insertions(+), 18 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala index 581f2a77c..a8360cd48 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala @@ -136,25 +136,30 @@ object Utils { curryTypeFunction(spec.output, spec.inputs) def unCurryTypeFunction( - curried: UType, - args: List[UType], - dists: Distributions, - knownBindings: Map[Name, UType] - )(implicit options: RTExecutionContext.Options): RTAction[Any, TypeError, UType] = { - val dealiaser = new Dealiased(dists) - (curried, args) match { - case (Type.Function(attributes, parameterType, returnType), head :: tail) => - for { - bindings <- RTAction.fromEither(typeCheckArg(head, parameterType, knownBindings)) - appliedType <- unCurryTypeFunction(returnType, tail, dists, bindings) - } yield appliedType - case (tpe, Nil) => RTAction.succeed(applyBindings(tpe, knownBindings)) - case (dealiaser(inner, aliasBindings), args) => - unCurryTypeFunction(inner, args, dists, knownBindings ++ aliasBindings) - case (nonFunction, head :: _) => - RTAction.fail(TooManyArgs(s"Tried to apply argument $head to non-function $nonFunction")) + curried: UType, + args: List[TypedValue], + dists: Distributions, + knownBindings: Map[Name, UType] + )(implicit options: RTExecutionContext.Options): RTAction[Any, TypeError, UType] = { + val dealiaser = new Dealiased(dists) + (curried, args) match { + case (Type.Function(attributes, parameterType, returnType), head :: tail) => + for { + + // errors <- RTAction.succeed(new ArgTypeChecker(dists).reallyTypeCheckArg(head, parameterType, "")) + bindings <- RTAction.fromEither(typeCheckArg(head.attributes, parameterType, knownBindings)) + // _ <- RTAction.fail( new ManyErrors(errors: _*)) + //// errors = new TypeChecker().reallyTypeCheckArg(head, parameterType, "") + //// _ <- RTAction.fail(new ManyErrors(errors:_*)) + appliedType <- unCurryTypeFunction(returnType, tail, dists, bindings) + } yield appliedType + case (tpe, Nil) => RTAction.succeed(applyBindings(tpe, knownBindings)) + case (dealiaser(inner, aliasBindings), args) => + unCurryTypeFunction(inner, args, dists, knownBindings ++ aliasBindings) + case (nonFunction, head :: _) => + RTAction.fail(TooManyArgs(s"Tried to apply argument $head to non-function $nonFunction")) + } } - } def isNative(fqn: FQName): Boolean = { val example = FQName.fromString("Morphir.SDK:Basics:equal") fqn.getPackagePath == example.getPackagePath diff --git a/morphir/runtime/src/org/finos/morphir/runtime/quick/EvaluatorQuick.scala b/morphir/runtime/src/org/finos/morphir/runtime/quick/EvaluatorQuick.scala index 2fe594118..05f2843d2 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/quick/EvaluatorQuick.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/quick/EvaluatorQuick.scala @@ -9,6 +9,7 @@ import org.finos.morphir.ir.{Type as T, Value as V} import org.finos.morphir.ir.Value.* import org.finos.morphir.ir.distribution.Distribution import org.finos.morphir.naming.* +import org.finos.morphir.runtime.Extractors.* import org.finos.morphir.runtime.Extractors.Types.* import org.finos.morphir.runtime.Distributions import org.finos.morphir.runtime.environment.MorphirEnv From 8835f5438ffc9eb66f2231971b0a57e37ab63c69 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Mon, 14 Aug 2023 17:57:23 -0700 Subject: [PATCH 044/323] Incremental --- .../finos/morphir/runtime/TypeChecker.scala | 25 ++++++++++++++----- 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 1e6677201..dc755d9c6 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -81,12 +81,25 @@ class TypeChecker(dists: Distributions) { case Variable(tpe, name) => handleVariable(tpe, name, context) } } - def handleLiteral(tpe: UType, literal : Lit, context: Context): TypeCheckerResult = - List() - def handleApply(tpe: UType, function: TypedValue, argument: TypedValue, context: Context): TypeCheckerResult = - List() - def handleDestructure(tpe: UType, pattern: Pattern[UType], value : TypedValue, inValue : TypedValue, context: Context): TypeCheckerResult = - List() + def handleLiteral(tpe: UType, literal : Lit, context: Context): TypeCheckerResult = { + val fromChildren = List() + //TODO: Check lit agrees + fromChildren + } + + def handleApply(tpe: UType, function: TypedValue, argument: TypedValue, context: Context): TypeCheckerResult = { + val fromChildren = check(function, context) ++ check(argument, context) + //TODO: Check it's a function with matching arg and return + fromChildren + } + + def handleDestructure(tpe: UType, pattern: Pattern[UType], value : TypedValue, inValue : TypedValue, context: Context): TypeCheckerResult = { + val fromChildren = check(value, context) ++ check(inValue, context) + //TODO: Check inValue matches tpe + //TODO: Check pattern can be value + //TODO: Check value must be pattern + fromChildren + } def handleConstructor(tpe: UType, fqn : FQName, context: Context): TypeCheckerResult = List() def handleFieldValue(tpe: UType, recordValue: TypedValue, name: Name, context: Context): TypeCheckerResult = From 52ae3336b81f4415cc29e51c08740a83944df3b2 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Mon, 14 Aug 2023 17:58:55 -0700 Subject: [PATCH 045/323] Incremental --- .../org/finos/morphir/runtime/TypeChecker.scala | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index dc755d9c6..3baffbcfa 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -100,10 +100,16 @@ class TypeChecker(dists: Distributions) { //TODO: Check value must be pattern fromChildren } - def handleConstructor(tpe: UType, fqn : FQName, context: Context): TypeCheckerResult = - List() - def handleFieldValue(tpe: UType, recordValue: TypedValue, name: Name, context: Context): TypeCheckerResult = - List() + def handleConstructor(tpe: UType, fqn : FQName, context: Context): TypeCheckerResult = { + val fromChildren = List() + //TODO: Check it's a function onion for a type with that constructor + fromChildren + } + def handleFieldValue(tpe: UType, recordValue: TypedValue, name: Name, context: Context): TypeCheckerResult = { + val fromChildren = check(recordVale, context) + //TODO: Check the value dealiases to a record which has that name + fromChildren + } def handleFieldFunction(tpe: UType, name: Name, context: Context): TypeCheckerResult = List() def handleIfThenElse( From 2147a1043bfba16d127a205e2e81f5de925f7f10 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Mon, 14 Aug 2023 17:59:37 -0700 Subject: [PATCH 046/323] Incremental --- .../src/org/finos/morphir/runtime/TypeChecker.scala | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 3baffbcfa..2b80d8d43 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -110,8 +110,11 @@ class TypeChecker(dists: Distributions) { //TODO: Check the value dealiases to a record which has that name fromChildren } - def handleFieldFunction(tpe: UType, name: Name, context: Context): TypeCheckerResult = - List() + def handleFieldFunction(tpe: UType, name: Name, context: Context): TypeCheckerResult = { + val fromChildren = List() + //TODO: Uh... Nothing. + fromChildren + } def handleIfThenElse( tpe: UType, condition: TypedValue, From 0211420769ae47c3c6454d52ffb838d612bf3f10 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Mon, 14 Aug 2023 18:00:19 -0700 Subject: [PATCH 047/323] Incremental --- .../src/org/finos/morphir/runtime/TypeChecker.scala | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 2b80d8d43..bd8398ea1 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -121,8 +121,11 @@ class TypeChecker(dists: Distributions) { thenValue: TypedValue, elseValue: TypedValue, context: Context - ): TypeCheckerResult = - List() + ): TypeCheckerResult = { + val fromChildren = check(condition, context) ++ check(thenValue, context)++ check(elseValue, context) + //TODO: Check condition is boolean and branches agree withe ach other/tpe + fromChildren + } def handleLambda(tpe: UType, pattern: Pattern[UType], body: TypedValue, context: Context): TypeCheckerResult = List() def handleLetDefinition( From 0eba92c33afd0a0aa0a6c132727274ddd90635ed Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Mon, 14 Aug 2023 18:02:00 -0700 Subject: [PATCH 048/323] Incremental --- .../src/org/finos/morphir/runtime/TypeChecker.scala | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index bd8398ea1..6516f77a5 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -126,8 +126,13 @@ class TypeChecker(dists: Distributions) { //TODO: Check condition is boolean and branches agree withe ach other/tpe fromChildren } - def handleLambda(tpe: UType, pattern: Pattern[UType], body: TypedValue, context: Context): TypeCheckerResult = - List() + def handleLambda(tpe: UType, pattern: Pattern[UType], body: TypedValue, context: Context): TypeCheckerResult = { + val fromChildren = check(body, context) + //TODO: Check tpe is a function + //TODO: Check tpe's argument matches (strictly) with pattern + //TODO: Figure out variable bindings + fromChildren + } def handleLetDefinition( tpe: UType, name: Name, From 2ae3342488e3fc6c1f25b41da285db0727201020 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Mon, 14 Aug 2023 18:05:05 -0700 Subject: [PATCH 049/323] Incremental --- .../finos/morphir/runtime/TypeChecker.scala | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 6516f77a5..df2e9a59c 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -139,16 +139,28 @@ class TypeChecker(dists: Distributions) { definition: TypedValueDef, inValue: TypedValue, context: Context - ): TypeCheckerResult = - List() + ): TypeCheckerResult = { + val fromChildren = check(inValue, context) + //TODO: Manage Store + //TODO: Check definition body + //TODO: Check definition body w/ argument types added to store + fromChildren + } def handleLetRecursion( tpe: UType, definitions: Map[Name, TypedValueDef], inValue: TypedValue, context: Context - ): TypeCheckerResult = - List() - def handleListValue(tpe: UType, elements: List[TypedValue], context: Context): TypeCheckerResult = + ): TypeCheckerResult = { + val fromChildren = check(inValue, context) + //TODO: Manage store + //TODO: Check definition types and add to stores + fromChildren + } + def handleListValue(tpe: UType, elements: List[TypedValue], context: Context): TypeCheckerResult = { + val fromChildren = elements.map(check(_, context)) + //TODO: Check the value dealiases to a record which has that name + fromChildren List() def handlePatternMatch( tpe: UType, From 7e6eba89b22a899849b87c3c9efe24b053f71f1b Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Mon, 14 Aug 2023 18:07:02 -0700 Subject: [PATCH 050/323] Incremental --- .../org/finos/morphir/runtime/TypeChecker.scala | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index df2e9a59c..148378cc0 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -159,16 +159,22 @@ class TypeChecker(dists: Distributions) { } def handleListValue(tpe: UType, elements: List[TypedValue], context: Context): TypeCheckerResult = { val fromChildren = elements.map(check(_, context)) - //TODO: Check the value dealiases to a record which has that name + //TODO: Check tpe is a list, check children types agree w/ parent type (probably only report one mismatch, but inspect all values fromChildren - List() + } def handlePatternMatch( tpe: UType, value: TypedValue, cases: List[(Pattern[UType], TypedValue)], context: Context - ): TypeCheckerResult = - List() + ): TypeCheckerResult = { + val fromChildren = check(value, context) + //TODO: Check values from each case + //TODO: Manage store + //TODO: Check each case's pattern can be it's value + //TODO: Check value must be one of the patterns + fromChildren + } def handleRecord(tpe: UType, fields: List[(Name, TypedValue)], context: Context): TypeCheckerResult = List() def handleReference(tpe: UType, fqn: FQName, context: Context): TypeCheckerResult = From 61395719b5d0faae0aa9b39ef73b85c34213661d Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Mon, 14 Aug 2023 18:07:50 -0700 Subject: [PATCH 051/323] Incremental --- .../src/org/finos/morphir/runtime/TypeChecker.scala | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 148378cc0..661333705 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -175,8 +175,12 @@ class TypeChecker(dists: Distributions) { //TODO: Check value must be one of the patterns fromChildren } - def handleRecord(tpe: UType, fields: List[(Name, TypedValue)], context: Context): TypeCheckerResult = - List() + def handleRecord(tpe: UType, fields: List[(Name, TypedValue)], context: Context): TypeCheckerResult = { + val fromChildren = fields.map(check(_._2, context)) + //TODO: Check tpe dealises to a record + //TODO: Check each field agrees with the type from the name + fromChildren + } def handleReference(tpe: UType, fqn: FQName, context: Context): TypeCheckerResult = List() def handleTuple(tpe: UType, elements: List[TypedValue], context: Context): TypeCheckerResult = From c1d3149700c55599d3d3876a6ef2eb26c8203e65 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Mon, 14 Aug 2023 18:11:00 -0700 Subject: [PATCH 052/323] Incremental --- .../finos/morphir/runtime/TypeChecker.scala | 25 +++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 661333705..cc18bd41c 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -181,20 +181,31 @@ class TypeChecker(dists: Distributions) { //TODO: Check each field agrees with the type from the name fromChildren } - def handleReference(tpe: UType, fqn: FQName, context: Context): TypeCheckerResult = - List() - def handleTuple(tpe: UType, elements: List[TypedValue], context: Context): TypeCheckerResult = - List() + def handleReference(tpe: UType, fqn: FQName, context: Context): TypeCheckerResult = { + val fromChildren = List() + //TODO: Check the value dealiases to a definition that translates to this tpe + fromChildren + } + def handleTuple(tpe: UType, elements: List[TypedValue], context: Context): TypeCheckerResult = { + val fromChildren = elements.map(check(_, context)) + //TODO: Check tpe dealiases to a tuple + //TODO: Check tuple types vs. nested value types + fromChildren + } def handleUnitValue(tpe: UType, context: Context): TypeCheckerResult = - List() + List() //Pass def handleUpdateRecord( tpe: UType, valueToUpdate: TypedValue, fields: Map[Name, TypedValue], context: Context - ): TypeCheckerResult = - List() + ): TypeCheckerResult = { + val fromChildren = check(valueToUpdate, context) ++ fields.map(check(_._2), context) + //TODO: Check the value dealiases to a record which has that name + fromChildren + } def handleVariable(tpe: UType, name: Name, context: Context): TypeCheckerResult = + //TODO: Keep that in the context List() } From 100a414b65c14e50e95bac0602841f4d820eafd3 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Mon, 14 Aug 2023 18:15:02 -0700 Subject: [PATCH 053/323] Incremental --- .../src/org/finos/morphir/runtime/TypeChecker.scala | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index cc18bd41c..8a8074f7a 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -106,7 +106,7 @@ class TypeChecker(dists: Distributions) { fromChildren } def handleFieldValue(tpe: UType, recordValue: TypedValue, name: Name, context: Context): TypeCheckerResult = { - val fromChildren = check(recordVale, context) + val fromChildren = check(recordValue, context) //TODO: Check the value dealiases to a record which has that name fromChildren } @@ -158,7 +158,7 @@ class TypeChecker(dists: Distributions) { fromChildren } def handleListValue(tpe: UType, elements: List[TypedValue], context: Context): TypeCheckerResult = { - val fromChildren = elements.map(check(_, context)) + val fromChildren = elements.flatMap(check(_, context)) //TODO: Check tpe is a list, check children types agree w/ parent type (probably only report one mismatch, but inspect all values fromChildren } @@ -176,7 +176,7 @@ class TypeChecker(dists: Distributions) { fromChildren } def handleRecord(tpe: UType, fields: List[(Name, TypedValue)], context: Context): TypeCheckerResult = { - val fromChildren = fields.map(check(_._2, context)) + val fromChildren = fields.flatMap{case (_, value) => check(value, context)} //TODO: Check tpe dealises to a record //TODO: Check each field agrees with the type from the name fromChildren @@ -187,7 +187,7 @@ class TypeChecker(dists: Distributions) { fromChildren } def handleTuple(tpe: UType, elements: List[TypedValue], context: Context): TypeCheckerResult = { - val fromChildren = elements.map(check(_, context)) + val fromChildren = elements.flatMap(check(_, context)) //TODO: Check tpe dealiases to a tuple //TODO: Check tuple types vs. nested value types fromChildren @@ -200,12 +200,13 @@ class TypeChecker(dists: Distributions) { fields: Map[Name, TypedValue], context: Context ): TypeCheckerResult = { - val fromChildren = check(valueToUpdate, context) ++ fields.map(check(_._2), context) + val fromChildren = check(valueToUpdate, context) ++ fields.flatMap{case (_, value) => check(value), context} //TODO: Check the value dealiases to a record which has that name fromChildren } def handleVariable(tpe: UType, name: Name, context: Context): TypeCheckerResult = //TODO: Keep that in the context + //TODONT: Do not re-check the body - only make sure that the tpe matches this List() } From 6d65c17f8233543a143436101076f9361fa928a7 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Mon, 14 Aug 2023 18:22:20 -0700 Subject: [PATCH 054/323] Incremental --- .../finos/morphir/runtime/TypeChecker.scala | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 8a8074f7a..ee3112603 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -51,6 +51,13 @@ class TypeChecker(dists: Distributions) { private def nameMissingType(fqn: FQName, dists: Distributions): MorphirTypeError = {???} private def nameMissingConstructor(fqn: FQName, tpe: UType, dists: Distributions): MorphirTypeError = {???} private def pretty(tpe: UType, depthBudget: Int): String = {???} + + def dealias(tpe: UType, context: Context): Either[GoodTypeError, UType] = { + def loop(tpe: UType, original_fqn: Option[FQName], context: Context): Either[GoodTypeError, UType] = + } + + loop(tpe, None, context) + } private def pretty(tpe: UType): String = pretty(tpe, 2) def check(suspect: TypedValue): TypeCheckerResult = check(suspect, Context.empty) @@ -89,8 +96,16 @@ class TypeChecker(dists: Distributions) { def handleApply(tpe: UType, function: TypedValue, argument: TypedValue, context: Context): TypeCheckerResult = { val fromChildren = check(function, context) ++ check(argument, context) + val fromTpe = + dealias(function.attributes, context) match { + case Right(Type.Function(_, paramType, returnType)) => + helper(paramType != argument.attributes, new ArgumentDoesNotMatchParameter(argument, paramType)) ++ + helper(returnType != tpe, new TypesMismatch(tpe, returnType, "Function return does not match apply node")) + case Right(other) => List(new ApplyToNonFunction(other, argument.attributes)) + case Left(err) => List(err) + } //TODO: Check it's a function with matching arg and return - fromChildren + fromChildren ++ fromTpe } def handleDestructure(tpe: UType, pattern: Pattern[UType], value : TypedValue, inValue : TypedValue, context: Context): TypeCheckerResult = { @@ -200,7 +215,7 @@ class TypeChecker(dists: Distributions) { fields: Map[Name, TypedValue], context: Context ): TypeCheckerResult = { - val fromChildren = check(valueToUpdate, context) ++ fields.flatMap{case (_, value) => check(value), context} + val fromChildren = check(valueToUpdate, context) ++ fields.flatMap{case (_, value) => check(value, context)} //TODO: Check the value dealiases to a record which has that name fromChildren } From 86b42bf1e0482740e9d81b1481e14231bf21d946 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Mon, 14 Aug 2023 18:23:09 -0700 Subject: [PATCH 055/323] Incremental --- .../finos/morphir/runtime/TypeChecker.scala | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index ee3112603..47759f16e 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -54,6 +54,24 @@ class TypeChecker(dists: Distributions) { def dealias(tpe: UType, context: Context): Either[GoodTypeError, UType] = { def loop(tpe: UType, original_fqn: Option[FQName], context: Context): Either[GoodTypeError, UType] = + tpe match { + case ref@SDKRef() => Right(ref) // TODO: Bindings + case Type.Reference(_, typeName, typeArgs) => + val lookedUp = dists.lookupTypeSpecification(typeName.packagePath, typeName.modulePath, typeName.localName) + lookedUp match { + case Some(T.Specification.TypeAliasSpecification(typeParams, expr)) => + val newBindings = typeParams.zip(typeArgs).toMap + loop(expr, original_fqn.orElse(Some(typeName)), context.withBindings(newBindings)) + case Some(_) => Right(tpe) // TODO: Bindings + case None => + original_fqn match { + case Some(original) => + Left(new TypeMissing(typeName, dists, s"Unable to find while dealiasing $original")) + case None => + Left(new TypeMissing(typeName, dists, s"Unable to dealias")) + } + } + case other => Right(other) // TODO: Bindings } loop(tpe, None, context) From d34ff163ba8ae056dd159783aee164ab4a3c2b35 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 05:07:07 -0700 Subject: [PATCH 056/323] Incremental --- .../runtime/src/org/finos/morphir/runtime/TypeChecker.scala | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 47759f16e..d4b5ff68a 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -52,10 +52,10 @@ class TypeChecker(dists: Distributions) { private def nameMissingConstructor(fqn: FQName, tpe: UType, dists: Distributions): MorphirTypeError = {???} private def pretty(tpe: UType, depthBudget: Int): String = {???} - def dealias(tpe: UType, context: Context): Either[GoodTypeError, UType] = { - def loop(tpe: UType, original_fqn: Option[FQName], context: Context): Either[GoodTypeError, UType] = + def dealias(tpe: UType, context: Context): Either[MorphirTypeError, UType] = { + def loop(tpe: UType, original_fqn: Option[FQName], context: Context): Either[MorphirTypeError, UType] = tpe match { - case ref@SDKRef() => Right(ref) // TODO: Bindings + case ref@NativeRef() => Right(ref) // TODO: Bindings case Type.Reference(_, typeName, typeArgs) => val lookedUp = dists.lookupTypeSpecification(typeName.packagePath, typeName.modulePath, typeName.localName) lookedUp match { From c9f15d14ddd1689447cb216c141838f9f6ab22c4 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 05:24:08 -0700 Subject: [PATCH 057/323] Incremental --- .../finos/morphir/runtime/TypeChecker.scala | 2 +- .../src/org/finos/morphir/runtime/Utils.scala | 38 +++++++++---------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index d4b5ff68a..55ec9073d 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -55,7 +55,7 @@ class TypeChecker(dists: Distributions) { def dealias(tpe: UType, context: Context): Either[MorphirTypeError, UType] = { def loop(tpe: UType, original_fqn: Option[FQName], context: Context): Either[MorphirTypeError, UType] = tpe match { - case ref@NativeRef() => Right(ref) // TODO: Bindings + case ref@Extractors.Types.NativeRef() => Right(ref) // TODO: Bindings case Type.Reference(_, typeName, typeArgs) => val lookedUp = dists.lookupTypeSpecification(typeName.packagePath, typeName.modulePath, typeName.localName) lookedUp match { diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala index a8360cd48..7492b4c48 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala @@ -23,25 +23,25 @@ import org.finos.morphir.ir.Type.{USpecification => UTypeSpec} object Utils { import Extractors.Types.* - def dealias(original_tpe: UType, dists: Distributions, bindings: Map[Name, UType]): UType = { - def loop(tpe: UType, bindings: Map[Name, UType]): UType = - tpe match { - case NativeRef() => applyBindings(tpe, bindings) // nothing further to look up - case Type.Reference(_, typeName, typeArgs) => - val lookedUp = dists.lookupTypeSpecification(typeName.packagePath, typeName.modulePath, typeName.localName) - lookedUp match { - case Some(T.Specification.TypeAliasSpecification(typeParams, expr)) => - val resolvedArgs = typeArgs.map(dealias(_, dists, bindings)) // I think? - val newBindings = typeParams.zip(resolvedArgs).toMap - loop(expr, bindings ++ newBindings) - case Some(_) => applyBindings(tpe, bindings) // Can't dealias further - case None => - throw new TypeNotFound(s"Unable to find $tpe while dealiasing $original_tpe") // TODO: Thread properly - } - case other => applyBindings(other, bindings) // Not an alias - } - loop(original_tpe, bindings) - } +// def dealias(original_tpe: UType, dists: Distributions, bindings: Map[Name, UType]): UType = { +// def loop(tpe: UType, bindings: Map[Name, UType]): UType = +// tpe match { +// case NativeRef() => applyBindings(tpe, bindings) // nothing further to look up +// case Type.Reference(_, typeName, typeArgs) => +// val lookedUp = dists.lookupTypeSpecification(typeName.packagePath, typeName.modulePath, typeName.localName) +// lookedUp match { +// case Some(T.Specification.TypeAliasSpecification(typeParams, expr)) => +// val resolvedArgs = typeArgs.map(dealias(_, dists, bindings)) // I think? +// val newBindings = typeParams.zip(resolvedArgs).toMap +// loop(expr, bindings ++ newBindings) +// case Some(_) => applyBindings(tpe, bindings) // Can't dealias further +// case None => +// throw new TypeNotFound(s"Unable to find $tpe while dealiasing $original_tpe") // TODO: Thread properly +// } +// case other => applyBindings(other, bindings) // Not an alias +// } +// loop(original_tpe, bindings) +// } def applyBindings(tpe: UType, bindings: Map[Name, UType]): UType = tpe match { case Type.Variable(_, name) if bindings.contains(name) => bindings(name) From a7194f4387456c90268c19bc060e883f2a6e02bb Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 05:32:09 -0700 Subject: [PATCH 058/323] Incremental --- .../src/org/finos/morphir/runtime/Distributions.scala | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Distributions.scala b/morphir/runtime/src/org/finos/morphir/runtime/Distributions.scala index 00008035e..37c27b917 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Distributions.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Distributions.scala @@ -14,6 +14,11 @@ import org.finos.morphir.ir.distribution.Distribution import org.finos.morphir.ir.distribution.Distribution.Library import zio.Chunk +sealed abstract class LookupError extends Exception +case class MissingPackage(pkgName : PackageName) extends LookupError +case class MissingModule(pkgName: PackageName, modName : ModuleName) +case class MissingType(pkgName : PackageName, modName: ModuleName, typeName : Name) + class Distributions(dists: Map[PackageName, Distribution]) { def lookupModuleSpecification(packageName: PackageName, module: ModuleName): Option[ModSpec.Raw] = dists.get(packageName) match { From 5323569dd5ff2f6a05c42104840dc215b76c6b8a Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 05:35:30 -0700 Subject: [PATCH 059/323] Incremental --- .../src/org/finos/morphir/runtime/Distributions.scala | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Distributions.scala b/morphir/runtime/src/org/finos/morphir/runtime/Distributions.scala index 37c27b917..37c9fa01c 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Distributions.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Distributions.scala @@ -14,10 +14,12 @@ import org.finos.morphir.ir.distribution.Distribution import org.finos.morphir.ir.distribution.Distribution.Library import zio.Chunk -sealed abstract class LookupError extends Exception -case class MissingPackage(pkgName : PackageName) extends LookupError -case class MissingModule(pkgName: PackageName, modName : ModuleName) +sealed abstract class LookupError(msg : String) extends Exception(msg) +case class MissingPackage(pkgName : PackageName) extends LookupError(s"Package ${pkgName.toString} not found") +case class MissingModule(pkgName: PackageName, modName : ModuleName) extends LookupError(s"Package ${pkgName.toString} does not contain module ${modName.toString}") case class MissingType(pkgName : PackageName, modName: ModuleName, typeName : Name) +case class MissingDefinition(pkgName: PackageName, modName: ModuleName, defName : Name) +case class MissingConstructor(pkgName: PackageName, modName: ModuleName, ctorName : Name) class Distributions(dists: Map[PackageName, Distribution]) { def lookupModuleSpecification(packageName: PackageName, module: ModuleName): Option[ModSpec.Raw] = From 1df79e1dca3f558a7429ddef764438ad75eeb2d4 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 05:37:06 -0700 Subject: [PATCH 060/323] Incremental --- .../src/org/finos/morphir/runtime/Distributions.scala | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Distributions.scala b/morphir/runtime/src/org/finos/morphir/runtime/Distributions.scala index 37c9fa01c..373f4b5b4 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Distributions.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Distributions.scala @@ -17,9 +17,9 @@ import zio.Chunk sealed abstract class LookupError(msg : String) extends Exception(msg) case class MissingPackage(pkgName : PackageName) extends LookupError(s"Package ${pkgName.toString} not found") case class MissingModule(pkgName: PackageName, modName : ModuleName) extends LookupError(s"Package ${pkgName.toString} does not contain module ${modName.toString}") -case class MissingType(pkgName : PackageName, modName: ModuleName, typeName : Name) -case class MissingDefinition(pkgName: PackageName, modName: ModuleName, defName : Name) -case class MissingConstructor(pkgName: PackageName, modName: ModuleName, ctorName : Name) +case class MissingType(pkgName : PackageName, modName: ModuleName, typeName : Name) extends LookupError(s"Module ${pkgName.toString}:${modName.toString} has no type named ${typeName.toTitleCase}") +case class MissingDefinition(pkgName: PackageName, modName: ModuleName, defName : Name) extends LookupError(s"Module ${pkgName.toString}:${modName.toString} has no definition named ${defName.toCamelCase}") +case class MissingConstructor(pkgName: PackageName, modName: ModuleName, ctorName : Name) extends LookupError(s"Module ${pkgName.toString}:${modName.toString} has no constructor named ${ctorName.toTitleCase}") class Distributions(dists: Map[PackageName, Distribution]) { def lookupModuleSpecification(packageName: PackageName, module: ModuleName): Option[ModSpec.Raw] = From e0f77b1daacf6cd185734e9faf8e50fbb01ab124 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 05:40:58 -0700 Subject: [PATCH 061/323] Incremental --- .../src/org/finos/morphir/runtime/Distributions.scala | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Distributions.scala b/morphir/runtime/src/org/finos/morphir/runtime/Distributions.scala index 373f4b5b4..ce9cdaf3f 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Distributions.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Distributions.scala @@ -22,11 +22,14 @@ case class MissingDefinition(pkgName: PackageName, modName: ModuleName, defName case class MissingConstructor(pkgName: PackageName, modName: ModuleName, ctorName : Name) extends LookupError(s"Module ${pkgName.toString}:${modName.toString} has no constructor named ${ctorName.toTitleCase}") class Distributions(dists: Map[PackageName, Distribution]) { - def lookupModuleSpecification(packageName: PackageName, module: ModuleName): Option[ModSpec.Raw] = + def lookupModuleSpecification(packageName: PackageName, module: ModuleName): Either[LookupError, ModSpec.Raw] = dists.get(packageName) match { case Some(Library(_, _, packageDef)) => - packageDef.toSpecification.modules.get(module) - case None => None + packageDef.toSpecification.modules.get(module) match{ + case Some(module) => Right(module) + case None => Left(new MissingModule(pkgName, modName)) + } + case None => Left(new MissingPackage(packageName)) } def lookupModuleDefinition(packageName: PackageName, module: ModuleName): Option[ModDef[Unit, UType]] = From 0d6464c465db9d377814af7ab2a0691085c0a16f Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 05:43:35 -0700 Subject: [PATCH 062/323] Incremental --- .../finos/morphir/runtime/Distributions.scala | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Distributions.scala b/morphir/runtime/src/org/finos/morphir/runtime/Distributions.scala index ce9cdaf3f..84df60b23 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Distributions.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Distributions.scala @@ -14,6 +14,7 @@ import org.finos.morphir.ir.distribution.Distribution import org.finos.morphir.ir.distribution.Distribution.Library import zio.Chunk +//TODO: Error hierarchy and code should reflect possibility of specification lookup sealed abstract class LookupError(msg : String) extends Exception(msg) case class MissingPackage(pkgName : PackageName) extends LookupError(s"Package ${pkgName.toString} not found") case class MissingModule(pkgName: PackageName, modName : ModuleName) extends LookupError(s"Package ${pkgName.toString} does not contain module ${modName.toString}") @@ -32,37 +33,40 @@ class Distributions(dists: Map[PackageName, Distribution]) { case None => Left(new MissingPackage(packageName)) } - def lookupModuleDefinition(packageName: PackageName, module: ModuleName): Option[ModDef[Unit, UType]] = + def lookupModuleDefinition(packageName: PackageName, module: ModuleName): Either[LookupError, ModDef[Unit, UType]] = dists.get(packageName) match { case Some(Library(_, _, packageDef)) => - packageDef.modules.get(module).map(_.value) - case None => None + packageDef.modules.get(module) match { + case Some(module) => Right(module) + case None => Left(new MissingModule(pkgName, modName)) + } + case None => Left(new MissingPackage(packageName)) } - def lookupTypeSpecification(pName: PackageName, module: ModuleName, localName: Name): Option[UTypeSpec] = + def lookupTypeSpecification(pName: PackageName, module: ModuleName, localName: Name): Either[LookupError, UTypeSpec] = lookupModuleSpecification(pName, module).flatMap(_.lookupTypeSpecification(localName)) - def lookupTypeSpecification(fqn: FQName): Option[UTypeSpec] = + def lookupTypeSpecification(fqn: FQName): Either[LookupError, UTypeSpec] = lookupTypeSpecification(fqn.packagePath, fqn.modulePath, fqn.localName) def lookupValueSpecification( packageName: PackageName, module: ModuleName, localName: Name - ): Option[UValueSpec] = + ): Either[LookupError, UValueSpec] = lookupModuleSpecification(packageName, module).flatMap(_.lookupValueSpecification(localName)) - def lookupValueSpecification(fqn: FQName): Option[UValueSpec] = + def lookupValueSpecification(fqn: FQName): Either[LookupError, UValueSpec] = lookupValueSpecification(fqn.packagePath, fqn.modulePath, fqn.localName) def lookupValueDefinition( packageName: PackageName, module: ModuleName, localName: Name - ): Option[TypedValueDef] = + ): Either[LookupError, TypedValueDef] = lookupModuleDefinition(packageName, module).flatMap(_.lookupValueDefinition(localName)) - def lookupValueDefinition(fqn: FQName): Option[TypedValueDef] = + def lookupValueDefinition(fqn: FQName): Either[LookupError, TypedValueDef] = lookupValueDefinition(fqn.packagePath, fqn.modulePath, fqn.localName) def getDists: Map[PackageName, Distribution] = dists } From ebfb3698f51016e46bc135266f4440992a46c92c Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 05:46:34 -0700 Subject: [PATCH 063/323] Incremental --- .../finos/morphir/runtime/Distributions.scala | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Distributions.scala b/morphir/runtime/src/org/finos/morphir/runtime/Distributions.scala index 84df60b23..c74f04a8b 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Distributions.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Distributions.scala @@ -43,8 +43,11 @@ class Distributions(dists: Map[PackageName, Distribution]) { case None => Left(new MissingPackage(packageName)) } - def lookupTypeSpecification(pName: PackageName, module: ModuleName, localName: Name): Either[LookupError, UTypeSpec] = - lookupModuleSpecification(pName, module).flatMap(_.lookupTypeSpecification(localName)) + def lookupTypeSpecification(pkgName: PackageName, modName: ModuleName, localName: Name): Either[LookupError, UTypeSpec] = + lookupModuleSpecification(pkgName, modName).flatMap(_.lookupTypeSpecification(localName) match{ + case Some(tpe) => Right(tpe) + case None => Left(new MissingType(pkgName, modName = ???, localName)) + }) def lookupTypeSpecification(fqn: FQName): Either[LookupError, UTypeSpec] = lookupTypeSpecification(fqn.packagePath, fqn.modulePath, fqn.localName) @@ -54,7 +57,10 @@ class Distributions(dists: Map[PackageName, Distribution]) { module: ModuleName, localName: Name ): Either[LookupError, UValueSpec] = - lookupModuleSpecification(packageName, module).flatMap(_.lookupValueSpecification(localName)) + lookupModuleSpecification(packageName, module).flatMap(_.lookupValueSpecification(localName) match { + case Some(tpe) => Right(tpe) + case None => Left(new MissingDefinition(pkgName, modName = ???, localName)) + }) def lookupValueSpecification(fqn: FQName): Either[LookupError, UValueSpec] = lookupValueSpecification(fqn.packagePath, fqn.modulePath, fqn.localName) @@ -64,7 +70,10 @@ class Distributions(dists: Map[PackageName, Distribution]) { module: ModuleName, localName: Name ): Either[LookupError, TypedValueDef] = - lookupModuleDefinition(packageName, module).flatMap(_.lookupValueDefinition(localName)) + lookupModuleDefinition(packageName, module).flatMap(_.lookupValueDefinition(localName) match { + case Some(tpe) => Right(tpe) + case None => Left(new MissingDefinition(pkgName, modName = ???, localName)) + }) def lookupValueDefinition(fqn: FQName): Either[LookupError, TypedValueDef] = lookupValueDefinition(fqn.packagePath, fqn.modulePath, fqn.localName) From f3183c1f6efc218930e394ccc9f7c3b7f5f4e88a Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 05:57:38 -0700 Subject: [PATCH 064/323] Incremental --- .../morphir/runtime/MorphirTypeError.scala | 2 +- .../finos/morphir/runtime/TypeChecker.scala | 19 +++++++++---------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala index 30be73003..a5819b978 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala @@ -16,7 +16,7 @@ object MorphirTypeError { case class TypesMismatch(tpe1: UType, tpe2: UType) extends MorphirTypeError("Todo") case class ArgumentDoesNotMatchParameter(arg: TypedValue, param: TypedValue) extends MorphirTypeError("Todo") case class ImproperType(tpe: UType, message: String) extends MorphirTypeError("Todo") - case class TypeMissing(tpe: UType) extends MorphirTypeError("Todo") + case class CannotDealias(err : LookupError, msg : String = "Cannot dealias type") extends MorphirTypeError(s"$msg: ${err.msg}") case class ValueMissing(value: TypedValue) extends MorphirTypeError("Todo") case class ConstructorMissing(fqn: FQName, tpe: UType) extends MorphirTypeError("Todo") case class ModuleMissing(modName: ModuleName) extends MorphirTypeError("Todo") diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 55ec9073d..796f6e90f 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -1,16 +1,16 @@ package org.finos.morphir.runtime -import org.finos.morphir.naming._ -import org.finos.morphir.naming._ +import org.finos.morphir.naming.* +import org.finos.morphir.naming.* import org.finos.morphir.ir.{Type as T, Value as V} import org.finos.morphir.ir.Literal.Lit -import org.finos.morphir.ir.Value.{Value, Pattern, TypedValue, USpecification => UValueSpec, TypedDefinition => TypedValueDef} -import org.finos.morphir.ir.Type.{Type, UType, USpecification => UTypeSpec} +import org.finos.morphir.ir.Value.{Pattern, TypedValue, Value, TypedDefinition as TypedValueDef, USpecification as UValueSpec} +import org.finos.morphir.ir.Type.{Type, UType, USpecification as UTypeSpec} import org.finos.morphir.ir.sdk import org.finos.morphir.ir.sdk.Basics import org.finos.morphir.ir.Field +import org.finos.morphir.runtime.MorphirTypeError.CannotDealias import org.finos.morphir.runtime.exports.* -import zio.Chunk object TypeChecker { type TypeCheckerResult = List[MorphirTypeError] @@ -62,18 +62,17 @@ class TypeChecker(dists: Distributions) { case Some(T.Specification.TypeAliasSpecification(typeParams, expr)) => val newBindings = typeParams.zip(typeArgs).toMap loop(expr, original_fqn.orElse(Some(typeName)), context.withBindings(newBindings)) - case Some(_) => Right(tpe) // TODO: Bindings - case None => + case Right(_) => Right(tpe) // TODO: Bindings + case Left(lookupErr) => original_fqn match { case Some(original) => - Left(new TypeMissing(typeName, dists, s"Unable to find while dealiasing $original")) + Left(new CannotDealias(lookupErr, s"Unable to dealias (nested beneath $original")) case None => - Left(new TypeMissing(typeName, dists, s"Unable to dealias")) + Left(new CannotDealias(lookupErr)) } } case other => Right(other) // TODO: Bindings } - loop(tpe, None, context) } private def pretty(tpe: UType): String = pretty(tpe, 2) From dec6feebb017b39485299d82d1b463f02f213478 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 06:01:07 -0700 Subject: [PATCH 065/323] Incremental --- .../finos/morphir/runtime/Distributions.scala | 36 +++++++++---------- .../finos/morphir/runtime/TypeChecker.scala | 1 + 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Distributions.scala b/morphir/runtime/src/org/finos/morphir/runtime/Distributions.scala index c74f04a8b..f9060c0c6 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Distributions.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Distributions.scala @@ -23,56 +23,56 @@ case class MissingDefinition(pkgName: PackageName, modName: ModuleName, defName case class MissingConstructor(pkgName: PackageName, modName: ModuleName, ctorName : Name) extends LookupError(s"Module ${pkgName.toString}:${modName.toString} has no constructor named ${ctorName.toTitleCase}") class Distributions(dists: Map[PackageName, Distribution]) { - def lookupModuleSpecification(packageName: PackageName, module: ModuleName): Either[LookupError, ModSpec.Raw] = - dists.get(packageName) match { + def lookupModuleSpecification(pkgName: PackageName, modName: ModuleName): Either[LookupError, ModSpec.Raw] = + dists.get(pkgName) match { case Some(Library(_, _, packageDef)) => - packageDef.toSpecification.modules.get(module) match{ + packageDef.toSpecification.modules.get(modName) match{ case Some(module) => Right(module) case None => Left(new MissingModule(pkgName, modName)) } - case None => Left(new MissingPackage(packageName)) + case None => Left(new MissingPackage(pkgName)) } - def lookupModuleDefinition(packageName: PackageName, module: ModuleName): Either[LookupError, ModDef[Unit, UType]] = - dists.get(packageName) match { + def lookupModuleDefinition(pkgName: PackageName, modName: ModuleName): Either[LookupError, ModDef[Unit, UType]] = + dists.get(pkgName) match { case Some(Library(_, _, packageDef)) => - packageDef.modules.get(module) match { + packageDef.modules.get(modName) match { case Some(module) => Right(module) case None => Left(new MissingModule(pkgName, modName)) } - case None => Left(new MissingPackage(packageName)) + case None => Left(new MissingPackage(pkgName)) } def lookupTypeSpecification(pkgName: PackageName, modName: ModuleName, localName: Name): Either[LookupError, UTypeSpec] = lookupModuleSpecification(pkgName, modName).flatMap(_.lookupTypeSpecification(localName) match{ case Some(tpe) => Right(tpe) - case None => Left(new MissingType(pkgName, modName = ???, localName)) + case None => Left(new MissingType(pkgName, modName, localName)) }) def lookupTypeSpecification(fqn: FQName): Either[LookupError, UTypeSpec] = lookupTypeSpecification(fqn.packagePath, fqn.modulePath, fqn.localName) def lookupValueSpecification( - packageName: PackageName, - module: ModuleName, + pkgName: PackageName, + modName: ModuleName, localName: Name ): Either[LookupError, UValueSpec] = - lookupModuleSpecification(packageName, module).flatMap(_.lookupValueSpecification(localName) match { + lookupModuleSpecification(pkgName, modName).flatMap(_.lookupValueSpecification(localName) match { case Some(tpe) => Right(tpe) - case None => Left(new MissingDefinition(pkgName, modName = ???, localName)) + case None => Left(new MissingDefinition(pkgName, modName, localName)) }) def lookupValueSpecification(fqn: FQName): Either[LookupError, UValueSpec] = lookupValueSpecification(fqn.packagePath, fqn.modulePath, fqn.localName) def lookupValueDefinition( - packageName: PackageName, - module: ModuleName, + pkgName: PackageName, + modName: ModuleName, localName: Name ): Either[LookupError, TypedValueDef] = - lookupModuleDefinition(packageName, module).flatMap(_.lookupValueDefinition(localName) match { + lookupModuleDefinition(pkgName, modName).flatMap(_.lookupValueDefinition(localName) match { case Some(tpe) => Right(tpe) - case None => Left(new MissingDefinition(pkgName, modName = ???, localName)) + case None => Left(new MissingDefinition(pkgName, modName, localName)) }) def lookupValueDefinition(fqn: FQName): Either[LookupError, TypedValueDef] = @@ -82,5 +82,5 @@ class Distributions(dists: Map[PackageName, Distribution]) { object Distributions { def apply(dists: Distribution*): Distributions = - new Distributions(dists.map { case (lib: Library) => lib.packageName -> lib }.toMap) + new Distributions(dists.map { case (lib: Library) => lib.pkgName -> lib }.toMap) } diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 796f6e90f..f7587fb0c 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -11,6 +11,7 @@ import org.finos.morphir.ir.sdk.Basics import org.finos.morphir.ir.Field import org.finos.morphir.runtime.MorphirTypeError.CannotDealias import org.finos.morphir.runtime.exports.* +import MorphirTypeError.* object TypeChecker { type TypeCheckerResult = List[MorphirTypeError] From f416871289b7ca5a3105b460674d62be4c7c447e Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 06:11:53 -0700 Subject: [PATCH 066/323] Incremental --- .../src/org/finos/morphir/runtime/Distributions.scala | 8 +++++--- .../src/org/finos/morphir/runtime/MorphirTypeError.scala | 6 ++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Distributions.scala b/morphir/runtime/src/org/finos/morphir/runtime/Distributions.scala index f9060c0c6..894db9c12 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Distributions.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Distributions.scala @@ -15,7 +15,9 @@ import org.finos.morphir.ir.distribution.Distribution.Library import zio.Chunk //TODO: Error hierarchy and code should reflect possibility of specification lookup -sealed abstract class LookupError(msg : String) extends Exception(msg) +sealed abstract class LookupError(msg : String) extends Exception(msg) { + def getMsg: String = msg +} case class MissingPackage(pkgName : PackageName) extends LookupError(s"Package ${pkgName.toString} not found") case class MissingModule(pkgName: PackageName, modName : ModuleName) extends LookupError(s"Package ${pkgName.toString} does not contain module ${modName.toString}") case class MissingType(pkgName : PackageName, modName: ModuleName, typeName : Name) extends LookupError(s"Module ${pkgName.toString}:${modName.toString} has no type named ${typeName.toTitleCase}") @@ -37,7 +39,7 @@ class Distributions(dists: Map[PackageName, Distribution]) { dists.get(pkgName) match { case Some(Library(_, _, packageDef)) => packageDef.modules.get(modName) match { - case Some(module) => Right(module) + case Some(module) => Right(module.value) case None => Left(new MissingModule(pkgName, modName)) } case None => Left(new MissingPackage(pkgName)) @@ -82,5 +84,5 @@ class Distributions(dists: Map[PackageName, Distribution]) { object Distributions { def apply(dists: Distribution*): Distributions = - new Distributions(dists.map { case (lib: Library) => lib.pkgName -> lib }.toMap) + new Distributions(dists.map { case (lib: Library) => lib.packageName -> lib }.toMap) } diff --git a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala index a5819b978..83bc08683 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala @@ -11,12 +11,14 @@ import org.finos.morphir.ir.Field import org.finos.morphir.runtime.exports.* import zio.Chunk -abstract class MorphirTypeError(msg: String) extends Exception(msg) +abstract class MorphirTypeError(msg: String) extends Exception(msg){ + def getMsg : String = msg +} object MorphirTypeError { case class TypesMismatch(tpe1: UType, tpe2: UType) extends MorphirTypeError("Todo") case class ArgumentDoesNotMatchParameter(arg: TypedValue, param: TypedValue) extends MorphirTypeError("Todo") case class ImproperType(tpe: UType, message: String) extends MorphirTypeError("Todo") - case class CannotDealias(err : LookupError, msg : String = "Cannot dealias type") extends MorphirTypeError(s"$msg: ${err.msg}") + case class CannotDealias(err : LookupError, msg : String = "Cannot dealias type") extends MorphirTypeError(s"$msg: ${err.getMsg}") case class ValueMissing(value: TypedValue) extends MorphirTypeError("Todo") case class ConstructorMissing(fqn: FQName, tpe: UType) extends MorphirTypeError("Todo") case class ModuleMissing(modName: ModuleName) extends MorphirTypeError("Todo") From c82cbcb462353e700687dd98d170f214f182ee8e Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 06:16:40 -0700 Subject: [PATCH 067/323] Incremental --- .../src/org/finos/morphir/runtime/MorphirTypeError.scala | 2 +- morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala index 83bc08683..5a5bc85af 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala @@ -16,7 +16,7 @@ abstract class MorphirTypeError(msg: String) extends Exception(msg){ } object MorphirTypeError { case class TypesMismatch(tpe1: UType, tpe2: UType) extends MorphirTypeError("Todo") - case class ArgumentDoesNotMatchParameter(arg: TypedValue, param: TypedValue) extends MorphirTypeError("Todo") + case class ArgumentDoesNotMatchParameter(arg: TypedValue, param: UType, msg : String) extends MorphirTypeError(msg) case class ImproperType(tpe: UType, message: String) extends MorphirTypeError("Todo") case class CannotDealias(err : LookupError, msg : String = "Cannot dealias type") extends MorphirTypeError(s"$msg: ${err.getMsg}") case class ValueMissing(value: TypedValue) extends MorphirTypeError("Todo") diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index f7587fb0c..8a07f2b5c 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -60,7 +60,7 @@ class TypeChecker(dists: Distributions) { case Type.Reference(_, typeName, typeArgs) => val lookedUp = dists.lookupTypeSpecification(typeName.packagePath, typeName.modulePath, typeName.localName) lookedUp match { - case Some(T.Specification.TypeAliasSpecification(typeParams, expr)) => + case Right(T.Specification.TypeAliasSpecification(typeParams, expr)) => val newBindings = typeParams.zip(typeArgs).toMap loop(expr, original_fqn.orElse(Some(typeName)), context.withBindings(newBindings)) case Right(_) => Right(tpe) // TODO: Bindings From 3fb8d605c189cb54d1305390f761173b7afb9416 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 06:17:33 -0700 Subject: [PATCH 068/323] Incremental --- morphir/runtime/src/org/finos/morphir/runtime/Utils.scala | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala index 7492b4c48..4812c2f9b 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala @@ -20,6 +20,10 @@ import org.finos.morphir.ir.sdk import org.finos.morphir.ir.Value.{USpecification => UValueSpec, Definition => ValueDefinition} import org.finos.morphir.ir.Type.{USpecification => UTypeSpec} +object Succinct{ + +} + object Utils { import Extractors.Types.* From 72b3fb7b08af9055a760bd67003eff4aa2f9dbf9 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 06:17:59 -0700 Subject: [PATCH 069/323] Incremental --- .../runtime/src/org/finos/morphir/runtime/Utils.scala | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala index 4812c2f9b..142e445f6 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala @@ -21,7 +21,15 @@ import org.finos.morphir.ir.Value.{USpecification => UValueSpec, Definition => V import org.finos.morphir.ir.Type.{USpecification => UTypeSpec} object Succinct{ - + object Value{ + + } + object Type{ + + } + object Value{ + + } } object Utils { From d3835e1f1a7d8d98bb3cba71a0482aec1803edbd Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 06:18:44 -0700 Subject: [PATCH 070/323] Incremental --- morphir/runtime/src/org/finos/morphir/runtime/Utils.scala | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala index 142e445f6..9311a3c31 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala @@ -22,13 +22,14 @@ import org.finos.morphir.ir.Type.{USpecification => UTypeSpec} object Succinct{ object Value{ - + def apply[TA, VA](value : Value[TA, VA], depth : Int) + def apply[TA, VA](value: Value[TA, VA]) } object Type{ } object Value{ - + } } From b59cb8b3b8e1588a95a2c765c77fbacbcaea9648 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 06:19:29 -0700 Subject: [PATCH 071/323] Incremental --- morphir/runtime/src/org/finos/morphir/runtime/Utils.scala | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala index 9311a3c31..dc86f7c16 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala @@ -26,9 +26,15 @@ object Succinct{ def apply[TA, VA](value: Value[TA, VA]) } object Type{ + def apply[TA](tpe: Type[TA], depth: Int) + + def apply[TA](tpe : Type[TA]) } object Value{ + def apply[TA, VA](value: Value[TA, VA], depth: Int) + + def apply[TA, VA](value: Value[TA, VA]) } } From d9071fd1e5eac049758a42d522d724737ee4c715 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 06:21:03 -0700 Subject: [PATCH 072/323] Incremental --- .../runtime/src/org/finos/morphir/runtime/Utils.scala | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala index dc86f7c16..cf8c10cf2 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala @@ -23,18 +23,18 @@ import org.finos.morphir.ir.Type.{USpecification => UTypeSpec} object Succinct{ object Value{ def apply[TA, VA](value : Value[TA, VA], depth : Int) - def apply[TA, VA](value: Value[TA, VA]) + def apply[TA, VA](value: Value[TA, VA]) = apply(value, 2) } object Type{ def apply[TA](tpe: Type[TA], depth: Int) - def apply[TA](tpe : Type[TA]) + def apply[TA](tpe : Type[TA]) = apply(tpe, 2) } - object Value{ - def apply[TA, VA](value: Value[TA, VA], depth: Int) + object Pattern{ + def apply[VA](pattern: Pattern[VA], depth: Int) - def apply[TA, VA](value: Value[TA, VA]) + def apply[VA](pattern: Pattern[VA]) = apply(pattern, 2) } } From 12018e33cc85ac7f80c42c9c3cd78886cb4f63cf Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 06:21:28 -0700 Subject: [PATCH 073/323] Incremental --- .../src/org/finos/morphir/runtime/Utils.scala | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala index cf8c10cf2..0261204d0 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala @@ -22,19 +22,19 @@ import org.finos.morphir.ir.Type.{USpecification => UTypeSpec} object Succinct{ object Value{ - def apply[TA, VA](value : Value[TA, VA], depth : Int) - def apply[TA, VA](value: Value[TA, VA]) = apply(value, 2) + def apply[TA, VA](value : Value[TA, VA], depth : Int) : String + def apply[TA, VA](value: Value[TA, VA]): String = apply(value, 2) } object Type{ - def apply[TA](tpe: Type[TA], depth: Int) + def apply[TA](tpe: Type[TA], depth: Int): String - def apply[TA](tpe : Type[TA]) = apply(tpe, 2) + def apply[TA](tpe : Type[TA]) : String= apply(tpe, 2) } object Pattern{ - def apply[VA](pattern: Pattern[VA], depth: Int) + def apply[VA](pattern: Pattern[VA], depth: Int): String - def apply[VA](pattern: Pattern[VA]) = apply(pattern, 2) + def apply[VA](pattern: Pattern[VA]): String = apply(pattern, 2) } } From 9be010e93e187bc849df7138ae63957a2140e6de Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 06:21:55 -0700 Subject: [PATCH 074/323] Incremental --- .../src/org/finos/morphir/runtime/Utils.scala | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala index 0261204d0..0de2452e5 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala @@ -22,17 +22,23 @@ import org.finos.morphir.ir.Type.{USpecification => UTypeSpec} object Succinct{ object Value{ - def apply[TA, VA](value : Value[TA, VA], depth : Int) : String + def apply[TA, VA](value : Value[TA, VA], depth : Int) : String ={ + + } def apply[TA, VA](value: Value[TA, VA]): String = apply(value, 2) } object Type{ - def apply[TA](tpe: Type[TA], depth: Int): String + def apply[TA](tpe: Type[TA], depth: Int): String ={ + + } def apply[TA](tpe : Type[TA]) : String= apply(tpe, 2) } object Pattern{ - def apply[VA](pattern: Pattern[VA], depth: Int): String + def apply[VA](pattern: Pattern[VA], depth: Int): String ={ + + } def apply[VA](pattern: Pattern[VA]): String = apply(pattern, 2) From cc24dfb2cbcece3014a4e84479401a10de16739c Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 06:22:41 -0700 Subject: [PATCH 075/323] Incremental --- .../runtime/src/org/finos/morphir/runtime/Utils.scala | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala index 0de2452e5..6db40579b 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala @@ -23,13 +23,17 @@ import org.finos.morphir.ir.Type.{USpecification => UTypeSpec} object Succinct{ object Value{ def apply[TA, VA](value : Value[TA, VA], depth : Int) : String ={ + value match { + } } def apply[TA, VA](value: Value[TA, VA]): String = apply(value, 2) } object Type{ def apply[TA](tpe: Type[TA], depth: Int): String ={ + tpe match{ + } } def apply[TA](tpe : Type[TA]) : String= apply(tpe, 2) @@ -37,9 +41,10 @@ object Succinct{ } object Pattern{ def apply[VA](pattern: Pattern[VA], depth: Int): String ={ - + pattern match { + + } } - def apply[VA](pattern: Pattern[VA]): String = apply(pattern, 2) } From 5411a869a93f4a9aea364e32a875746596b47206 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 06:25:26 -0700 Subject: [PATCH 076/323] Incremental --- morphir/runtime/src/org/finos/morphir/runtime/Utils.scala | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala index 6db40579b..6e6e2d949 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala @@ -22,9 +22,11 @@ import org.finos.morphir.ir.Type.{USpecification => UTypeSpec} object Succinct{ object Value{ + import Value.* def apply[TA, VA](value : Value[TA, VA], depth : Int) : String ={ value match { - + case Literal(lit) => s"Literal($lit)" + case other => other.getClass } } def apply[TA, VA](value: Value[TA, VA]): String = apply(value, 2) @@ -42,7 +44,7 @@ object Succinct{ object Pattern{ def apply[VA](pattern: Pattern[VA], depth: Int): String ={ pattern match { - + } } def apply[VA](pattern: Pattern[VA]): String = apply(pattern, 2) From 3ca29b6d7e1abb65f0babd5dd4c65287f5bbbd27 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 06:25:51 -0700 Subject: [PATCH 077/323] Incremental --- morphir/runtime/src/org/finos/morphir/runtime/Utils.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala index 6e6e2d949..f1eeec96d 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala @@ -34,7 +34,7 @@ object Succinct{ object Type{ def apply[TA](tpe: Type[TA], depth: Int): String ={ tpe match{ - + case other => other.getClass } } @@ -44,7 +44,7 @@ object Succinct{ object Pattern{ def apply[VA](pattern: Pattern[VA], depth: Int): String ={ pattern match { - + case other => other.getClass } } def apply[VA](pattern: Pattern[VA]): String = apply(pattern, 2) From d06fa7564652fe76fe24dfc396aa151d3af08361 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 06:32:09 -0700 Subject: [PATCH 078/323] Incremental --- .../src/org/finos/morphir/runtime/MorphirTypeError.scala | 4 ++-- .../runtime/src/org/finos/morphir/runtime/TypeChecker.scala | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala index 5a5bc85af..c9649b447 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala @@ -15,8 +15,8 @@ abstract class MorphirTypeError(msg: String) extends Exception(msg){ def getMsg : String = msg } object MorphirTypeError { - case class TypesMismatch(tpe1: UType, tpe2: UType) extends MorphirTypeError("Todo") - case class ArgumentDoesNotMatchParameter(arg: TypedValue, param: UType, msg : String) extends MorphirTypeError(msg) + case class TypesMismatch(tpe1: UType, tpe2: UType, msg : String) extends MorphirTypeError(s"$msg: ${Succinct.Type(tp1)} vs ${Sucinct.Type(tpe2)}") + case class ArgumentDoesNotMatchParameter(arg: TypedValue, argTpe : UType, param: UType) extends MorphirTypeError(s"argument ${Succinct.Value(arg)} of type ${Succinct.Type(argTpe)} does not match paramter ${Succinct.Type(param)}") case class ImproperType(tpe: UType, message: String) extends MorphirTypeError("Todo") case class CannotDealias(err : LookupError, msg : String = "Cannot dealias type") extends MorphirTypeError(s"$msg: ${err.getMsg}") case class ValueMissing(value: TypedValue) extends MorphirTypeError("Todo") diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 8a07f2b5c..8cbf01f5d 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -117,7 +117,8 @@ class TypeChecker(dists: Distributions) { val fromTpe = dealias(function.attributes, context) match { case Right(Type.Function(_, paramType, returnType)) => - helper(paramType != argument.attributes, new ArgumentDoesNotMatchParameter(argument, paramType)) ++ + //TODO: Better than != + helper(paramType != argument.attributes, new ArgumentDoesNotMatchParameter(argument, argument.attributes, paramType)) ++ helper(returnType != tpe, new TypesMismatch(tpe, returnType, "Function return does not match apply node")) case Right(other) => List(new ApplyToNonFunction(other, argument.attributes)) case Left(err) => List(err) From 50358ea5f6223ea4cceca7fbc59781cd1e7d546e Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 06:35:51 -0700 Subject: [PATCH 079/323] Incremental --- .../src/org/finos/morphir/runtime/MorphirTypeError.scala | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala index c9649b447..2f2fc3d11 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala @@ -15,8 +15,11 @@ abstract class MorphirTypeError(msg: String) extends Exception(msg){ def getMsg : String = msg } object MorphirTypeError { + def succinct(value : Value[TA, VA]) : String= Succinct.Value(value) + def succinct(value: Vale[TA, VA]) : String = Succinct.Value(value) case class TypesMismatch(tpe1: UType, tpe2: UType, msg : String) extends MorphirTypeError(s"$msg: ${Succinct.Type(tp1)} vs ${Sucinct.Type(tpe2)}") - case class ArgumentDoesNotMatchParameter(arg: TypedValue, argTpe : UType, param: UType) extends MorphirTypeError(s"argument ${Succinct.Value(arg)} of type ${Succinct.Type(argTpe)} does not match paramter ${Succinct.Type(param)}") + case class ArgumentDoesNotMatchParameter(arg: TypedValue, param: UType) extends MorphirTypeError(s"Argument ${Succinct.Value(arg)} of type ${Succinct.Type(arg.attributes)} does not match parameter ${Succinct.Type(param)}") + case class ApplyToNonFunction(arg : TypedValue, nonFunction : TypedValue) extneds MorphirTypeErr(s"Tried to apply ${Succinct.}") case class ImproperType(tpe: UType, message: String) extends MorphirTypeError("Todo") case class CannotDealias(err : LookupError, msg : String = "Cannot dealias type") extends MorphirTypeError(s"$msg: ${err.getMsg}") case class ValueMissing(value: TypedValue) extends MorphirTypeError("Todo") From 0e580d95416be016c7f6a0931fccc5bb023117b7 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 06:37:33 -0700 Subject: [PATCH 080/323] Incremental --- .../src/org/finos/morphir/runtime/MorphirTypeError.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala index 2f2fc3d11..238189269 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala @@ -15,8 +15,8 @@ abstract class MorphirTypeError(msg: String) extends Exception(msg){ def getMsg : String = msg } object MorphirTypeError { - def succinct(value : Value[TA, VA]) : String= Succinct.Value(value) - def succinct(value: Vale[TA, VA]) : String = Succinct.Value(value) + def succinct[TA, VA](value : Value[TA, VA]) : String= Succinct.Value(value) + def succinct[TA](tpe : Type[TA]) : String = Succinct.Type(tpe) case class TypesMismatch(tpe1: UType, tpe2: UType, msg : String) extends MorphirTypeError(s"$msg: ${Succinct.Type(tp1)} vs ${Sucinct.Type(tpe2)}") case class ArgumentDoesNotMatchParameter(arg: TypedValue, param: UType) extends MorphirTypeError(s"Argument ${Succinct.Value(arg)} of type ${Succinct.Type(arg.attributes)} does not match parameter ${Succinct.Type(param)}") case class ApplyToNonFunction(arg : TypedValue, nonFunction : TypedValue) extneds MorphirTypeErr(s"Tried to apply ${Succinct.}") From 0e85bd7a0e343b7995e546c11e8e776710f7e3b8 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 06:39:45 -0700 Subject: [PATCH 081/323] Incremental --- .../src/org/finos/morphir/runtime/MorphirTypeError.scala | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala index 238189269..d148b45dc 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala @@ -17,9 +17,9 @@ abstract class MorphirTypeError(msg: String) extends Exception(msg){ object MorphirTypeError { def succinct[TA, VA](value : Value[TA, VA]) : String= Succinct.Value(value) def succinct[TA](tpe : Type[TA]) : String = Succinct.Type(tpe) - case class TypesMismatch(tpe1: UType, tpe2: UType, msg : String) extends MorphirTypeError(s"$msg: ${Succinct.Type(tp1)} vs ${Sucinct.Type(tpe2)}") - case class ArgumentDoesNotMatchParameter(arg: TypedValue, param: UType) extends MorphirTypeError(s"Argument ${Succinct.Value(arg)} of type ${Succinct.Type(arg.attributes)} does not match parameter ${Succinct.Type(param)}") - case class ApplyToNonFunction(arg : TypedValue, nonFunction : TypedValue) extneds MorphirTypeErr(s"Tried to apply ${Succinct.}") + case class TypesMismatch(tpe1: UType, tpe2: UType, msg : String) extends MorphirTypeError(s"$msg: succinct(tp1)} vs ${succinct(tpe2)}") + case class ArgumentDoesNotMatchParameter(arg: TypedValue, param: UType) extends MorphirTypeError(s"Argument ${succinct(arg)} of type ${succinct(arg.attributes)} does not match parameter succinct(param)}") + case class ApplyToNonFunction(arg : TypedValue, nonFunction : TypedValue) extneds MorphirTypeErr(s"Tried to apply ${sucinct(arg)} to ${succinct(nonFunction)} of type ${succinct(nonFunction.attributes)}, which is not a function") case class ImproperType(tpe: UType, message: String) extends MorphirTypeError("Todo") case class CannotDealias(err : LookupError, msg : String = "Cannot dealias type") extends MorphirTypeError(s"$msg: ${err.getMsg}") case class ValueMissing(value: TypedValue) extends MorphirTypeError("Todo") From 574af6637e6d4d8554fd81068e73803692651cb5 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 06:42:43 -0700 Subject: [PATCH 082/323] Incremental --- .../src/org/finos/morphir/runtime/MorphirTypeError.scala | 2 +- .../runtime/src/org/finos/morphir/runtime/TypeChecker.scala | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala index d148b45dc..997c12d32 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala @@ -19,7 +19,7 @@ object MorphirTypeError { def succinct[TA](tpe : Type[TA]) : String = Succinct.Type(tpe) case class TypesMismatch(tpe1: UType, tpe2: UType, msg : String) extends MorphirTypeError(s"$msg: succinct(tp1)} vs ${succinct(tpe2)}") case class ArgumentDoesNotMatchParameter(arg: TypedValue, param: UType) extends MorphirTypeError(s"Argument ${succinct(arg)} of type ${succinct(arg.attributes)} does not match parameter succinct(param)}") - case class ApplyToNonFunction(arg : TypedValue, nonFunction : TypedValue) extneds MorphirTypeErr(s"Tried to apply ${sucinct(arg)} to ${succinct(nonFunction)} of type ${succinct(nonFunction.attributes)}, which is not a function") + case class ApplyToNonFunction(nonFunction : TypedValue,arg : TypedValue) extends MorphirTypeError(s"Tried to apply ${succinct(arg)} to ${succinct(nonFunction)} of type ${succinct(nonFunction.attributes)}, which is not a function") case class ImproperType(tpe: UType, message: String) extends MorphirTypeError("Todo") case class CannotDealias(err : LookupError, msg : String = "Cannot dealias type") extends MorphirTypeError(s"$msg: ${err.getMsg}") case class ValueMissing(value: TypedValue) extends MorphirTypeError("Todo") diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 8cbf01f5d..39ef82caa 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -118,9 +118,9 @@ class TypeChecker(dists: Distributions) { dealias(function.attributes, context) match { case Right(Type.Function(_, paramType, returnType)) => //TODO: Better than != - helper(paramType != argument.attributes, new ArgumentDoesNotMatchParameter(argument, argument.attributes, paramType)) ++ + helper(paramType != argument.attributes, new ArgumentDoesNotMatchParameter(argument, paramType)) ++ helper(returnType != tpe, new TypesMismatch(tpe, returnType, "Function return does not match apply node")) - case Right(other) => List(new ApplyToNonFunction(other, argument.attributes)) + case Right(other) => List(new ApplyToNonFunction(function, argument)) case Left(err) => List(err) } //TODO: Check it's a function with matching arg and return From 7f950512adc37109b51506ed1e7a6822ad114e63 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 06:44:07 -0700 Subject: [PATCH 083/323] Incremental --- morphir/runtime/src/org/finos/morphir/runtime/Utils.scala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala index f1eeec96d..72de6076a 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala @@ -22,7 +22,7 @@ import org.finos.morphir.ir.Type.{USpecification => UTypeSpec} object Succinct{ object Value{ - import Value.* + import V.Value.* def apply[TA, VA](value : Value[TA, VA], depth : Int) : String ={ value match { case Literal(lit) => s"Literal($lit)" @@ -32,6 +32,7 @@ object Succinct{ def apply[TA, VA](value: Value[TA, VA]): String = apply(value, 2) } object Type{ + import T.Type.* def apply[TA](tpe: Type[TA], depth: Int): String ={ tpe match{ case other => other.getClass From 97feb3b527c070127a95967d482eb51909323ee3 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 06:47:30 -0700 Subject: [PATCH 084/323] Incremental --- morphir/runtime/src/org/finos/morphir/runtime/Utils.scala | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala index 72de6076a..8632bf9b8 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala @@ -25,8 +25,8 @@ object Succinct{ import V.Value.* def apply[TA, VA](value : Value[TA, VA], depth : Int) : String ={ value match { - case Literal(lit) => s"Literal($lit)" - case other => other.getClass + case Literal(_, lit) => s"Literal($lit)" + case other => other.getClass.getSimpleName } } def apply[TA, VA](value: Value[TA, VA]): String = apply(value, 2) @@ -35,7 +35,7 @@ object Succinct{ import T.Type.* def apply[TA](tpe: Type[TA], depth: Int): String ={ tpe match{ - case other => other.getClass + case other => other.getClass.getSimpleName } } @@ -45,7 +45,7 @@ object Succinct{ object Pattern{ def apply[VA](pattern: Pattern[VA], depth: Int): String ={ pattern match { - case other => other.getClass + case other => other.getClass.getSimpleName } } def apply[VA](pattern: Pattern[VA]): String = apply(pattern, 2) From 5186062900d365456adaa7a7c1b6f01664b139fb Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 06:49:00 -0700 Subject: [PATCH 085/323] Incremental --- .../runtime/src/org/finos/morphir/runtime/Extractors.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala b/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala index 0f2f88e00..972aff5bd 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala @@ -111,10 +111,10 @@ object Extractors { case Type.Reference(_, typeName, typeArgs) => val lookedUp = dists.lookupTypeSpecification(typeName.packagePath, typeName.modulePath, typeName.localName) lookedUp match { - case Some(T.Specification.TypeAliasSpecification(typeParams, expr)) => + case Right(T.Specification.TypeAliasSpecification(typeParams, expr)) => val newBindings = typeParams.zip(typeArgs).toMap Some(expr, newBindings) - case _ => None + case _ => None //Missing name, but failing extractors cause problems } case _ => None } From 7c09cde2b2c7059eb4c6b6a3fe9c8362e55942e5 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 06:51:32 -0700 Subject: [PATCH 086/323] Incremental --- .../morphir/runtime/quick/QuickMorphirRuntime.scala | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala b/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala index efaf6bdaa..b7ac9f75b 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala @@ -39,12 +39,11 @@ private[runtime] case class QuickMorphirRuntime(dists: Distributions, store: Sto res <- EvaluatorQuick.evalAction(value, store, dists) } yield res - def fetchType(ref: FQName): RTAction[MorphirEnv, MorphirRuntimeError, UType] = { - val (pkg, mod, loc) = (ref.getPackagePath, ref.getModulePath, ref.localName) - val maybeSpec = dists.lookupValueSpecification(PackageName(pkg), ModuleName(mod), loc) + def fetchType(fqn: FQName): RTAction[MorphirEnv, MorphirRuntimeError, UType] = { + val maybeSpec = dists.lookupValueSpecification(fqn) maybeSpec match { - case Some(spec) => RTAction.succeed(specificationToType(spec)) - case None => RTAction.fail(new SpecificationNotFound(s"Could not find $ref during initial type building")) + case Right(spec) => RTAction.succeed(specificationToType(spec)) + case Left(err) => RTAction.fail(new SpecificationNotFound(s"Lookup failure: ${err.getMsg}")) } } From 3df777460af7075ebfc61f28f00191fb0e8569f4 Mon Sep 17 00:00:00 2001 From: EdwardPeters Date: Tue, 15 Aug 2023 06:58:06 -0700 Subject: [PATCH 087/323] New test file and cleanup --- .../Morphir/Examples/App/TypeCheckerTests.elm | 1 + .../evaluator-tests/tests.txt | 19 --------- .../org/finos/morphir/runtime/Succinct.scala | 40 +++++++++++++++++++ .../src/org/finos/morphir/runtime/Utils.scala | 34 ---------------- 4 files changed, 41 insertions(+), 53 deletions(-) create mode 100644 examples/morphir-elm-projects/evaluator-tests/src/Morphir/Examples/App/TypeCheckerTests.elm delete mode 100644 examples/morphir-elm-projects/evaluator-tests/tests.txt create mode 100644 morphir/runtime/src/org/finos/morphir/runtime/Succinct.scala diff --git a/examples/morphir-elm-projects/evaluator-tests/src/Morphir/Examples/App/TypeCheckerTests.elm b/examples/morphir-elm-projects/evaluator-tests/src/Morphir/Examples/App/TypeCheckerTests.elm new file mode 100644 index 000000000..b152a17f2 --- /dev/null +++ b/examples/morphir-elm-projects/evaluator-tests/src/Morphir/Examples/App/TypeCheckerTests.elm @@ -0,0 +1 @@ +module Morphir.Examples.App.TypeCheckerTests exposing (..) \ No newline at end of file diff --git a/examples/morphir-elm-projects/evaluator-tests/tests.txt b/examples/morphir-elm-projects/evaluator-tests/tests.txt deleted file mode 100644 index 87b689b39..000000000 --- a/examples/morphir-elm-projects/evaluator-tests/tests.txt +++ /dev/null @@ -1,19 +0,0 @@ - -// -//TODO: Remainint tests: Elm, Unhappy, Shadowing, Native Types, Function Leak, .map - - //Unwritten Apply Tests - // TODO:(Test)(Unhappy) handle applying a value that is not a function - - - // For organization, 3 suites: Reference to value, reference to function definition, reference to native function - // Value: - // TODO:(Test) Simple value - // TODO:(Test) Value whose body contains other references - // TODO:(Test) Value whose body contains let definitions - // TODO:(Test) Value which returns a function referencing variables from context defined in reference - // Function definition: - // TODO:(Test) Tests of currying from let definition - - - //TODO:(Test)(Unhappy) handle unbound variable diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Succinct.scala b/morphir/runtime/src/org/finos/morphir/runtime/Succinct.scala new file mode 100644 index 000000000..9759f7dfa --- /dev/null +++ b/morphir/runtime/src/org/finos/morphir/runtime/Succinct.scala @@ -0,0 +1,40 @@ +package org.finos.morphir.runtime + +import org.finos.morphir.naming._ +import org.finos.morphir.ir.{Type as T, Value as V} +import org.finos.morphir.ir.Value.{Value, Pattern, TypedValue} +import org.finos.morphir.ir.Type.{Type, UType} +import org.finos.morphir.ir.sdk +import org.finos.morphir.ir.sdk.Basics +import org.finos.morphir.ir.Field +import org.finos.morphir.runtime.exports.* + +object Succinct { + object Value { + import V.Value.* + def apply[TA, VA](value: Value[TA, VA], depth: Int): String = + value match { + case Literal(_, lit) => s"Literal($lit)" + case other => other.getClass.getSimpleName + } + def apply[TA, VA](value: Value[TA, VA]): String = apply(value, 2) + } + object Type { + import T.Type.* + def apply[TA](tpe: Type[TA], depth: Int): String = + tpe match { + case other => other.getClass.getSimpleName + } + + def apply[TA](tpe: Type[TA]): String = apply(tpe, 2) + + } + object Pattern { + def apply[VA](pattern: Pattern[VA], depth: Int): String = + pattern match { + case other => other.getClass.getSimpleName + } + def apply[VA](pattern: Pattern[VA]): String = apply(pattern, 2) + + } +} diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala index 8632bf9b8..c32e5a650 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala @@ -1,7 +1,5 @@ package org.finos.morphir.runtime -import org.finos.morphir.naming.* - import org.finos.morphir.naming._ import org.finos.morphir.ir.{Type as T, Value as V} import org.finos.morphir.ir.Value.{Value, Pattern, TypedValue} @@ -10,7 +8,6 @@ import org.finos.morphir.ir.sdk import org.finos.morphir.ir.sdk.Basics import org.finos.morphir.ir.Field import org.finos.morphir.runtime.exports.* -import zio.Chunk import org.finos.morphir.ir.Module.{Specification => ModSpec} import zio.Chunk import org.finos.morphir.ir.sdk.Basics @@ -20,38 +17,7 @@ import org.finos.morphir.ir.sdk import org.finos.morphir.ir.Value.{USpecification => UValueSpec, Definition => ValueDefinition} import org.finos.morphir.ir.Type.{USpecification => UTypeSpec} -object Succinct{ - object Value{ - import V.Value.* - def apply[TA, VA](value : Value[TA, VA], depth : Int) : String ={ - value match { - case Literal(_, lit) => s"Literal($lit)" - case other => other.getClass.getSimpleName - } - } - def apply[TA, VA](value: Value[TA, VA]): String = apply(value, 2) - } - object Type{ - import T.Type.* - def apply[TA](tpe: Type[TA], depth: Int): String ={ - tpe match{ - case other => other.getClass.getSimpleName - } - } - - def apply[TA](tpe : Type[TA]) : String= apply(tpe, 2) - } - object Pattern{ - def apply[VA](pattern: Pattern[VA], depth: Int): String ={ - pattern match { - case other => other.getClass.getSimpleName - } - } - def apply[VA](pattern: Pattern[VA]): String = apply(pattern, 2) - - } -} object Utils { import Extractors.Types.* From b93b5b84504feb9573fc7e3597d13b845faefc1a Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 07:07:08 -0700 Subject: [PATCH 088/323] Incremental --- morphir/runtime/src/org/finos/morphir/runtime/Succinct.scala | 1 + 1 file changed, 1 insertion(+) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Succinct.scala b/morphir/runtime/src/org/finos/morphir/runtime/Succinct.scala index 9759f7dfa..59c97ee04 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Succinct.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Succinct.scala @@ -23,6 +23,7 @@ object Succinct { import T.Type.* def apply[TA](tpe: Type[TA], depth: Int): String = tpe match { + case Reference(_, fqName, args) => s"$fqName ${args.map(apply(_, depth - 1)).mkString(" ")}" case other => other.getClass.getSimpleName } From 322e53697b973c20a3fa72754a9e9e316a156e04 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 07:08:25 -0700 Subject: [PATCH 089/323] Incremental --- .../src/org/finos/morphir/runtime/Extractors.scala | 1 - .../finos/morphir/runtime/TypeCheckerTests.scala.scala | 9 ++++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala b/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala index 972aff5bd..ea7f769f4 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala @@ -1,6 +1,5 @@ package org.finos.morphir.runtime -import org.finos.morphir.naming._ import org.finos.morphir.naming._ import org.finos.morphir.ir.{Type as T, Value as V} import org.finos.morphir.ir.Value.{Value, Pattern, TypedValue, USpecification => UValueSpec} diff --git a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala index d6a02b76b..a39154cc2 100644 --- a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala +++ b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala @@ -1,9 +1,14 @@ package org.finos.morphir.runtime +import org.finos.morphir.naming._ import org.finos.morphir.datamodel.Util.* import org.finos.morphir.datamodel.* import org.finos.morphir.ir.Type -import org.finos.morphir.naming.* +import org.finos.morphir.ir.{Type as T, Value as V} +import org.finos.morphir.ir.Value.{Value, Pattern, TypedValue, USpecification => UValueSpec} +import org.finos.morphir.ir.Type.{Type, UType, USpecification => UTypeSpec} +import org.finos.morphir.ir.sdk +import org.finos.morphir.ir.sdk.Basics import org.finos.morphir.runtime.environment.MorphirEnv import org.finos.morphir.testing.MorphirBaseSpec import zio.test.* @@ -98,6 +103,8 @@ object TypeCheckerTests extends MorphirBaseSpec { // dogRecordConcept // ) + + def resultStringIntShape = Concept.Result(Concept.String, Concept.Int32) def resultBoolIntShape = Concept.Result(Concept.Boolean, Concept.Int32) From 6aa3ea2ad29b9a83ff6638bd1cbbec2f2f8d7239 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 07:11:27 -0700 Subject: [PATCH 090/323] Incremental --- .../runtime/TypeCheckerTests.scala.scala | 35 ++++--------------- 1 file changed, 6 insertions(+), 29 deletions(-) diff --git a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala index a39154cc2..1131fe52d 100644 --- a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala +++ b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala @@ -3,7 +3,6 @@ package org.finos.morphir.runtime import org.finos.morphir.naming._ import org.finos.morphir.datamodel.Util.* import org.finos.morphir.datamodel.* -import org.finos.morphir.ir.Type import org.finos.morphir.ir.{Type as T, Value as V} import org.finos.morphir.ir.Value.{Value, Pattern, TypedValue, USpecification => UValueSpec} import org.finos.morphir.ir.Type.{Type, UType, USpecification => UTypeSpec} @@ -16,9 +15,9 @@ import zio.test.TestAspect.{ignore, tag} import zio.{Console, ZIO, ZLayer} object TypeCheckerTests extends MorphirBaseSpec { - type MorphirRuntimeTyped = MorphirRuntime[Unit, Type.UType] + type MorphirRuntimeTyped = MorphirRuntime[Unit, UType] - val morphirRuntimeLayer: ZLayer[Any, Throwable, MorphirRuntime[Unit, Type.UType]] = + val morphirRuntimeLayer: ZLayer[Any, Throwable, MorphirRuntime[Unit, UType]] = ZLayer(for { irFilePath <- ZIO.succeed(os.pwd / "examples" / "morphir-elm-projects" / "evaluator-tests" / "morphir-ir.json") _ <- Console.printLine(s"Loading distribution from $irFilePath") @@ -40,6 +39,8 @@ object TypeCheckerTests extends MorphirBaseSpec { case other => throw new Exception(s"Couldn't derive $other") } + + def checkEvaluation( moduleName: String, functionName: String @@ -201,37 +202,13 @@ object TypeCheckerTests extends MorphirBaseSpec { ) def spec = - suite("Evaluator MDM Specs")( - suite("Constructor Tests")( + suite("Type Checker Unhappy Paths")( + suite("Apply Node")( test("Zero Arg") { for { actual <- runTest("constructorTests", "constructorZeroArgTest") expected = zeroArg } yield assertTrue(actual == expected) - }, - test("One Arg") { - for { - actual <- runTest("constructorTests", "constructorOneArgAppliedTest") - expected = oneArg(5) - } yield assertTrue(actual == expected) - }, - test("Two Arg") { - for { - actual <- runTest("constructorTests", "constructorTwoArgAppliedTest") - expected = twoArg(5, "Red") - } yield assertTrue(actual == expected) - }, - test("Two Arg Curried") { - for { - actual <- runTest("constructorTests", "constructorTwoArgCurriedTest") - expected = twoArg(5, "Blue") - } yield assertTrue(actual == expected) - }, - test("Lazy Function") { - for { - actual <- runTest("constructorTests", "lazyFunctionTest") - expected = Data.Tuple(Data.Int(5), Data.Int(5)) - } yield assertTrue(actual == expected) } ), suite("Destructure Tests")( From 12f33eb8877d2dd86c1add249e4bf5aba8ca866a Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 07:15:07 -0700 Subject: [PATCH 091/323] Incremental --- .../org/finos/morphir/runtime/TypeCheckerTests.scala.scala | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala index 1131fe52d..f25b86ab8 100644 --- a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala +++ b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala @@ -84,6 +84,12 @@ object TypeCheckerTests extends MorphirBaseSpec { .toZIOWith(RTExecutionContext.default) } + def runTypeCheck(value : TypedValue) : ZIO[MrphirRuntimeTyped, Throwable, Data] = { + runtime.evaluate(value) + .provideEnvironment(MorphirEnv.live) + .toZIOWith(RTExecutionContext.default) + } + val dogRecordConceptRaw = Concept.Struct( List( (Label("name"), Concept.String), @@ -205,6 +211,7 @@ object TypeCheckerTests extends MorphirBaseSpec { suite("Type Checker Unhappy Paths")( suite("Apply Node")( test("Zero Arg") { + val badApply = V.apply(Basics.intType, V.int(1), V.Int(1)) for { actual <- runTest("constructorTests", "constructorZeroArgTest") expected = zeroArg From bcb3ff821c298d02dff203acb32b9667cad46881 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 07:19:46 -0700 Subject: [PATCH 092/323] Incremental --- .../org/finos/morphir/runtime/TypeCheckerTests.scala.scala | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala index f25b86ab8..75c82e086 100644 --- a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala +++ b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala @@ -84,7 +84,8 @@ object TypeCheckerTests extends MorphirBaseSpec { .toZIOWith(RTExecutionContext.default) } - def runTypeCheck(value : TypedValue) : ZIO[MrphirRuntimeTyped, Throwable, Data] = { + def runTypeCheck(value : TypedValue) : ZIO[MorphirRuntimeTyped, Throwable, Data] = + ZIO.serviceWithZIO[MorphirRuntimeTyped]{ runtime => runtime.evaluate(value) .provideEnvironment(MorphirEnv.live) .toZIOWith(RTExecutionContext.default) @@ -211,9 +212,9 @@ object TypeCheckerTests extends MorphirBaseSpec { suite("Type Checker Unhappy Paths")( suite("Apply Node")( test("Zero Arg") { - val badApply = V.apply(Basics.intType, V.int(1), V.Int(1)) + val badApply = V.apply(Basics.intType, V.int(1), V.int(1)) for { - actual <- runTest("constructorTests", "constructorZeroArgTest") + actual <- runTypeCheck() expected = zeroArg } yield assertTrue(actual == expected) } From c58d710c50d63f201bbb84a8561e4f07e36db224 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 07:22:36 -0700 Subject: [PATCH 093/323] Incremental --- .../finos/morphir/runtime/TypeCheckerTests.scala.scala | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala index 75c82e086..bd6f6c1a6 100644 --- a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala +++ b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala @@ -24,6 +24,10 @@ object TypeCheckerTests extends MorphirBaseSpec { dist <- EvaluationLibrary.loadDistributionFromFileZIO(irFilePath.toString) } yield MorphirRuntime.quick(dist)) + val typeCheckerLayer : ZLayer[Any, Throwable, TypeChecker] = + ZLayer( + + ) val localDate = java.time.LocalDate.of(1900, 1, 20) val localTime = java.time.LocalTime.of(10, 43, 26) def deriveData(input: Any): Data = @@ -212,9 +216,9 @@ object TypeCheckerTests extends MorphirBaseSpec { suite("Type Checker Unhappy Paths")( suite("Apply Node")( test("Zero Arg") { - val badApply = V.apply(Basics.intType, V.int(1), V.int(1)) + val badApply : TypedValue = V.apply(Basics.intType, V.intTyped(1), V.intTyped(1)) for { - actual <- runTypeCheck() + actual <- runTypeCheck(badApply) expected = zeroArg } yield assertTrue(actual == expected) } From 0654f7021d6445369bfce78e2ee32546977a2125 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 07:22:58 -0700 Subject: [PATCH 094/323] Incremental --- .../org/finos/morphir/runtime/TypeCheckerTests.scala.scala | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala index bd6f6c1a6..216e5c619 100644 --- a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala +++ b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala @@ -25,8 +25,11 @@ object TypeCheckerTests extends MorphirBaseSpec { } yield MorphirRuntime.quick(dist)) val typeCheckerLayer : ZLayer[Any, Throwable, TypeChecker] = - ZLayer( - + ZLayer(for { + irFilePath <- ZIO.succeed(os.pwd / "examples" / "morphir-elm-projects" / "evaluator-tests" / "morphir-ir.json") + _ <- Console.printLine(s"Loading distribution from $irFilePath") + dist <- EvaluationLibrary.loadDistributionFromFileZIO(irFilePath.toString) + } ) val localDate = java.time.LocalDate.of(1900, 1, 20) val localTime = java.time.LocalTime.of(10, 43, 26) From f326bae0fe266964748c218240732ae776d8d641 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 07:23:41 -0700 Subject: [PATCH 095/323] Incremental --- .../src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala index 216e5c619..41ecf630b 100644 --- a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala +++ b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala @@ -29,7 +29,7 @@ object TypeCheckerTests extends MorphirBaseSpec { irFilePath <- ZIO.succeed(os.pwd / "examples" / "morphir-elm-projects" / "evaluator-tests" / "morphir-ir.json") _ <- Console.printLine(s"Loading distribution from $irFilePath") dist <- EvaluationLibrary.loadDistributionFromFileZIO(irFilePath.toString) - } + } yield TypeChecker(dist) ) val localDate = java.time.LocalDate.of(1900, 1, 20) val localTime = java.time.LocalTime.of(10, 43, 26) From 09bca5789cf6da0a5ea6d0d80d482b538c4c336a Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 07:25:30 -0700 Subject: [PATCH 096/323] Incremental --- .../morphir/runtime/TypeCheckerTests.scala.scala | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala index 41ecf630b..ce07921bc 100644 --- a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala +++ b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala @@ -29,7 +29,7 @@ object TypeCheckerTests extends MorphirBaseSpec { irFilePath <- ZIO.succeed(os.pwd / "examples" / "morphir-elm-projects" / "evaluator-tests" / "morphir-ir.json") _ <- Console.printLine(s"Loading distribution from $irFilePath") dist <- EvaluationLibrary.loadDistributionFromFileZIO(irFilePath.toString) - } yield TypeChecker(dist) + } yield TypeChecker(Distributions(dist)) ) val localDate = java.time.LocalDate.of(1900, 1, 20) val localTime = java.time.LocalTime.of(10, 43, 26) @@ -91,11 +91,11 @@ object TypeCheckerTests extends MorphirBaseSpec { .toZIOWith(RTExecutionContext.default) } - def runTypeCheck(value : TypedValue) : ZIO[MorphirRuntimeTyped, Throwable, Data] = - ZIO.serviceWithZIO[MorphirRuntimeTyped]{ runtime => - runtime.evaluate(value) - .provideEnvironment(MorphirEnv.live) - .toZIOWith(RTExecutionContext.default) + def runTypeCheck(value : TypedValue) : ZIO[TypeChecker, Throwable, Data] = + ZIO.serviceWithZIO[TypeChecker]{ checker => + ZIO.succeed(checker.check(value)) +// .provideEnvironment(MorphirEnv.live) +// .toZIOWith(RTExecutionContext.default) } val dogRecordConceptRaw = Concept.Struct( From d5b58ff9911b79e9274a12199c124d0fc7dd5e0f Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 07:27:53 -0700 Subject: [PATCH 097/323] Incremental --- .../org/finos/morphir/runtime/TypeCheckerTests.scala.scala | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala index ce07921bc..bdc088381 100644 --- a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala +++ b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala @@ -91,7 +91,7 @@ object TypeCheckerTests extends MorphirBaseSpec { .toZIOWith(RTExecutionContext.default) } - def runTypeCheck(value : TypedValue) : ZIO[TypeChecker, Throwable, Data] = + def runTypeCheck(value : TypedValue) : ZIO[TypeChecker, Throwable, List[MorphirTypeError]] = ZIO.serviceWithZIO[TypeChecker]{ checker => ZIO.succeed(checker.check(value)) // .provideEnvironment(MorphirEnv.live) @@ -222,7 +222,7 @@ object TypeCheckerTests extends MorphirBaseSpec { val badApply : TypedValue = V.apply(Basics.intType, V.intTyped(1), V.intTyped(1)) for { actual <- runTypeCheck(badApply) - expected = zeroArg + expected = List() } yield assertTrue(actual == expected) } ), @@ -574,5 +574,5 @@ object TypeCheckerTests extends MorphirBaseSpec { Data.Boolean(true) ) @@ ignore @@ TestAspect.tag("Not Implemented yet") ) - ).provideLayerShared(morphirRuntimeLayer) + ).provideLayerShared(morphirRuntimeLayer).provideLayerShared(typeCheckerLayer) } From a1dfc8e5b9bcac9a5fd55c5fef95c73637d101b5 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 07:31:27 -0700 Subject: [PATCH 098/323] Incremental --- .../org/finos/morphir/runtime/TypeCheckerTests.scala.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala index bdc088381..e306c4ddd 100644 --- a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala +++ b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala @@ -225,7 +225,7 @@ object TypeCheckerTests extends MorphirBaseSpec { expected = List() } yield assertTrue(actual == expected) } - ), + ).provideLayerShared(typeCheckerLayer), suite("Destructure Tests")( test("As") { for { @@ -574,5 +574,5 @@ object TypeCheckerTests extends MorphirBaseSpec { Data.Boolean(true) ) @@ ignore @@ TestAspect.tag("Not Implemented yet") ) - ).provideLayerShared(morphirRuntimeLayer).provideLayerShared(typeCheckerLayer) + ).provideLayerShared(morphirRuntimeLayer) } From 930f17e4cdaf7c8b70ca84500091aada92779e6f Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 07:33:21 -0700 Subject: [PATCH 099/323] Incremental --- .../org/finos/morphir/runtime/TypeCheckerTests.scala.scala | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala index e306c4ddd..b14b0609c 100644 --- a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala +++ b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala @@ -90,7 +90,11 @@ object TypeCheckerTests extends MorphirBaseSpec { .provideEnvironment(MorphirEnv.live) .toZIOWith(RTExecutionContext.default) } - + def testTypeCheck(value : TypedValue, expectedErrors : Int) : ZIO[TypeChecker, Throwable, TestResult] = { + for { + + } + } def runTypeCheck(value : TypedValue) : ZIO[TypeChecker, Throwable, List[MorphirTypeError]] = ZIO.serviceWithZIO[TypeChecker]{ checker => ZIO.succeed(checker.check(value)) From d8e2de8197d1bb5f3877566269700711fec6dbb1 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 07:37:15 -0700 Subject: [PATCH 100/323] Incremental --- .../morphir/runtime/TypeCheckerTests.scala.scala | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala index b14b0609c..68ffeb05d 100644 --- a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala +++ b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala @@ -90,10 +90,11 @@ object TypeCheckerTests extends MorphirBaseSpec { .provideEnvironment(MorphirEnv.live) .toZIOWith(RTExecutionContext.default) } - def testTypeCheck(value : TypedValue, expectedErrors : Int) : ZIO[TypeChecker, Throwable, TestResult] = { + def testTypeCheck(value : TypedValue)(expectedErrors : Int) : ZIO[TypeChecker, Throwable, TestResult] = { for { - - } + errors <- runTypeCheck(value) + assert <- if (errors.length == expectedErrors) assertCompletes else assertTrue(errors.map(_.getMsg) == List()) + } yield assert } def runTypeCheck(value : TypedValue) : ZIO[TypeChecker, Throwable, List[MorphirTypeError]] = ZIO.serviceWithZIO[TypeChecker]{ checker => @@ -224,10 +225,7 @@ object TypeCheckerTests extends MorphirBaseSpec { suite("Apply Node")( test("Zero Arg") { val badApply : TypedValue = V.apply(Basics.intType, V.intTyped(1), V.intTyped(1)) - for { - actual <- runTypeCheck(badApply) - expected = List() - } yield assertTrue(actual == expected) + testTypeCheck(badApply)(0) } ).provideLayerShared(typeCheckerLayer), suite("Destructure Tests")( From dd0e108b40a439fa1b767fbeeef2b6fd02eedbbe Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 07:42:01 -0700 Subject: [PATCH 101/323] Incremental --- .../finos/morphir/runtime/Distributions.scala | 46 ++++-- .../finos/morphir/runtime/Extractors.scala | 2 +- .../morphir/runtime/MorphirTypeError.scala | 34 +++-- .../org/finos/morphir/runtime/Succinct.scala | 2 +- .../finos/morphir/runtime/TypeChecker.scala | 134 ++++++++++-------- .../src/org/finos/morphir/runtime/Utils.scala | 46 +++--- .../runtime/quick/EvaluatorQuick.scala | 29 ++-- .../runtime/quick/QuickMorphirRuntime.scala | 4 +- .../runtime/TypeCheckerTests.scala.scala | 62 ++------ .../core/src/org/finos/morphir/ir/Value.scala | 6 +- 10 files changed, 180 insertions(+), 185 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Distributions.scala b/morphir/runtime/src/org/finos/morphir/runtime/Distributions.scala index 894db9c12..4f99c255b 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Distributions.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Distributions.scala @@ -3,7 +3,13 @@ package org.finos.morphir.runtime import org.finos.morphir.naming._ import org.finos.morphir.naming._ import org.finos.morphir.ir.{Type as T, Value as V} -import org.finos.morphir.ir.Value.{Value, Pattern, TypedValue, USpecification => UValueSpec, TypedDefinition => TypedValueDef} +import org.finos.morphir.ir.Value.{ + Value, + Pattern, + TypedValue, + USpecification => UValueSpec, + TypedDefinition => TypedValueDef +} import org.finos.morphir.ir.Type.{Type, UType, USpecification => UTypeSpec} import org.finos.morphir.ir.Module.{Specification => ModSpec, Definition => ModDef} import org.finos.morphir.ir.sdk @@ -15,22 +21,28 @@ import org.finos.morphir.ir.distribution.Distribution.Library import zio.Chunk //TODO: Error hierarchy and code should reflect possibility of specification lookup -sealed abstract class LookupError(msg : String) extends Exception(msg) { +sealed abstract class LookupError(msg: String) extends Exception(msg) { def getMsg: String = msg } -case class MissingPackage(pkgName : PackageName) extends LookupError(s"Package ${pkgName.toString} not found") -case class MissingModule(pkgName: PackageName, modName : ModuleName) extends LookupError(s"Package ${pkgName.toString} does not contain module ${modName.toString}") -case class MissingType(pkgName : PackageName, modName: ModuleName, typeName : Name) extends LookupError(s"Module ${pkgName.toString}:${modName.toString} has no type named ${typeName.toTitleCase}") -case class MissingDefinition(pkgName: PackageName, modName: ModuleName, defName : Name) extends LookupError(s"Module ${pkgName.toString}:${modName.toString} has no definition named ${defName.toCamelCase}") -case class MissingConstructor(pkgName: PackageName, modName: ModuleName, ctorName : Name) extends LookupError(s"Module ${pkgName.toString}:${modName.toString} has no constructor named ${ctorName.toTitleCase}") +case class MissingPackage(pkgName: PackageName) extends LookupError(s"Package ${pkgName.toString} not found") +case class MissingModule(pkgName: PackageName, modName: ModuleName) + extends LookupError(s"Package ${pkgName.toString} does not contain module ${modName.toString}") +case class MissingType(pkgName: PackageName, modName: ModuleName, typeName: Name) + extends LookupError(s"Module ${pkgName.toString}:${modName.toString} has no type named ${typeName.toTitleCase}") +case class MissingDefinition(pkgName: PackageName, modName: ModuleName, defName: Name) extends LookupError( + s"Module ${pkgName.toString}:${modName.toString} has no definition named ${defName.toCamelCase}" + ) +case class MissingConstructor(pkgName: PackageName, modName: ModuleName, ctorName: Name) extends LookupError( + s"Module ${pkgName.toString}:${modName.toString} has no constructor named ${ctorName.toTitleCase}" + ) class Distributions(dists: Map[PackageName, Distribution]) { def lookupModuleSpecification(pkgName: PackageName, modName: ModuleName): Either[LookupError, ModSpec.Raw] = dists.get(pkgName) match { case Some(Library(_, _, packageDef)) => - packageDef.toSpecification.modules.get(modName) match{ + packageDef.toSpecification.modules.get(modName) match { case Some(module) => Right(module) - case None => Left(new MissingModule(pkgName, modName)) + case None => Left(new MissingModule(pkgName, modName)) } case None => Left(new MissingPackage(pkgName)) } @@ -40,15 +52,19 @@ class Distributions(dists: Map[PackageName, Distribution]) { case Some(Library(_, _, packageDef)) => packageDef.modules.get(modName) match { case Some(module) => Right(module.value) - case None => Left(new MissingModule(pkgName, modName)) + case None => Left(new MissingModule(pkgName, modName)) } case None => Left(new MissingPackage(pkgName)) } - def lookupTypeSpecification(pkgName: PackageName, modName: ModuleName, localName: Name): Either[LookupError, UTypeSpec] = - lookupModuleSpecification(pkgName, modName).flatMap(_.lookupTypeSpecification(localName) match{ + def lookupTypeSpecification( + pkgName: PackageName, + modName: ModuleName, + localName: Name + ): Either[LookupError, UTypeSpec] = + lookupModuleSpecification(pkgName, modName).flatMap(_.lookupTypeSpecification(localName) match { case Some(tpe) => Right(tpe) - case None => Left(new MissingType(pkgName, modName, localName)) + case None => Left(new MissingType(pkgName, modName, localName)) }) def lookupTypeSpecification(fqn: FQName): Either[LookupError, UTypeSpec] = @@ -61,7 +77,7 @@ class Distributions(dists: Map[PackageName, Distribution]) { ): Either[LookupError, UValueSpec] = lookupModuleSpecification(pkgName, modName).flatMap(_.lookupValueSpecification(localName) match { case Some(tpe) => Right(tpe) - case None => Left(new MissingDefinition(pkgName, modName, localName)) + case None => Left(new MissingDefinition(pkgName, modName, localName)) }) def lookupValueSpecification(fqn: FQName): Either[LookupError, UValueSpec] = @@ -74,7 +90,7 @@ class Distributions(dists: Map[PackageName, Distribution]) { ): Either[LookupError, TypedValueDef] = lookupModuleDefinition(pkgName, modName).flatMap(_.lookupValueDefinition(localName) match { case Some(tpe) => Right(tpe) - case None => Left(new MissingDefinition(pkgName, modName, localName)) + case None => Left(new MissingDefinition(pkgName, modName, localName)) }) def lookupValueDefinition(fqn: FQName): Either[LookupError, TypedValueDef] = diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala b/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala index ea7f769f4..bff4eb86d 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala @@ -113,7 +113,7 @@ object Extractors { case Right(T.Specification.TypeAliasSpecification(typeParams, expr)) => val newBindings = typeParams.zip(typeArgs).toMap Some(expr, newBindings) - case _ => None //Missing name, but failing extractors cause problems + case _ => None // Missing name, but failing extractors cause problems } case _ => None } diff --git a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala index 997c12d32..548757f6b 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala @@ -11,20 +11,26 @@ import org.finos.morphir.ir.Field import org.finos.morphir.runtime.exports.* import zio.Chunk -abstract class MorphirTypeError(msg: String) extends Exception(msg){ - def getMsg : String = msg +abstract class MorphirTypeError(msg: String) extends Exception(msg) { + def getMsg: String = msg } object MorphirTypeError { - def succinct[TA, VA](value : Value[TA, VA]) : String= Succinct.Value(value) - def succinct[TA](tpe : Type[TA]) : String = Succinct.Type(tpe) - case class TypesMismatch(tpe1: UType, tpe2: UType, msg : String) extends MorphirTypeError(s"$msg: succinct(tp1)} vs ${succinct(tpe2)}") - case class ArgumentDoesNotMatchParameter(arg: TypedValue, param: UType) extends MorphirTypeError(s"Argument ${succinct(arg)} of type ${succinct(arg.attributes)} does not match parameter succinct(param)}") - case class ApplyToNonFunction(nonFunction : TypedValue,arg : TypedValue) extends MorphirTypeError(s"Tried to apply ${succinct(arg)} to ${succinct(nonFunction)} of type ${succinct(nonFunction.attributes)}, which is not a function") - case class ImproperType(tpe: UType, message: String) extends MorphirTypeError("Todo") - case class CannotDealias(err : LookupError, msg : String = "Cannot dealias type") extends MorphirTypeError(s"$msg: ${err.getMsg}") - case class ValueMissing(value: TypedValue) extends MorphirTypeError("Todo") - case class ConstructorMissing(fqn: FQName, tpe: UType) extends MorphirTypeError("Todo") - case class ModuleMissing(modName: ModuleName) extends MorphirTypeError("Todo") - case class PackageMissing(pckName: PackageName) extends MorphirTypeError("Todo") - case class Unimplemented(s: String) extends MorphirTypeError(s) + def succinct[TA, VA](value: Value[TA, VA]): String = Succinct.Value(value) + def succinct[TA](tpe: Type[TA]): String = Succinct.Type(tpe) + case class TypesMismatch(tpe1: UType, tpe2: UType, msg: String) + extends MorphirTypeError(s"$msg: succinct(tp1)} vs ${succinct(tpe2)}") + case class ArgumentDoesNotMatchParameter(arg: TypedValue, param: UType) extends MorphirTypeError( + s"Argument ${succinct(arg)} of type ${succinct(arg.attributes)} does not match parameter succinct(param)}" + ) + case class ApplyToNonFunction(nonFunction: TypedValue, arg: TypedValue) extends MorphirTypeError( + s"Tried to apply ${succinct(arg)} to ${succinct(nonFunction)} of type ${succinct(nonFunction.attributes)}, which is not a function" + ) + case class ImproperType(tpe: UType, message: String) extends MorphirTypeError("Todo") + case class CannotDealias(err: LookupError, msg: String = "Cannot dealias type") + extends MorphirTypeError(s"$msg: ${err.getMsg}") + case class ValueMissing(value: TypedValue) extends MorphirTypeError("Todo") + case class ConstructorMissing(fqn: FQName, tpe: UType) extends MorphirTypeError("Todo") + case class ModuleMissing(modName: ModuleName) extends MorphirTypeError("Todo") + case class PackageMissing(pckName: PackageName) extends MorphirTypeError("Todo") + case class Unimplemented(s: String) extends MorphirTypeError(s) } diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Succinct.scala b/morphir/runtime/src/org/finos/morphir/runtime/Succinct.scala index 59c97ee04..a648679b2 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Succinct.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Succinct.scala @@ -24,7 +24,7 @@ object Succinct { def apply[TA](tpe: Type[TA], depth: Int): String = tpe match { case Reference(_, fqName, args) => s"$fqName ${args.map(apply(_, depth - 1)).mkString(" ")}" - case other => other.getClass.getSimpleName + case other => other.getClass.getSimpleName } def apply[TA](tpe: Type[TA]): String = apply(tpe, 2) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 39ef82caa..b38eb98d2 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -4,7 +4,13 @@ import org.finos.morphir.naming.* import org.finos.morphir.naming.* import org.finos.morphir.ir.{Type as T, Value as V} import org.finos.morphir.ir.Literal.Lit -import org.finos.morphir.ir.Value.{Pattern, TypedValue, Value, TypedDefinition as TypedValueDef, USpecification as UValueSpec} +import org.finos.morphir.ir.Value.{ + Pattern, + TypedValue, + Value, + TypedDefinition as TypedValueDef, + USpecification as UValueSpec +} import org.finos.morphir.ir.Type.{Type, UType, USpecification as UTypeSpec} import org.finos.morphir.ir.sdk import org.finos.morphir.ir.sdk.Basics @@ -32,8 +38,8 @@ object TypeChecker { class TypeChecker(dists: Distributions) { import TypeChecker.* - private val functionOnion = Extractors.Types.FunctionOnion(dists) - private def nameThatMismatch(tpe1: UType, tpe2: UType): String = { + private val functionOnion = Extractors.Types.FunctionOnion(dists) + private def nameThatMismatch(tpe1: UType, tpe2: UType): String = { import Extractors.Types.* (tpe1, tpe2) match { case (NonNativeRef(fqn1, args1), NonNativeRef(fqn2, args2)) if fqn1 == fqn2 => @@ -41,22 +47,22 @@ class TypeChecker(dists: Distributions) { case (NonNativeRef(fqn1, _), NonNativeRef(fqn2, _)) => val (pack1, mod1, loc1) = (fqn1.packagePath, fqn1.modulePath, fqn1.localName) val (pack2, mod2, loc2) = (fqn2.packagePath, fqn2.modulePath, fqn2.localName) - val packPart = if (pack1 != pack2) s"{$pack1 $pack2}" else pack1 - val modPart = if (mod1 != mod2) s"{$mod1 $mod2}" else mod1 + val packPart = if (pack1 != pack2) s"{$pack1 $pack2}" else pack1 + val modPart = if (mod1 != mod2) s"{$mod1 $mod2}" else mod1 val locPart = if (loc1 != loc2) s"{${loc1.toTitleCase} ${loc2.toTitleCase}" else loc1.toTitleCase s"$packPart:$modPart:$locPart" case _ => s"(${pretty(tpe1, 2)} vs ${pretty(tpe2, 2)})" } } - private def nameMissingValue(value: TypedValue, dists: Distributions): MorphirTypeError = {???} - private def nameMissingType(fqn: FQName, dists: Distributions): MorphirTypeError = {???} - private def nameMissingConstructor(fqn: FQName, tpe: UType, dists: Distributions): MorphirTypeError = {???} - private def pretty(tpe: UType, depthBudget: Int): String = {???} + private def nameMissingValue(value: TypedValue, dists: Distributions): MorphirTypeError = ??? + private def nameMissingType(fqn: FQName, dists: Distributions): MorphirTypeError = ??? + private def nameMissingConstructor(fqn: FQName, tpe: UType, dists: Distributions): MorphirTypeError = ??? + private def pretty(tpe: UType, depthBudget: Int): String = ??? def dealias(tpe: UType, context: Context): Either[MorphirTypeError, UType] = { def loop(tpe: UType, original_fqn: Option[FQName], context: Context): Either[MorphirTypeError, UType] = tpe match { - case ref@Extractors.Types.NativeRef() => Right(ref) // TODO: Bindings + case ref @ Extractors.Types.NativeRef() => Right(ref) // TODO: Bindings case Type.Reference(_, typeName, typeArgs) => val lookedUp = dists.lookupTypeSpecification(typeName.packagePath, typeName.modulePath, typeName.localName) lookedUp match { @@ -76,39 +82,39 @@ class TypeChecker(dists: Distributions) { } loop(tpe, None, context) } - private def pretty(tpe: UType): String = pretty(tpe, 2) + private def pretty(tpe: UType): String = pretty(tpe, 2) def check(suspect: TypedValue): TypeCheckerResult = check(suspect, Context.empty) def check(suspect: TypedValue, parentContext: Context): TypeCheckerResult = { import Value.{Unit as UnitValue, List as ListValue, Field as FieldValue, *} val context = parentContext.withDepth(parentContext.depth + 1) suspect match { - case Literal(tpe, lit) => handleLiteral(tpe, lit, context) + case Literal(tpe, lit) => handleLiteral(tpe, lit, context) case Apply(tpe, function, argument) => handleApply(tpe, function, argument, context) case Destructure(tpe, pattern, valueToDestruct, inValue) => handleDestructure(tpe, pattern, valueToDestruct, inValue, context) - case Constructor(tpe, name) => handleConstructor(tpe, name, context) + case Constructor(tpe, name) => handleConstructor(tpe, name, context) case FieldValue(tpe, recordValue, name) => handleFieldValue(tpe, recordValue, name, context) - case FieldFunction(tpe, name) => handleFieldFunction(tpe, name, context) + case FieldFunction(tpe, name) => handleFieldFunction(tpe, name, context) case IfThenElse(tpe, condition, thenValue, elseValue) => handleIfThenElse(tpe, condition, thenValue, elseValue, context) case Lambda(tpe, pattern, body) => handleLambda(tpe, pattern, body, context) case LetDefinition(tpe, name, definition, inValue) => handleLetDefinition(tpe, name, definition, inValue, context) - case LetRecursion(tpe, definitions, inValue) => handleLetRecursion(tpe, definitions, inValue, context) - case ListValue(tpe, elements) => handleListValue(tpe, elements.toList, context) - case PatternMatch(tpe, value, cases) => handlePatternMatch(tpe, value, cases.toList, context) - case Record(tpe, fields) => handleRecord(tpe, fields.toList, context) - case Reference(tpe, name) => handleReference(tpe, name, context) - case Tuple(tpe, elements) => handleTuple(tpe, elements.toList, context) - case UnitValue(va) => handleUnitValue(va, context) + case LetRecursion(tpe, definitions, inValue) => handleLetRecursion(tpe, definitions, inValue, context) + case ListValue(tpe, elements) => handleListValue(tpe, elements.toList, context) + case PatternMatch(tpe, value, cases) => handlePatternMatch(tpe, value, cases.toList, context) + case Record(tpe, fields) => handleRecord(tpe, fields.toList, context) + case Reference(tpe, name) => handleReference(tpe, name, context) + case Tuple(tpe, elements) => handleTuple(tpe, elements.toList, context) + case UnitValue(va) => handleUnitValue(va, context) case UpdateRecord(tpe, valueToUpdate, fields) => handleUpdateRecord(tpe, valueToUpdate, fields, context) - case Variable(tpe, name) => handleVariable(tpe, name, context) + case Variable(tpe, name) => handleVariable(tpe, name, context) } } - def handleLiteral(tpe: UType, literal : Lit, context: Context): TypeCheckerResult = { + def handleLiteral(tpe: UType, literal: Lit, context: Context): TypeCheckerResult = { val fromChildren = List() - //TODO: Check lit agrees + // TODO: Check lit agrees fromChildren } @@ -117,36 +123,42 @@ class TypeChecker(dists: Distributions) { val fromTpe = dealias(function.attributes, context) match { case Right(Type.Function(_, paramType, returnType)) => - //TODO: Better than != + // TODO: Better than != helper(paramType != argument.attributes, new ArgumentDoesNotMatchParameter(argument, paramType)) ++ helper(returnType != tpe, new TypesMismatch(tpe, returnType, "Function return does not match apply node")) case Right(other) => List(new ApplyToNonFunction(function, argument)) - case Left(err) => List(err) + case Left(err) => List(err) } - //TODO: Check it's a function with matching arg and return + // TODO: Check it's a function with matching arg and return fromChildren ++ fromTpe } - def handleDestructure(tpe: UType, pattern: Pattern[UType], value : TypedValue, inValue : TypedValue, context: Context): TypeCheckerResult = { + def handleDestructure( + tpe: UType, + pattern: Pattern[UType], + value: TypedValue, + inValue: TypedValue, + context: Context + ): TypeCheckerResult = { val fromChildren = check(value, context) ++ check(inValue, context) - //TODO: Check inValue matches tpe - //TODO: Check pattern can be value - //TODO: Check value must be pattern + // TODO: Check inValue matches tpe + // TODO: Check pattern can be value + // TODO: Check value must be pattern fromChildren } - def handleConstructor(tpe: UType, fqn : FQName, context: Context): TypeCheckerResult = { + def handleConstructor(tpe: UType, fqn: FQName, context: Context): TypeCheckerResult = { val fromChildren = List() - //TODO: Check it's a function onion for a type with that constructor + // TODO: Check it's a function onion for a type with that constructor fromChildren } def handleFieldValue(tpe: UType, recordValue: TypedValue, name: Name, context: Context): TypeCheckerResult = { val fromChildren = check(recordValue, context) - //TODO: Check the value dealiases to a record which has that name + // TODO: Check the value dealiases to a record which has that name fromChildren } def handleFieldFunction(tpe: UType, name: Name, context: Context): TypeCheckerResult = { val fromChildren = List() - //TODO: Uh... Nothing. + // TODO: Uh... Nothing. fromChildren } def handleIfThenElse( @@ -156,15 +168,15 @@ class TypeChecker(dists: Distributions) { elseValue: TypedValue, context: Context ): TypeCheckerResult = { - val fromChildren = check(condition, context) ++ check(thenValue, context)++ check(elseValue, context) - //TODO: Check condition is boolean and branches agree withe ach other/tpe + val fromChildren = check(condition, context) ++ check(thenValue, context) ++ check(elseValue, context) + // TODO: Check condition is boolean and branches agree withe ach other/tpe fromChildren } def handleLambda(tpe: UType, pattern: Pattern[UType], body: TypedValue, context: Context): TypeCheckerResult = { val fromChildren = check(body, context) - //TODO: Check tpe is a function - //TODO: Check tpe's argument matches (strictly) with pattern - //TODO: Figure out variable bindings + // TODO: Check tpe is a function + // TODO: Check tpe's argument matches (strictly) with pattern + // TODO: Figure out variable bindings fromChildren } def handleLetDefinition( @@ -175,9 +187,9 @@ class TypeChecker(dists: Distributions) { context: Context ): TypeCheckerResult = { val fromChildren = check(inValue, context) - //TODO: Manage Store - //TODO: Check definition body - //TODO: Check definition body w/ argument types added to store + // TODO: Manage Store + // TODO: Check definition body + // TODO: Check definition body w/ argument types added to store fromChildren } def handleLetRecursion( @@ -187,13 +199,13 @@ class TypeChecker(dists: Distributions) { context: Context ): TypeCheckerResult = { val fromChildren = check(inValue, context) - //TODO: Manage store - //TODO: Check definition types and add to stores + // TODO: Manage store + // TODO: Check definition types and add to stores fromChildren } def handleListValue(tpe: UType, elements: List[TypedValue], context: Context): TypeCheckerResult = { val fromChildren = elements.flatMap(check(_, context)) - //TODO: Check tpe is a list, check children types agree w/ parent type (probably only report one mismatch, but inspect all values + // TODO: Check tpe is a list, check children types agree w/ parent type (probably only report one mismatch, but inspect all values fromChildren } def handlePatternMatch( @@ -203,44 +215,44 @@ class TypeChecker(dists: Distributions) { context: Context ): TypeCheckerResult = { val fromChildren = check(value, context) - //TODO: Check values from each case - //TODO: Manage store - //TODO: Check each case's pattern can be it's value - //TODO: Check value must be one of the patterns + // TODO: Check values from each case + // TODO: Manage store + // TODO: Check each case's pattern can be it's value + // TODO: Check value must be one of the patterns fromChildren } def handleRecord(tpe: UType, fields: List[(Name, TypedValue)], context: Context): TypeCheckerResult = { - val fromChildren = fields.flatMap{case (_, value) => check(value, context)} - //TODO: Check tpe dealises to a record - //TODO: Check each field agrees with the type from the name + val fromChildren = fields.flatMap { case (_, value) => check(value, context) } + // TODO: Check tpe dealises to a record + // TODO: Check each field agrees with the type from the name fromChildren } def handleReference(tpe: UType, fqn: FQName, context: Context): TypeCheckerResult = { val fromChildren = List() - //TODO: Check the value dealiases to a definition that translates to this tpe + // TODO: Check the value dealiases to a definition that translates to this tpe fromChildren } def handleTuple(tpe: UType, elements: List[TypedValue], context: Context): TypeCheckerResult = { val fromChildren = elements.flatMap(check(_, context)) - //TODO: Check tpe dealiases to a tuple - //TODO: Check tuple types vs. nested value types + // TODO: Check tpe dealiases to a tuple + // TODO: Check tuple types vs. nested value types fromChildren } def handleUnitValue(tpe: UType, context: Context): TypeCheckerResult = - List() //Pass + List() // Pass def handleUpdateRecord( tpe: UType, valueToUpdate: TypedValue, fields: Map[Name, TypedValue], context: Context ): TypeCheckerResult = { - val fromChildren = check(valueToUpdate, context) ++ fields.flatMap{case (_, value) => check(value, context)} - //TODO: Check the value dealiases to a record which has that name + val fromChildren = check(valueToUpdate, context) ++ fields.flatMap { case (_, value) => check(value, context) } + // TODO: Check the value dealiases to a record which has that name fromChildren } def handleVariable(tpe: UType, name: Name, context: Context): TypeCheckerResult = - //TODO: Keep that in the context - //TODONT: Do not re-check the body - only make sure that the tpe matches this + // TODO: Keep that in the context + // TODONT: Do not re-check the body - only make sure that the tpe matches this List() } diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala index c32e5a650..114ed3a4c 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala @@ -17,8 +17,6 @@ import org.finos.morphir.ir.sdk import org.finos.morphir.ir.Value.{USpecification => UValueSpec, Definition => ValueDefinition} import org.finos.morphir.ir.Type.{USpecification => UTypeSpec} - - object Utils { import Extractors.Types.* @@ -135,30 +133,30 @@ object Utils { curryTypeFunction(spec.output, spec.inputs) def unCurryTypeFunction( - curried: UType, - args: List[TypedValue], - dists: Distributions, - knownBindings: Map[Name, UType] - )(implicit options: RTExecutionContext.Options): RTAction[Any, TypeError, UType] = { - val dealiaser = new Dealiased(dists) - (curried, args) match { - case (Type.Function(attributes, parameterType, returnType), head :: tail) => - for { + curried: UType, + args: List[TypedValue], + dists: Distributions, + knownBindings: Map[Name, UType] + )(implicit options: RTExecutionContext.Options): RTAction[Any, TypeError, UType] = { + val dealiaser = new Dealiased(dists) + (curried, args) match { + case (Type.Function(attributes, parameterType, returnType), head :: tail) => + for { - // errors <- RTAction.succeed(new ArgTypeChecker(dists).reallyTypeCheckArg(head, parameterType, "")) - bindings <- RTAction.fromEither(typeCheckArg(head.attributes, parameterType, knownBindings)) - // _ <- RTAction.fail( new ManyErrors(errors: _*)) - //// errors = new TypeChecker().reallyTypeCheckArg(head, parameterType, "") - //// _ <- RTAction.fail(new ManyErrors(errors:_*)) - appliedType <- unCurryTypeFunction(returnType, tail, dists, bindings) - } yield appliedType - case (tpe, Nil) => RTAction.succeed(applyBindings(tpe, knownBindings)) - case (dealiaser(inner, aliasBindings), args) => - unCurryTypeFunction(inner, args, dists, knownBindings ++ aliasBindings) - case (nonFunction, head :: _) => - RTAction.fail(TooManyArgs(s"Tried to apply argument $head to non-function $nonFunction")) - } + // errors <- RTAction.succeed(new ArgTypeChecker(dists).reallyTypeCheckArg(head, parameterType, "")) + bindings <- RTAction.fromEither(typeCheckArg(head.attributes, parameterType, knownBindings)) + // _ <- RTAction.fail( new ManyErrors(errors: _*)) + //// errors = new TypeChecker().reallyTypeCheckArg(head, parameterType, "") + //// _ <- RTAction.fail(new ManyErrors(errors:_*)) + appliedType <- unCurryTypeFunction(returnType, tail, dists, bindings) + } yield appliedType + case (tpe, Nil) => RTAction.succeed(applyBindings(tpe, knownBindings)) + case (dealiaser(inner, aliasBindings), args) => + unCurryTypeFunction(inner, args, dists, knownBindings ++ aliasBindings) + case (nonFunction, head :: _) => + RTAction.fail(TooManyArgs(s"Tried to apply argument $head to non-function $nonFunction")) } + } def isNative(fqn: FQName): Boolean = { val example = FQName.fromString("Morphir.SDK:Basics:equal") fqn.getPackagePath == example.getPackagePath diff --git a/morphir/runtime/src/org/finos/morphir/runtime/quick/EvaluatorQuick.scala b/morphir/runtime/src/org/finos/morphir/runtime/quick/EvaluatorQuick.scala index 05f2843d2..a8a841646 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/quick/EvaluatorQuick.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/quick/EvaluatorQuick.scala @@ -96,22 +96,22 @@ object EvaluatorQuick { SDKValue.SDKNativeFunction(nf.arity, f) } - def typeToConcept(tpe: Type.Type[Unit], dists: Distributions, boundTypes: Map[Name, Concept]): Concept = { + def typeToConcept(tpe: Type.Type[Unit], dists: Distributions, boundTypes: Map[Name, Concept]): Concept = tpe match { case TT.ExtensibleRecord(attributes, name, fields) => throw UnsupportedType("Extensible records not supported for DDL") case TT.Function(attributes, argumentType, returnType) => throw UnsupportedType("Functiom types not supported for DDL") case TT.Record(attributes, fields) => Concept.Struct(fields.map(field => - (Label(field.name.toCamelCase), typeToConcept(field.data, dists, boundTypes)) - ).toList) - case IntRef() => Concept.Int32 - case Int32Ref() => Concept.Int32 - case StringRef() => Concept.String - case BoolRef() => Concept.Boolean - case CharRef() => Concept.Char - case FloatRef() => Concept.Decimal - case DecimalRef() => Concept.Decimal + (Label(field.name.toCamelCase), typeToConcept(field.data, dists, boundTypes)) + ).toList) + case IntRef() => Concept.Int32 + case Int32Ref() => Concept.Int32 + case StringRef() => Concept.String + case BoolRef() => Concept.Boolean + case CharRef() => Concept.Char + case FloatRef() => Concept.Decimal + case DecimalRef() => Concept.Decimal case LocalDateRef() => Concept.LocalDate case LocalTimeRef() => Concept.LocalTime @@ -124,14 +124,14 @@ object EvaluatorQuick { case DictRef(keyType, valType) => Concept.Map(typeToConcept(keyType, dists, boundTypes), typeToConcept(valType, dists, boundTypes)) case TT.Reference(attributes, typeName, typeArgs) => - val lookedUp = dists.lookupTypeSpecification(typeName.packagePath, typeName.modulePath, typeName.localName) + val lookedUp = dists.lookupTypeSpecification(typeName.packagePath, typeName.modulePath, typeName.localName) val conceptArgs = typeArgs.map(typeToConcept(_, dists, boundTypes)) lookedUp.getOrElse(throw new Exception(s"Could not find spec for $typeName")) match { case Type.Specification.TypeAliasSpecification(typeParams, expr) => val newBindings = typeParams.zip(conceptArgs).toMap typeToConcept(expr, dists, newBindings) match { case Concept.Struct(fields) => Concept.Record(typeName, fields) - case other => Concept.Alias(typeName, other) + case other => Concept.Alias(typeName, other) } case Type.Specification.CustomTypeSpecification(typeParams, ctors) => val newBindings = typeParams.zip(conceptArgs).toMap @@ -139,7 +139,7 @@ object EvaluatorQuick { val argTuples = args.map { case (argName: Name, argType: Type.UType) => (EnumLabel.Named(argName.toCamelCase), typeToConcept(argType, dists, newBindings)) } - val conceptName: String = caseName.toTitleCase + val conceptName: String = caseName.toTitleCase val concepts: List[(EnumLabel, Concept)] = argTuples.toList Concept.Enum.Case(Label(conceptName), concepts) } @@ -148,10 +148,9 @@ object EvaluatorQuick { } case TT.Tuple(attributes, elements) => Concept.Tuple(elements.map(element => typeToConcept(element, dists, boundTypes)).toList) - case TT.Unit(attributes) => Concept.Unit + case TT.Unit(attributes) => Concept.Unit case TT.Variable(attributes, name) => boundTypes(name) } - } def resultAndConceptToData(result: Result[Unit, Type.UType], concept: Concept): Data = (concept, result) match { case (Concept.Struct(fields), Result.Record(elements)) => diff --git a/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala b/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala index b7ac9f75b..c6f3cbd23 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala @@ -40,10 +40,10 @@ private[runtime] case class QuickMorphirRuntime(dists: Distributions, store: Sto } yield res def fetchType(fqn: FQName): RTAction[MorphirEnv, MorphirRuntimeError, UType] = { - val maybeSpec = dists.lookupValueSpecification(fqn) + val maybeSpec = dists.lookupValueSpecification(fqn) maybeSpec match { case Right(spec) => RTAction.succeed(specificationToType(spec)) - case Left(err) => RTAction.fail(new SpecificationNotFound(s"Lookup failure: ${err.getMsg}")) + case Left(err) => RTAction.fail(new SpecificationNotFound(s"Lookup failure: ${err.getMsg}")) } } diff --git a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala index 68ffeb05d..d6fe2aa59 100644 --- a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala +++ b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala @@ -24,13 +24,12 @@ object TypeCheckerTests extends MorphirBaseSpec { dist <- EvaluationLibrary.loadDistributionFromFileZIO(irFilePath.toString) } yield MorphirRuntime.quick(dist)) - val typeCheckerLayer : ZLayer[Any, Throwable, TypeChecker] = + val typeCheckerLayer: ZLayer[Any, Throwable, TypeChecker] = ZLayer(for { irFilePath <- ZIO.succeed(os.pwd / "examples" / "morphir-elm-projects" / "evaluator-tests" / "morphir-ir.json") - _ <- Console.printLine(s"Loading distribution from $irFilePath") - dist <- EvaluationLibrary.loadDistributionFromFileZIO(irFilePath.toString) - } yield TypeChecker(Distributions(dist)) - ) + _ <- Console.printLine(s"Loading distribution from $irFilePath") + dist <- EvaluationLibrary.loadDistributionFromFileZIO(irFilePath.toString) + } yield TypeChecker(Distributions(dist))) val localDate = java.time.LocalDate.of(1900, 1, 20) val localTime = java.time.LocalTime.of(10, 43, 26) def deriveData(input: Any): Data = @@ -46,8 +45,6 @@ object TypeCheckerTests extends MorphirBaseSpec { case other => throw new Exception(s"Couldn't derive $other") } - - def checkEvaluation( moduleName: String, functionName: String @@ -90,18 +87,18 @@ object TypeCheckerTests extends MorphirBaseSpec { .provideEnvironment(MorphirEnv.live) .toZIOWith(RTExecutionContext.default) } - def testTypeCheck(value : TypedValue)(expectedErrors : Int) : ZIO[TypeChecker, Throwable, TestResult] = { + def testTypeCheck(value: TypedValue)(expectedErrors: Int): ZIO[TypeChecker, Throwable, TestResult] = for { errors <- runTypeCheck(value) - assert <- if (errors.length == expectedErrors) assertCompletes else assertTrue(errors.map(_.getMsg) == List()) + errorMsgs = errors.map(_.getMsg) + assert <- if (errors.length == expectedErrors) assertCompletes else assertTrue(errorMsgs == List()) } yield assert - } - def runTypeCheck(value : TypedValue) : ZIO[TypeChecker, Throwable, List[MorphirTypeError]] = - ZIO.serviceWithZIO[TypeChecker]{ checker => - ZIO.succeed(checker.check(value)) + def runTypeCheck(value: TypedValue): ZIO[TypeChecker, Throwable, List[MorphirTypeError]] = + ZIO.serviceWithZIO[TypeChecker] { checker => + ZIO.succeed(checker.check(value)) // .provideEnvironment(MorphirEnv.live) // .toZIOWith(RTExecutionContext.default) - } + } val dogRecordConceptRaw = Concept.Struct( List( @@ -123,8 +120,6 @@ object TypeCheckerTests extends MorphirBaseSpec { // dogRecordConcept // ) - - def resultStringIntShape = Concept.Result(Concept.String, Concept.Int32) def resultBoolIntShape = Concept.Result(Concept.Boolean, Concept.Int32) @@ -223,42 +218,11 @@ object TypeCheckerTests extends MorphirBaseSpec { def spec = suite("Type Checker Unhappy Paths")( suite("Apply Node")( - test("Zero Arg") { - val badApply : TypedValue = V.apply(Basics.intType, V.intTyped(1), V.intTyped(1)) + test("Apply to non function") { + val badApply: TypedValue = V.apply(Basics.intType, V.intTyped(1), V.intTyped(1)) testTypeCheck(badApply)(0) } ).provideLayerShared(typeCheckerLayer), - suite("Destructure Tests")( - test("As") { - for { - actual <- runTest("destructureTests", "destructureAsTest") - expected = Data.Int(5) - } yield assertTrue(actual == expected) - }, - test("Tuple") { - for { - actual <- runTest("destructureTests", "destructureTupleTest") - expected = Data.Tuple(Data.Int(1), Data.Int(2)) - } yield assertTrue(actual == expected) - }, - test("Constructor") { - for { - actual <- runTest("destructureTests", "destructureConstructorTest") - expected = Data.Tuple(Data.Int(5), Data.String("red")) - } yield assertTrue(actual == expected) - }, - testEvaluation("Unit")("destructureTests", "destructureUnitTest")(Data.Int(4)), - testEvaluation("AsTwice")("destructureTests", "destructureAsTwiceTest")(Data.Tuple(Data.Int(5), Data.Int(5))), - testEvaluation("Tuple Twice")("destructureTests", "destructureTupleTwiceTest")(Data.Tuple( - Data.String("Blue"), - Data.Int(5), - Data.Tuple(Data.Int(5), Data.String("Blue")) - )), - testEvaluation("Directly Nested")("destructureTests", "destructureDirectTest")(Data.Tuple( - Data.Int(6), - Data.String("Green") - )) - ), suite("IfThenElse Tests")( testEvaluation("True Branch")("ifThenElseTests", "ifThenElseTrueTest")(Data.String("Correct")), testEvaluation("False Branch")("ifThenElseTests", "ifThenElseFalseTest")(Data.String("Correct")), diff --git a/morphir/toolkit/core/src/org/finos/morphir/ir/Value.scala b/morphir/toolkit/core/src/org/finos/morphir/ir/Value.scala index 67e393118..8d6006985 100644 --- a/morphir/toolkit/core/src/org/finos/morphir/ir/Value.scala +++ b/morphir/toolkit/core/src/org/finos/morphir/ir/Value.scala @@ -53,9 +53,9 @@ object Value extends internal.PatternModule { final type Specification[+TA] = ValueSpecification[TA] final val Specification: ValueSpecification.type = ValueSpecification - final type RawValue = Value.RawValue - final type TypedValue = Value.TypedValue - final type USpecification = ValueSpecification[scala.Unit] + final type RawValue = Value.RawValue + final type TypedValue = Value.TypedValue + final type USpecification = ValueSpecification[scala.Unit] final type TypedDefinition = ValueDefinition[scala.Unit, Type.UType] import Type.{Type, UType} From 78e2a01c1c3301953b9bbbe7e892f3a80c61fae8 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 07:45:48 -0700 Subject: [PATCH 102/323] New test --- .../evaluator-tests/morphir-ir.json | 146 ++++++++++++++++++ 1 file changed, 146 insertions(+) diff --git a/examples/morphir-elm-projects/evaluator-tests/morphir-ir.json b/examples/morphir-elm-projects/evaluator-tests/morphir-ir.json index 40801f862..acf392f29 100644 --- a/examples/morphir-elm-projects/evaluator-tests/morphir-ir.json +++ b/examples/morphir-elm-projects/evaluator-tests/morphir-ir.json @@ -158664,6 +158664,152 @@ } } ], + [ + [ + [ + "type", + "checker", + "tests" + ] + ], + { + "access": "Public", + "value": { + "types": [], + "values": [ + [ + [ + "int", + "to", + "int" + ], + { + "access": "Public", + "value": { + "doc": "", + "value": { + "inputTypes": [ + [ + [ + "x" + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ] + ], + "outputType": [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + "body": [ + "Variable", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "x" + ] + ] + } + } + } + ] + ], + "doc": null + } + } + ], [ [ [ From 9444f44da10537983fd35e21f4c43dbfb20c82e7 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 07:46:58 -0700 Subject: [PATCH 103/323] New test --- .../src/Morphir/Examples/App/TypeCheckerTests.elm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/examples/morphir-elm-projects/evaluator-tests/src/Morphir/Examples/App/TypeCheckerTests.elm b/examples/morphir-elm-projects/evaluator-tests/src/Morphir/Examples/App/TypeCheckerTests.elm index b152a17f2..a38fb6af8 100644 --- a/examples/morphir-elm-projects/evaluator-tests/src/Morphir/Examples/App/TypeCheckerTests.elm +++ b/examples/morphir-elm-projects/evaluator-tests/src/Morphir/Examples/App/TypeCheckerTests.elm @@ -1 +1,4 @@ -module Morphir.Examples.App.TypeCheckerTests exposing (..) \ No newline at end of file +module Morphir.Examples.App.TypeCheckerTests exposing (..) + +intToInt : Int -> Int +intToInt x = x \ No newline at end of file From aca7257ac6a2c31e933e2b22c73959a38bb81779 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 07:47:23 -0700 Subject: [PATCH 104/323] Incremental --- .../org/finos/morphir/runtime/TypeCheckerTests.scala.scala | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala index d6fe2aa59..61dcb0410 100644 --- a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala +++ b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala @@ -214,6 +214,7 @@ object TypeCheckerTests extends MorphirBaseSpec { "TwoArg", unionEnumShape ) + val add = V.reference(T.Function(T.int, T.int)) def spec = suite("Type Checker Unhappy Paths")( @@ -222,6 +223,9 @@ object TypeCheckerTests extends MorphirBaseSpec { val badApply: TypedValue = V.apply(Basics.intType, V.intTyped(1), V.intTyped(1)) testTypeCheck(badApply)(0) } + test("Apply arg type wrong"){ + val badApply : TypedValue = V.Apply(Basics.IntType, V.lambda) + } ).provideLayerShared(typeCheckerLayer), suite("IfThenElse Tests")( testEvaluation("True Branch")("ifThenElseTests", "ifThenElseTrueTest")(Data.String("Correct")), From 2cf74758420673188044b365cc9bbf6793aedba9 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 07:49:36 -0700 Subject: [PATCH 105/323] Incremental --- .../src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala index 61dcb0410..12b341e19 100644 --- a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala +++ b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala @@ -214,7 +214,7 @@ object TypeCheckerTests extends MorphirBaseSpec { "TwoArg", unionEnumShape ) - val add = V.reference(T.Function(T.int, T.int)) + val intToInt : TypedValue = V.reference(Type.function(T.int, T.int), FQName.fromString("Morphir/Examples/App:TypeCheckerTests:intToInt")) def spec = suite("Type Checker Unhappy Paths")( From ae31993299b69ebe10a2d6b093bba22b8f393e80 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 07:52:16 -0700 Subject: [PATCH 106/323] Incremental --- .../org/finos/morphir/runtime/TypeCheckerTests.scala.scala | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala index 12b341e19..2bf18dbf9 100644 --- a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala +++ b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala @@ -214,7 +214,7 @@ object TypeCheckerTests extends MorphirBaseSpec { "TwoArg", unionEnumShape ) - val intToInt : TypedValue = V.reference(Type.function(T.int, T.int), FQName.fromString("Morphir/Examples/App:TypeCheckerTests:intToInt")) + val intToInt : TypedValue = V.reference(T.function(Basics.intType, Basics.intType), FQName.fromString("Morphir/Examples/App:TypeCheckerTests:intToInt")) def spec = suite("Type Checker Unhappy Paths")( @@ -222,9 +222,9 @@ object TypeCheckerTests extends MorphirBaseSpec { test("Apply to non function") { val badApply: TypedValue = V.apply(Basics.intType, V.intTyped(1), V.intTyped(1)) testTypeCheck(badApply)(0) - } + }, test("Apply arg type wrong"){ - val badApply : TypedValue = V.Apply(Basics.IntType, V.lambda) + val badApply : TypedValue = V.apply(Basics.intType, V.lambda) } ).provideLayerShared(typeCheckerLayer), suite("IfThenElse Tests")( From 2707c0392dee0f8e24f7d9a1076887eaf7c7127e Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 07:54:37 -0700 Subject: [PATCH 107/323] Incremental --- .../src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala index 2bf18dbf9..92f079369 100644 --- a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala +++ b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala @@ -214,6 +214,7 @@ object TypeCheckerTests extends MorphirBaseSpec { "TwoArg", unionEnumShape ) + val validString : TypedValue = V.string(Basics.stringType, "Green") val intToInt : TypedValue = V.reference(T.function(Basics.intType, Basics.intType), FQName.fromString("Morphir/Examples/App:TypeCheckerTests:intToInt")) def spec = @@ -224,7 +225,7 @@ object TypeCheckerTests extends MorphirBaseSpec { testTypeCheck(badApply)(0) }, test("Apply arg type wrong"){ - val badApply : TypedValue = V.apply(Basics.intType, V.lambda) + val badApply : TypedValue = V.apply(Basics.intType, intToInt, validString) } ).provideLayerShared(typeCheckerLayer), suite("IfThenElse Tests")( From 781749de096af754c0798ad6b987959661e1d8ee Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 07:59:31 -0700 Subject: [PATCH 108/323] Incremental --- .../src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala index 92f079369..415cee46d 100644 --- a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala +++ b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala @@ -214,7 +214,7 @@ object TypeCheckerTests extends MorphirBaseSpec { "TwoArg", unionEnumShape ) - val validString : TypedValue = V.string(Basics.stringType, "Green") + val validString : TypedValue = V.string(sdk.String.stringType, "Green") val intToInt : TypedValue = V.reference(T.function(Basics.intType, Basics.intType), FQName.fromString("Morphir/Examples/App:TypeCheckerTests:intToInt")) def spec = @@ -226,6 +226,7 @@ object TypeCheckerTests extends MorphirBaseSpec { }, test("Apply arg type wrong"){ val badApply : TypedValue = V.apply(Basics.intType, intToInt, validString) + testTypeCheck(badApply)(0) } ).provideLayerShared(typeCheckerLayer), suite("IfThenElse Tests")( From 73e24a562d9ac8bde6179bcccf2c31512a53e887 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 08:04:16 -0700 Subject: [PATCH 109/323] Incremental --- .../org/finos/morphir/runtime/MorphirTypeError.scala | 2 +- .../finos/morphir/runtime/TypeCheckerTests.scala.scala | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala index 548757f6b..6eb418b42 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala @@ -20,7 +20,7 @@ object MorphirTypeError { case class TypesMismatch(tpe1: UType, tpe2: UType, msg: String) extends MorphirTypeError(s"$msg: succinct(tp1)} vs ${succinct(tpe2)}") case class ArgumentDoesNotMatchParameter(arg: TypedValue, param: UType) extends MorphirTypeError( - s"Argument ${succinct(arg)} of type ${succinct(arg.attributes)} does not match parameter succinct(param)}" + s"Argument ${succinct(arg)} of type ${succinct(arg.attributes)} does not match parameter ${succinct(param)}" ) case class ApplyToNonFunction(nonFunction: TypedValue, arg: TypedValue) extends MorphirTypeError( s"Tried to apply ${succinct(arg)} to ${succinct(nonFunction)} of type ${succinct(nonFunction.attributes)}, which is not a function" diff --git a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala index 415cee46d..7af0e1ee4 100644 --- a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala +++ b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala @@ -13,6 +13,7 @@ import org.finos.morphir.testing.MorphirBaseSpec import zio.test.* import zio.test.TestAspect.{ignore, tag} import zio.{Console, ZIO, ZLayer} +import org.finos.morphir.ir.Value.RawValueExtensions object TypeCheckerTests extends MorphirBaseSpec { type MorphirRuntimeTyped = MorphirRuntime[Unit, UType] @@ -96,8 +97,6 @@ object TypeCheckerTests extends MorphirBaseSpec { def runTypeCheck(value: TypedValue): ZIO[TypeChecker, Throwable, List[MorphirTypeError]] = ZIO.serviceWithZIO[TypeChecker] { checker => ZIO.succeed(checker.check(value)) -// .provideEnvironment(MorphirEnv.live) -// .toZIOWith(RTExecutionContext.default) } val dogRecordConceptRaw = Concept.Struct( @@ -215,10 +214,11 @@ object TypeCheckerTests extends MorphirBaseSpec { unionEnumShape ) val validString : TypedValue = V.string(sdk.String.stringType, "Green") + val invalidString : TypedValue = V.int(1) :> sdk>string.stringType val intToInt : TypedValue = V.reference(T.function(Basics.intType, Basics.intType), FQName.fromString("Morphir/Examples/App:TypeCheckerTests:intToInt")) def spec = - suite("Type Checker Unhappy Paths")( + suite("Type Checker Tests")( suite("Apply Node")( test("Apply to non function") { val badApply: TypedValue = V.apply(Basics.intType, V.intTyped(1), V.intTyped(1)) @@ -227,6 +227,10 @@ object TypeCheckerTests extends MorphirBaseSpec { test("Apply arg type wrong"){ val badApply : TypedValue = V.apply(Basics.intType, intToInt, validString) testTypeCheck(badApply)(0) + }, + test("Apply arg type wrong") { + val badApply: TypedValue = V.apply(Basics.boolType, intToInt, V.intTyped(1)) + testTypeCheck(badApply)(0) } ).provideLayerShared(typeCheckerLayer), suite("IfThenElse Tests")( From c35225bfa2661d66e1e3617bead717ff0e715e9a Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 08:08:03 -0700 Subject: [PATCH 110/323] Incremental --- .../org/finos/morphir/runtime/TypeCheckerTests.scala.scala | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala index 7af0e1ee4..29765f1fd 100644 --- a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala +++ b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala @@ -214,7 +214,7 @@ object TypeCheckerTests extends MorphirBaseSpec { unionEnumShape ) val validString : TypedValue = V.string(sdk.String.stringType, "Green") - val invalidString : TypedValue = V.int(1) :> sdk>string.stringType + val invalidInt : TypedValue = V.string("Red") :> sdk.Basics.intType val intToInt : TypedValue = V.reference(T.function(Basics.intType, Basics.intType), FQName.fromString("Morphir/Examples/App:TypeCheckerTests:intToInt")) def spec = @@ -231,6 +231,10 @@ object TypeCheckerTests extends MorphirBaseSpec { test("Apply arg type wrong") { val badApply: TypedValue = V.apply(Basics.boolType, intToInt, V.intTyped(1)) testTypeCheck(badApply)(0) + }, + test("Args are recursively checked"){ + val badApply : TypedValue = V.apply(Basics.intType, intToInt, invalidInt) + testTypeCheck(badApply)(0) } ).provideLayerShared(typeCheckerLayer), suite("IfThenElse Tests")( From 959a46a30158f849a919f11ba976339236168f3c Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 08:08:33 -0700 Subject: [PATCH 111/323] Incremental --- .../src/org/finos/morphir/runtime/MorphirTypeError.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala index 6eb418b42..a5b631a4c 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala @@ -18,7 +18,7 @@ object MorphirTypeError { def succinct[TA, VA](value: Value[TA, VA]): String = Succinct.Value(value) def succinct[TA](tpe: Type[TA]): String = Succinct.Type(tpe) case class TypesMismatch(tpe1: UType, tpe2: UType, msg: String) - extends MorphirTypeError(s"$msg: succinct(tp1)} vs ${succinct(tpe2)}") + extends MorphirTypeError(s"$msg: ${succinct(tp1)} vs ${succinct(tpe2)}") case class ArgumentDoesNotMatchParameter(arg: TypedValue, param: UType) extends MorphirTypeError( s"Argument ${succinct(arg)} of type ${succinct(arg.attributes)} does not match parameter ${succinct(param)}" ) From 0059ab67314446f44d1625b22a0a19f0705ec57f Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 08:13:00 -0700 Subject: [PATCH 112/323] Incremental --- .../finos/morphir/runtime/MorphirTypeError.scala | 2 +- .../morphir/runtime/TypeCheckerTests.scala.scala | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala index a5b631a4c..f057cade3 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala @@ -18,7 +18,7 @@ object MorphirTypeError { def succinct[TA, VA](value: Value[TA, VA]): String = Succinct.Value(value) def succinct[TA](tpe: Type[TA]): String = Succinct.Type(tpe) case class TypesMismatch(tpe1: UType, tpe2: UType, msg: String) - extends MorphirTypeError(s"$msg: ${succinct(tp1)} vs ${succinct(tpe2)}") + extends MorphirTypeError(s"$msg: ${succinct(tpe1)} vs ${succinct(tpe2)}") case class ArgumentDoesNotMatchParameter(arg: TypedValue, param: UType) extends MorphirTypeError( s"Argument ${succinct(arg)} of type ${succinct(arg.attributes)} does not match parameter ${succinct(param)}" ) diff --git a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala index 29765f1fd..df5d502fe 100644 --- a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala +++ b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala @@ -216,26 +216,31 @@ object TypeCheckerTests extends MorphirBaseSpec { val validString : TypedValue = V.string(sdk.String.stringType, "Green") val invalidInt : TypedValue = V.string("Red") :> sdk.Basics.intType val intToInt : TypedValue = V.reference(T.function(Basics.intType, Basics.intType), FQName.fromString("Morphir/Examples/App:TypeCheckerTests:intToInt")) - + val invalidFunction : TypedValue = V.reference(T.function(Basics.intType, Basics.boolType), FQName.fromString("Morphir/Examples/App:TypeCheckerTests:intToInt")) def spec = suite("Type Checker Tests")( suite("Apply Node")( test("Apply to non function") { val badApply: TypedValue = V.apply(Basics.intType, V.intTyped(1), V.intTyped(1)) - testTypeCheck(badApply)(0) + testTypeCheck(badApply)(1) }, test("Apply arg type wrong"){ val badApply : TypedValue = V.apply(Basics.intType, intToInt, validString) - testTypeCheck(badApply)(0) + testTypeCheck(badApply)(1) }, test("Apply arg type wrong") { val badApply: TypedValue = V.apply(Basics.boolType, intToInt, V.intTyped(1)) - testTypeCheck(badApply)(0) + testTypeCheck(badApply)(1) }, test("Args are recursively checked"){ val badApply : TypedValue = V.apply(Basics.intType, intToInt, invalidInt) - testTypeCheck(badApply)(0) + testTypeCheck(badApply)(1) + }, + test("Body is recursively checked"){ + val badApply : TypedValue = V.apply(Basics.boolType, invalidFunction, V.intTyped(2)) + testTypeCheck(badApply)(1) } + //TODO: Body is recursively checked ).provideLayerShared(typeCheckerLayer), suite("IfThenElse Tests")( testEvaluation("True Branch")("ifThenElseTests", "ifThenElseTrueTest")(Data.String("Correct")), From fdd9524d9d7a6dc8619d71deb114791cb592d53d Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 08:14:47 -0700 Subject: [PATCH 113/323] Incremental --- .../runtime/src/org/finos/morphir/runtime/TypeChecker.scala | 5 ++++- .../org/finos/morphir/runtime/TypeCheckerTests.scala.scala | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index b38eb98d2..ec0091a03 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -113,8 +113,11 @@ class TypeChecker(dists: Distributions) { } } def handleLiteral(tpe: UType, literal: Lit, context: Context): TypeCheckerResult = { + import Extractors.Types.* val fromChildren = List() - // TODO: Check lit agrees + (literal, tpe) match { + + } fromChildren } diff --git a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala index df5d502fe..6dcea72d9 100644 --- a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala +++ b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala @@ -234,11 +234,11 @@ object TypeCheckerTests extends MorphirBaseSpec { }, test("Args are recursively checked"){ val badApply : TypedValue = V.apply(Basics.intType, intToInt, invalidInt) - testTypeCheck(badApply)(1) + testTypeCheck(badApply)(2) }, test("Body is recursively checked"){ val badApply : TypedValue = V.apply(Basics.boolType, invalidFunction, V.intTyped(2)) - testTypeCheck(badApply)(1) + testTypeCheck(badApply)(2) } //TODO: Body is recursively checked ).provideLayerShared(typeCheckerLayer), From 1099c8e228b37a13c469c7faf1618c61329cd5bd Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 08:16:02 -0700 Subject: [PATCH 114/323] Incremental --- .../src/org/finos/morphir/runtime/TypeChecker.scala | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index ec0091a03..73b3b1fc0 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -114,9 +114,15 @@ class TypeChecker(dists: Distributions) { } def handleLiteral(tpe: UType, literal: Lit, context: Context): TypeCheckerResult = { import Extractors.Types.* + import Lit.* val fromChildren = List() (literal, tpe) match { - + case StringLiteral(value) => value + case FloatLiteral(value) => value + case CharLiteral(value) => value + case BoolLiteral(value) => value + case WholeNumberLiteral(value) => value + case DecimalLiteral(value) => value } fromChildren } From ba0fbcbf47f81037512b91cb4334228404b81abc Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 08:17:16 -0700 Subject: [PATCH 115/323] Incremental --- .../src/org/finos/morphir/runtime/TypeChecker.scala | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 73b3b1fc0..94b73df62 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -117,11 +117,11 @@ class TypeChecker(dists: Distributions) { import Lit.* val fromChildren = List() (literal, tpe) match { - case StringLiteral(value) => value - case FloatLiteral(value) => value - case CharLiteral(value) => value - case BoolLiteral(value) => value - case WholeNumberLiteral(value) => value + case (StringLiteral(value), StringRef()) => List + case (FloatLiteral(value), FloatRef()) => value + case (CharLiteral(value), CharRef()) => value + case (BoolLiteral(value), BoolRef()) => value + case (WholeNumberLiteral(value), IntRef()) => value case DecimalLiteral(value) => value } fromChildren From c8a8cf21801908655eb34d51f62d445e4dd4cf8f Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 08:17:47 -0700 Subject: [PATCH 116/323] Incremental --- .../runtime/src/org/finos/morphir/runtime/TypeChecker.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 94b73df62..e55f6b13f 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -121,8 +121,8 @@ class TypeChecker(dists: Distributions) { case (FloatLiteral(value), FloatRef()) => value case (CharLiteral(value), CharRef()) => value case (BoolLiteral(value), BoolRef()) => value - case (WholeNumberLiteral(value), IntRef()) => value - case DecimalLiteral(value) => value + case (WholeNumberLiteral(value), IntRef()) => value //TODO: "WholeNumberRef" extractor + case (DecimalLiteral(value), DecimalRef()) => value } fromChildren } From 7e380364f414a2680a0a3b58307afed5926d6f94 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 08:19:21 -0700 Subject: [PATCH 117/323] Incremental --- .../src/org/finos/morphir/runtime/TypeChecker.scala | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index e55f6b13f..75c12ead2 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -117,12 +117,13 @@ class TypeChecker(dists: Distributions) { import Lit.* val fromChildren = List() (literal, tpe) match { - case (StringLiteral(value), StringRef()) => List - case (FloatLiteral(value), FloatRef()) => value - case (CharLiteral(value), CharRef()) => value - case (BoolLiteral(value), BoolRef()) => value - case (WholeNumberLiteral(value), IntRef()) => value //TODO: "WholeNumberRef" extractor - case (DecimalLiteral(value), DecimalRef()) => value + case (StringLiteral(_), StringRef()) => List() + case (FloatLiteral(_), FloatRef()) => List() + case (CharLiteral(_), CharRef()) => List() + case (BoolLiteral(_), BoolRef()) => List() + case (WholeNumberLiteral(_), IntRef()) => List() //TODO: "WholeNumberRef" extractor + case (DecimalLiteral(_), DecimalRef()) => List() + case (otherLit, otherTpe) => } fromChildren } From 462361e50bca6c13a87174acfd62c19de5fc74ea Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 08:21:20 -0700 Subject: [PATCH 118/323] Incremental --- .../finos/morphir/runtime/TypeChecker.scala | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 75c12ead2..6546ece10 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -116,15 +116,17 @@ class TypeChecker(dists: Distributions) { import Extractors.Types.* import Lit.* val fromChildren = List() - (literal, tpe) match { - case (StringLiteral(_), StringRef()) => List() - case (FloatLiteral(_), FloatRef()) => List() - case (CharLiteral(_), CharRef()) => List() - case (BoolLiteral(_), BoolRef()) => List() - case (WholeNumberLiteral(_), IntRef()) => List() //TODO: "WholeNumberRef" extractor - case (DecimalLiteral(_), DecimalRef()) => List() - case (otherLit, otherTpe) => - } + dealias(tpe) match + case Right(tpe) => match { + case (StringLiteral(_), StringRef()) => List() + case (FloatLiteral(_), FloatRef()) => List() + case (CharLiteral(_), CharRef()) => List() + case (BoolLiteral(_), BoolRef()) => List() + case (WholeNumberLiteral(_), IntRef()) => List() //TODO: "WholeNumberRef" extractor + case (DecimalLiteral(_), DecimalRef()) => List() + case (otherLit, otherTpe) => List() + } + case Left(err) => List(err) fromChildren } From 2dc149576ad81bac91069a1e2606eb01533a0dba Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 08:22:40 -0700 Subject: [PATCH 119/323] Incremental --- .../src/org/finos/morphir/runtime/MorphirTypeError.scala | 2 ++ 1 file changed, 2 insertions(+) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala index f057cade3..5f8f02a45 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala @@ -9,6 +9,7 @@ import org.finos.morphir.ir.sdk import org.finos.morphir.ir.sdk.Basics import org.finos.morphir.ir.Field import org.finos.morphir.runtime.exports.* +import org.finos.morphir.ir.Literal.Lit import zio.Chunk abstract class MorphirTypeError(msg: String) extends Exception(msg) { @@ -25,6 +26,7 @@ object MorphirTypeError { case class ApplyToNonFunction(nonFunction: TypedValue, arg: TypedValue) extends MorphirTypeError( s"Tried to apply ${succinct(arg)} to ${succinct(nonFunction)} of type ${succinct(nonFunction.attributes)}, which is not a function" ) + case class LiteralTypeMismatch(lit : Lit, tpe : UType) extends MorphirTypeError(s"Literal $lit is not of type ${succinct(tpe)}") case class ImproperType(tpe: UType, message: String) extends MorphirTypeError("Todo") case class CannotDealias(err: LookupError, msg: String = "Cannot dealias type") extends MorphirTypeError(s"$msg: ${err.getMsg}") From ae5238aeae573146724acc8e9babf83861fad12d Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 08:24:55 -0700 Subject: [PATCH 120/323] Incremental --- .../finos/morphir/runtime/TypeChecker.scala | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 6546ece10..054bc5d4b 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -116,17 +116,18 @@ class TypeChecker(dists: Distributions) { import Extractors.Types.* import Lit.* val fromChildren = List() - dealias(tpe) match - case Right(tpe) => match { - case (StringLiteral(_), StringRef()) => List() - case (FloatLiteral(_), FloatRef()) => List() - case (CharLiteral(_), CharRef()) => List() - case (BoolLiteral(_), BoolRef()) => List() - case (WholeNumberLiteral(_), IntRef()) => List() //TODO: "WholeNumberRef" extractor - case (DecimalLiteral(_), DecimalRef()) => List() - case (otherLit, otherTpe) => List() - } + val matchErrors = dealias(tpe, context) match { + case Right(tpe) =>tpe match { + case (StringLiteral (_), StringRef () ) => List () + case (FloatLiteral (_), FloatRef () ) => List () + case (CharLiteral (_), CharRef () ) => List () + case (BoolLiteral (_), BoolRef () ) => List () + case (WholeNumberLiteral (_), IntRef () ) => List () //TODO: "WholeNumberRef" extractor + case (DecimalLiteral (_), DecimalRef () ) => List () + case (otherLit, otherTpe) => List () + } case Left(err) => List(err) + } fromChildren } From fe4520e6e26146a3ae58ed815fa7967eabd10281 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 08:25:35 -0700 Subject: [PATCH 121/323] Incremental --- .../runtime/src/org/finos/morphir/runtime/TypeChecker.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 054bc5d4b..7994b1ca9 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -116,8 +116,8 @@ class TypeChecker(dists: Distributions) { import Extractors.Types.* import Lit.* val fromChildren = List() - val matchErrors = dealias(tpe, context) match { - case Right(tpe) =>tpe match { + val matchErrors = dealias(tpe) match { + case Right(dealiasedTpe) => (dealisedTpe, context) match { case (StringLiteral (_), StringRef () ) => List () case (FloatLiteral (_), FloatRef () ) => List () case (CharLiteral (_), CharRef () ) => List () From b266002dc838ee869ac0d47261c239862712fe2c Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 08:28:35 -0700 Subject: [PATCH 122/323] Incremental --- .../runtime/src/org/finos/morphir/runtime/TypeChecker.scala | 4 ++-- .../org/finos/morphir/runtime/TypeCheckerTests.scala.scala | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 7994b1ca9..c2a61b190 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -116,8 +116,8 @@ class TypeChecker(dists: Distributions) { import Extractors.Types.* import Lit.* val fromChildren = List() - val matchErrors = dealias(tpe) match { - case Right(dealiasedTpe) => (dealisedTpe, context) match { + val matchErrors = dealias(tpe, context) match { + case Right(dealiasedTpe) => (literal, dealiasedTpe) match { case (StringLiteral (_), StringRef () ) => List () case (FloatLiteral (_), FloatRef () ) => List () case (CharLiteral (_), CharRef () ) => List () diff --git a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala index 6dcea72d9..3e5fc743f 100644 --- a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala +++ b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala @@ -234,11 +234,11 @@ object TypeCheckerTests extends MorphirBaseSpec { }, test("Args are recursively checked"){ val badApply : TypedValue = V.apply(Basics.intType, intToInt, invalidInt) - testTypeCheck(badApply)(2) + testTypeCheck(badApply)(-1) }, test("Body is recursively checked"){ val badApply : TypedValue = V.apply(Basics.boolType, invalidFunction, V.intTyped(2)) - testTypeCheck(badApply)(2) + testTypeCheck(badApply)(-1) } //TODO: Body is recursively checked ).provideLayerShared(typeCheckerLayer), From cea0ee8a5f45bdd77e53a746b8062a65c2d7e345 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 08:35:49 -0700 Subject: [PATCH 123/323] Incremental --- .../morphir/runtime/TypeCheckerTests.scala.scala | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala index 3e5fc743f..90122c62f 100644 --- a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala +++ b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala @@ -93,7 +93,7 @@ object TypeCheckerTests extends MorphirBaseSpec { errors <- runTypeCheck(value) errorMsgs = errors.map(_.getMsg) assert <- if (errors.length == expectedErrors) assertCompletes else assertTrue(errorMsgs == List()) - } yield assert + } yield assertTrue(errorMsgs == List("Unexpected Errors Found")) //TODO: Cleaner "fails" impl def runTypeCheck(value: TypedValue): ZIO[TypeChecker, Throwable, List[MorphirTypeError]] = ZIO.serviceWithZIO[TypeChecker] { checker => ZIO.succeed(checker.check(value)) @@ -242,16 +242,6 @@ object TypeCheckerTests extends MorphirBaseSpec { } //TODO: Body is recursively checked ).provideLayerShared(typeCheckerLayer), - suite("IfThenElse Tests")( - testEvaluation("True Branch")("ifThenElseTests", "ifThenElseTrueTest")(Data.String("Correct")), - testEvaluation("False Branch")("ifThenElseTests", "ifThenElseFalseTest")(Data.String("Correct")), - testEvaluation("Else Unevaluated")("ifThenElseTests", "ifThenElseElseBranchUnevaluatedTest")( - Data.String("Correct") - ), - testEvaluation("Then Unevaluated")("ifThenElseTests", "ifThenElseThenBranchUnevaluatedTest")( - Data.String("Correct") - ) - ), suite("Lambda Tests")( testEvaluation("As")("lambdaTests", "lambdaAsTest")(Data.Tuple(Data.Int(5), Data.Int(5))), testEvaluation("Tuple")("lambdaTests", "lambdaTupleTest")(Data.Tuple(Data.Int(0), Data.Int(1))), From b87180819d5eee33d2536f3bc2ea38228b12dfbd Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 08:37:08 -0700 Subject: [PATCH 124/323] Incremental --- .../org/finos/morphir/runtime/TypeCheckerTests.scala.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala index 90122c62f..10c431f4a 100644 --- a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala +++ b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala @@ -92,8 +92,8 @@ object TypeCheckerTests extends MorphirBaseSpec { for { errors <- runTypeCheck(value) errorMsgs = errors.map(_.getMsg) - assert <- if (errors.length == expectedErrors) assertCompletes else assertTrue(errorMsgs == List()) - } yield assertTrue(errorMsgs == List("Unexpected Errors Found")) //TODO: Cleaner "fails" impl + assert <- if (errors.length == expectedErrors) assertCompletes else assertTrue(errorMsgs == List("Unexpected Errors Found")) + } yield assert//TODO: Cleaner "fails" impl def runTypeCheck(value: TypedValue): ZIO[TypeChecker, Throwable, List[MorphirTypeError]] = ZIO.serviceWithZIO[TypeChecker] { checker => ZIO.succeed(checker.check(value)) From 310d46f66677764e5aeaa9b564cf058648f61959 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 08:38:26 -0700 Subject: [PATCH 125/323] Incremental --- .../org/finos/morphir/runtime/TypeCheckerTests.scala.scala | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala index 10c431f4a..88445f3e4 100644 --- a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala +++ b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala @@ -242,6 +242,11 @@ object TypeCheckerTests extends MorphirBaseSpec { } //TODO: Body is recursively checked ).provideLayerShared(typeCheckerLayer), + suite("Literal Node")( + test("Strings are not ints"){ + testTypeCheck(invalidInt)(0) + } + ).provideLayerShared(typeCheckerLayer), suite("Lambda Tests")( testEvaluation("As")("lambdaTests", "lambdaAsTest")(Data.Tuple(Data.Int(5), Data.Int(5))), testEvaluation("Tuple")("lambdaTests", "lambdaTupleTest")(Data.Tuple(Data.Int(0), Data.Int(1))), From a9c26f7e64e5a1dd9d9c0f7edf368c9501030d9c Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 08:45:31 -0700 Subject: [PATCH 126/323] Incremental --- .../src/org/finos/morphir/runtime/TypeChecker.scala | 4 ++-- .../org/finos/morphir/runtime/TypeCheckerTests.scala.scala | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index c2a61b190..de88a020e 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -124,11 +124,11 @@ class TypeChecker(dists: Distributions) { case (BoolLiteral (_), BoolRef () ) => List () case (WholeNumberLiteral (_), IntRef () ) => List () //TODO: "WholeNumberRef" extractor case (DecimalLiteral (_), DecimalRef () ) => List () - case (otherLit, otherTpe) => List () + case (otherLit, otherTpe) => List (new LiteralTypeMismatch(otherLit, otherTpe)) } case Left(err) => List(err) } - fromChildren + fromChildren ++ matchErrors } def handleApply(tpe: UType, function: TypedValue, argument: TypedValue, context: Context): TypeCheckerResult = { diff --git a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala index 88445f3e4..3fe26ad73 100644 --- a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala +++ b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala @@ -234,7 +234,7 @@ object TypeCheckerTests extends MorphirBaseSpec { }, test("Args are recursively checked"){ val badApply : TypedValue = V.apply(Basics.intType, intToInt, invalidInt) - testTypeCheck(badApply)(-1) + testTypeCheck(badApply)(1) }, test("Body is recursively checked"){ val badApply : TypedValue = V.apply(Basics.boolType, invalidFunction, V.intTyped(2)) @@ -244,7 +244,10 @@ object TypeCheckerTests extends MorphirBaseSpec { ).provideLayerShared(typeCheckerLayer), suite("Literal Node")( test("Strings are not ints"){ - testTypeCheck(invalidInt)(0) + testTypeCheck(invalidInt)(1) + }, + test("ints are not Strings"){ + testTypeCheck(V.int(1) :> sdk.String.stringType)(0) } ).provideLayerShared(typeCheckerLayer), suite("Lambda Tests")( From 664909ed42e4806beb640ee1150b2b0f4fe32a73 Mon Sep 17 00:00:00 2001 From: EdwardPeters Date: Tue, 15 Aug 2023 08:48:05 -0700 Subject: [PATCH 127/323] Test file cleanup --- .../runtime/TypeCheckerTests.scala.scala | 515 +----------------- 1 file changed, 23 insertions(+), 492 deletions(-) diff --git a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala index 3fe26ad73..a4b78b93a 100644 --- a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala +++ b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala @@ -31,192 +31,29 @@ object TypeCheckerTests extends MorphirBaseSpec { _ <- Console.printLine(s"Loading distribution from $irFilePath") dist <- EvaluationLibrary.loadDistributionFromFileZIO(irFilePath.toString) } yield TypeChecker(Distributions(dist))) - val localDate = java.time.LocalDate.of(1900, 1, 20) - val localTime = java.time.LocalTime.of(10, 43, 26) - def deriveData(input: Any): Data = - input match { - case u: Unit => Deriver.toData(u) - case i: Int => Deriver.toData(i) - case s: String => Deriver.toData(s) - case ld: java.time.LocalDate => Deriver.toData(ld) - case lt: java.time.LocalTime => Deriver.toData(lt) - case Right(i: Int) => Data.Result.Ok(Data.Int(i), resultBoolIntShape) - case Left(b: Boolean) => Data.Result.Err(Data.Boolean(b), resultBoolIntShape) - case (i: Int, s: String) => Data.Tuple(Deriver.toData(i), Deriver.toData(s)) - case other => throw new Exception(s"Couldn't derive $other") - } - - def checkEvaluation( - moduleName: String, - functionName: String - )(expected: => Data): ZIO[MorphirRuntimeTyped, Throwable, TestResult] = - runTest(moduleName, functionName).map { actual => - assertTrue(actual == expected) - } - - def checkEvaluation( - moduleName: String, - functionName: String, - value: Any - )(expected: => Data): ZIO[MorphirRuntimeTyped, Throwable, TestResult] = - runTest(moduleName, functionName, value).map { actual => - assertTrue(actual == expected) - } - - def testEvaluation(label: String)(moduleName: String, functionName: String)(expected: => Data) = - test(label) { - checkEvaluation(moduleName, functionName)(expected) - } - - def testEval(label: String)(moduleName: String, functionName: String, value: Any)(expected: => Data) = - test(label) { - checkEvaluation(moduleName, functionName, value)(expected) - } - def runTest(moduleName: String, functionName: String): ZIO[MorphirRuntimeTyped, Throwable, Data] = - runTest(moduleName, functionName, ()) - def runTest( - moduleName: String, - functionName: String, - value: Any - ): ZIO[MorphirRuntimeTyped, Throwable, Data] = - ZIO.serviceWithZIO[MorphirRuntimeTyped] { runtime => - val fullName = s"Morphir.Examples.App:$moduleName:$functionName" - val data = deriveData(value) - - runtime.evaluate(FQName.fromString(fullName), data) - .provideEnvironment(MorphirEnv.live) - .toZIOWith(RTExecutionContext.default) - } def testTypeCheck(value: TypedValue)(expectedErrors: Int): ZIO[TypeChecker, Throwable, TestResult] = for { errors <- runTypeCheck(value) errorMsgs = errors.map(_.getMsg) - assert <- if (errors.length == expectedErrors) assertCompletes else assertTrue(errorMsgs == List("Unexpected Errors Found")) - } yield assert//TODO: Cleaner "fails" impl + assert <- if (errors.length == expectedErrors) assertCompletes + else assertTrue(errorMsgs == List("Unexpected Errors Found")) + } yield assert // TODO: Cleaner "fails" impl def runTypeCheck(value: TypedValue): ZIO[TypeChecker, Throwable, List[MorphirTypeError]] = ZIO.serviceWithZIO[TypeChecker] { checker => ZIO.succeed(checker.check(value)) } - val dogRecordConceptRaw = Concept.Struct( - List( - (Label("name"), Concept.String), - (Label("number"), Concept.Int32) - ) - ) - def dogRecordData(name: String, number: Int) = Data.Record( - qn"Morphir/Examples/App:RecordTests:RecordType", - (Label("name"), Data.String(name)), - (Label("number"), Data.Int32(number)) - ) -// val dogRecordConcept = Concept.Alias( -// qn"Morphir/Examples/App:RecordTests:RecordType", -// dogRecordConceptRaw -// ) -// def dogRecordData(name: String, number: Int) = Data.Aliased( -// dogRecordDataRaw(name, number), -// dogRecordConcept -// ) - - def resultStringIntShape = Concept.Result(Concept.String, Concept.Int32) - - def resultBoolIntShape = Concept.Result(Concept.Boolean, Concept.Int32) - def unionEnumShape: Concept.Enum = Concept.Enum( - qn"Morphir/Examples/App:ConstructorTests:UnionType", - List( - Concept.Enum.Case( - Label("OneArg"), - List( - (EnumLabel.Named("arg1"), Concept.Int32) - ) - ), - Concept.Enum.Case( - Label("TwoArg"), - List( - (EnumLabel.Named("arg1"), Concept.Int32), - (EnumLabel.Named("arg2"), Concept.String) - ) - ), - Concept.Enum.Case( - Label("ZeroArg"), - List() - ) - ) - ) - - def typeArgUnionShape(c1: Concept, c2: Concept): Concept.Enum = Concept.Enum( - qn"Morphir/Examples/App:ExampleModule:TypeArgUnion", - List( - Concept.Enum.Case( - Label("B"), - List(Tuple2( - EnumLabel.Named("arg1"), - c2 - )) - ), - Concept.Enum.Case( - Label("AB"), - List( - ( - EnumLabel.Named("arg1"), - c1 - ), - ( - EnumLabel.Named("arg2"), - c2 - ) - ) - ), - Concept.Enum.Case( - Label("A"), - List(( - EnumLabel.Named("arg1"), - c1 - )) - ), - Concept.Enum.Case( - Label("DictBA"), - List(( - EnumLabel.Named("arg1"), - Concept.Map( - c2, - c1 - ) - )) - ), - Concept.Enum.Case( - Label("MaybeA"), - List(( - EnumLabel.Named("arg1"), - Concept.Optional(c1) - )) - ) - ) - ) - - val zeroArg: Data = Data.Case( - List(), - "ZeroArg", - unionEnumShape - ) - def oneArg(i: Int): Data = Data.Case( - List((EnumLabel.Named("arg1"), Data.Int(i))), - "OneArg", - unionEnumShape + val validString: TypedValue = V.string(sdk.String.stringType, "Green") + val invalidInt: TypedValue = V.string("Red") :> sdk.Basics.intType + val intToInt: TypedValue = V.reference( + T.function(Basics.intType, Basics.intType), + FQName.fromString("Morphir/Examples/App:TypeCheckerTests:intToInt") ) - def twoArg(i: Int, s: String): Data = Data.Case( - List( - (EnumLabel.Named("arg1"), Data.Int(i)), - (EnumLabel.Named("arg2"), Data.String(s)) - ), - "TwoArg", - unionEnumShape + val invalidFunction: TypedValue = V.reference( + T.function(Basics.intType, Basics.boolType), + FQName.fromString("Morphir/Examples/App:TypeCheckerTests:intToInt") ) - val validString : TypedValue = V.string(sdk.String.stringType, "Green") - val invalidInt : TypedValue = V.string("Red") :> sdk.Basics.intType - val intToInt : TypedValue = V.reference(T.function(Basics.intType, Basics.intType), FQName.fromString("Morphir/Examples/App:TypeCheckerTests:intToInt")) - val invalidFunction : TypedValue = V.reference(T.function(Basics.intType, Basics.boolType), FQName.fromString("Morphir/Examples/App:TypeCheckerTests:intToInt")) def spec = suite("Type Checker Tests")( suite("Apply Node")( @@ -224,338 +61,32 @@ object TypeCheckerTests extends MorphirBaseSpec { val badApply: TypedValue = V.apply(Basics.intType, V.intTyped(1), V.intTyped(1)) testTypeCheck(badApply)(1) }, - test("Apply arg type wrong"){ - val badApply : TypedValue = V.apply(Basics.intType, intToInt, validString) + test("Apply arg type wrong") { + val badApply: TypedValue = V.apply(Basics.intType, intToInt, validString) testTypeCheck(badApply)(1) }, test("Apply arg type wrong") { val badApply: TypedValue = V.apply(Basics.boolType, intToInt, V.intTyped(1)) testTypeCheck(badApply)(1) }, - test("Args are recursively checked"){ - val badApply : TypedValue = V.apply(Basics.intType, intToInt, invalidInt) + test("Args are recursively checked") { + val badApply: TypedValue = V.apply(Basics.intType, intToInt, invalidInt) testTypeCheck(badApply)(1) }, - test("Body is recursively checked"){ - val badApply : TypedValue = V.apply(Basics.boolType, invalidFunction, V.intTyped(2)) + test("Body is recursively checked") { + val badApply: TypedValue = V.apply(Basics.boolType, invalidFunction, V.intTyped(2)) testTypeCheck(badApply)(-1) } - //TODO: Body is recursively checked - ).provideLayerShared(typeCheckerLayer), + // TODO: Body is recursively checked + ), suite("Literal Node")( - test("Strings are not ints"){ + test("Strings are not ints") { testTypeCheck(invalidInt)(1) }, - test("ints are not Strings"){ + test("ints are not Strings") { testTypeCheck(V.int(1) :> sdk.String.stringType)(0) } - ).provideLayerShared(typeCheckerLayer), - suite("Lambda Tests")( - testEvaluation("As")("lambdaTests", "lambdaAsTest")(Data.Tuple(Data.Int(5), Data.Int(5))), - testEvaluation("Tuple")("lambdaTests", "lambdaTupleTest")(Data.Tuple(Data.Int(0), Data.Int(1))), - testEvaluation("Constructor")("lambdaTests", "lambdaConstructorTest")(Data.Tuple( - Data.String("Red"), - Data.Int(5) - )), - testEvaluation("Unit")("lambdaTests", "lambdaUnitTest")(Data.String("Correct")), - testEvaluation("Directly Nested")("lambdaTests", "lambdaDirectTest")(Data.Tuple(Data.Int(0), Data.Int(1))), - testEvaluation("Scope")("lambdaTests", "lambdaScopeTest")(Data.Tuple( - Data.Int(3), - Data.Tuple(Data.Int(4), Data.Int(5)) - )), - testEvaluation("Higher Order")("lambdaTests", "lambdaHigherOrderTest")(Data.Tuple( - Data.Int(3), - Data.Int(4), - Data.Int(5) - )), - testEvaluation("User Defined Constructor")("lambdaTests", "lambdaUserDefinedTest")(Data.Tuple( - Data.Int(5), - Data.String("Red") - )) - ), - suite("Let Definition")( - testEvaluation("Make Tuple")("letDefinitionTests", "letDefinitionMakeTupleTest")(Data.Tuple( - Data.Int(1), - Data.Int(1) - )), - testEvaluation("Nested")("letDefinitionTests", "letDefinitionNestedTest")(Data.Tuple(Data.Int(2), Data.Int(2))), - testEvaluation("Simple Function")("letDefinitionTests", "letDefinitionSimpleFunctionTest")(Data.Tuple( - Data.Int(3), - Data.Int(3) - )), - testEvaluation("Two Argument Function")("letDefinitionTests", "letDefinitionTwoArgFunctionFunctionTest")( - Data.Tuple( - Data.Int(3), - Data.Int(2) - ) - ), - testEvaluation("Curried Function")("letDefinitionTests", "letDefinitionCurriedTest")(Data.Tuple( - Data.Int(2), - Data.Int(0) - )), - testEvaluation("Apply Twice")("letDefinitionTests", "letDefinitionApplyTwiceTest")(Data.Tuple( - Data.Tuple(Data.Int(1), Data.Int(0)), - Data.Tuple(Data.Int(2), Data.Int(0)) - )), - testEvaluation("Only runs if applied")("letDefinitionTests", "letDefinitionDoNotRunTest")( - Data.String("Correct") - ), - testEvaluation("Lexical scope")("letDefinitionTests", "letDefinitionScopeTest")(Data.Tuple( - Data.Int(3), - Data.Tuple(Data.Int(4), Data.Int(5)) - )) - ), - suite("Let Recursion")( - testEvaluation("Fibbonacci")("letRecursionTests", "letRecursionFibonacciTest")(Data.Int(34)), - testEvaluation("Mutual Recursion")("letRecursionTests", "letRecursionMutualTest")(Data.Tuple( - Data.Int(8), - Data.Int(9) - )) - ), - suite("Lists")( - testEvaluation("Empty")("listTests", "listEmptyTest")(Data.List(List(), Concept.Int32)), - testEvaluation("Single")("listTests", "listSingleTest")(Data.List(Data.Int(0))), - testEvaluation("Several")("listTests", "listSeveralTest")(Data.List( - Data.Int(0), - Data.Int(1), - Data.Int(2), - Data.Int(3), - Data.Int(4), - Data.Int(5) - )), - testEvaluation("Nested")("listTests", "listNestedTest")(Data.List( - Data.List(Data.String("Red"), Data.String("Blue")), - Data.List(List(), Concept.String), - Data.List(Data.String("Car"), Data.String("Plane"), Data.String("Truck")) - )), - testEvaluation("Concat")("listTests", "listConcatTest")(Data.List( - Data.Int(1), - Data.Int(2), - Data.Int(3), - Data.Int(4), - Data.Int(5) - )), - testEvaluation("Flatten")("listTests", "listFlattenTest")(Data.List( - Data.String("Red"), - Data.String("Blue"), - Data.String("Car"), - Data.String("Plane"), - Data.String("Truck") - )), - testEvaluation("Map")("listTests", "listMapTest")(Data.List( - Data.Decimal(3.0), - Data.Decimal(4.0), - Data.Decimal(5.0) - )), - testEvaluation("Singleton")("listTests", "listSingletonTest")( - Data.List(Data.Int(6)) - ) @@ ignore @@ TestAspect.tag("Not Implemented yet") - ), - suite("Literals")( - testEvaluation("String")("literalTests", "litStringTest")(Data.String("Bloop")), - testEvaluation("Float")("literalTests", "litFloatTest")(Data.Decimal(scala.BigDecimal("5.0"))), - testEvaluation("Char")("literalTests", "litCharTest")(Data.Char('f')), - testEvaluation("Boolean")("literalTests", "litBoolTest")(Data.Boolean(true)), - testEvaluation("Whole Number")("literalTests", "litWholeNumberLiteralTest")(Data.Int(5)) - ), - suite("LocalDate")( - // TODO: Need to fix implementation of Optional LocalDate - testEvaluation("fromParts")("localDateTests", "fromPartsTest")( - Data.Optional.Some(Data.LocalDate(localDate)) - ) @@ ignore @@ TestAspect.tag("Not Implemented yet") - ), - suite("LocalTime")( - testEvaluation("fromMilliseconds")("localTimeTests", "fromMillisecondsTest")(Data.LocalTime(localTime)) - ), - suite("Native References")( - testEvaluation("Map")("nativeReferenceTests", "nativeReferenceMapTest")(Data.List( - Data.Tuple(Data.Int(1), Data.Int(1)), - Data.Tuple(Data.Int(2), Data.Int(2)), - Data.Tuple(Data.Int(3), Data.Int(3)) - )), - testEvaluation("Add")("nativeReferenceTests", "nativeReferenceAddTest")(Data.Int(3)), -// test("Curried Log") { -// val actual = runTest("nativeReferenceTests", "nativeReferenceCurriedLogTest") -// val expected = Double.PositiveInfinity -// assertTrue(actual == expected) -// }, //No DDL equivalent - testEvaluation("Pi")("nativeReferenceTests", "nativeReferencePiTest")(Data.Decimal(scala.BigDecimal("3"))), - testEval("ModBy")("nativeReferenceTests", "nativeReferenceModByTest", 7)( - Data.Int(1) - ) /* @@ TestAspect.ignore @@ TestAspect.tag("ignore until we complete wiring up native functions")*/ - ), - suite("Morphir Types")( - testEval("LocalDate")("nativeReferenceTests", "localDatePassthrough", localDate)(Data.LocalDate(localDate)), - testEval("LocalDate")("nativeReferenceTests", "localTimePassthrough", localTime)(Data.LocalTime(localTime)) - ), - suite("Patern Matching")( - testEvaluation("Wildcard")("patternMatchTests", "patternMatchWildcardTest")(Data.String("Correct")), - testEvaluation("Tuple")("patternMatchTests", "patternMatchTupleTest")(Data.String("Correct")), - testEvaluation("Constructor")("patternMatchTests", "patternMatchConstructorTest")(Data.String("Correct")), - testEvaluation("Zero Arg Constructor")("patternMatchTests", "patternMatchEmptyListTest")( - Data.String("Correct") - ), - testEvaluation("Head Tail")("patternMatchTests", "patternMatchHeadTailTest")(Data.Tuple( - Data.String("Dog"), - Data.String("Red") - )), - testEvaluation("Literal")("patternMatchTests", "patternMatchLiteralTest")(Data.String("Correct")), - testEvaluation("Repeated As")("patternMatchTests", "patternMatchRepeatedAsTest")(Data.Tuple( - Data.Int(2), - Data.Tuple(Data.Int(1), Data.Int(2)) - )) - ), - suite("Records")( - testEvaluation("Field")("recordTests", "recordFieldTest")(Data.String("Correct")), - testEvaluation("Field from Bound Record")("recordTests", "recordFieldFromBoundTest")(Data.String("Correct")), - testEvaluation("Field Function Apply")("recordTests", "fieldFunctionApplyTest")(Data.String("Correct")), - testEvaluation("Field Function Apply Twice")("recordTests", "fieldFunctionApplyTwiceTest")(Data.Tuple( - Data.Int(1), - Data.Int(2) - )), - testEvaluation("Field")("recordTests", "fieldFunctionMapTest")(Data.List( - Data.String("Soso"), - Data.String("Ponyo"), - Data.String("Odin") - )), - testEvaluation("Simple Record")("recordTests", "recordSimpleTest")(dogRecordData("Fido", 5)), - testEvaluation("Nested Record")("recordTests", "recordNestedTest")(Data.Record( - qn"Morphir/Examples/App:RecordTests:NestedRecordType", - (Label("name"), Data.String("Dogs")), - ( - Label("records"), - Data.List( - dogRecordData("Ponyo", 3), - dogRecordData("Soso", 3) - ) - ) - )), - testEvaluation("Record Update Single Field")("recordTests", "updateRecordSimpleTest")(Data.String("Soso")), - testEvaluation("Record Update Full")("recordTests", "updateRecordFullTest")(dogRecordData("Soso", 5)), - testEvaluation("Record Updates are not mutation")("recordTests", "updateRecordImmutableTest")( - Data.List( - dogRecordData("Soso", 4), - dogRecordData("Ponyo", 5) - ) - ) - ), - suite("Simple")( - testEvaluation("Unit")("simpleTests", "simpleUnitTest")(Data.Unit) - ), - suite("Simple[Tuple]")( - testEvaluation("Tuple(2)")("tupleTests", "tupleTwoTest")(Data.Tuple(List(Data.Int(5), Data.Int(4)))), - testEvaluation("Tuple(3)")("tupleTests", "tupleThreeTest")(Data.Tuple( - Data.Int(0), - Data.Boolean(true), - Data.String("Green") - )), - testEvaluation("Nested Tuple")("tupleTests", "tupleNestedTest")(Data.Tuple( - Data.Int(5), - Data.Tuple( - Data.String("Four"), - Data.Tuple(Data.Int(4), Data.String("Five")) - ) - )) - ), - suite("References To user Defined Members")( - testEvaluation("Reference to value")("userDefinedReferenceTests", "userDefinedReferenceValueTest")(Data.Int(5)), - testEvaluation("Curried Function Application")("userDefinedReferenceTests", "userDefinedReferenceCurriedTest")( - Data.String("Correct") - ), - testEvaluation("Simple Function Application")( - "userDefinedReferenceTests", - "userDefinedReferenceSimpleFunctionTest" - )(Data.Tuple(List( - Data.Int(1), - Data.Int(2) - ))), - testEvaluation("Calling public function which calls private function")( - "userDefinedReferenceTests", - "userDefinedReferencePublicPrivateTest" - )(Data.Int(10)), - testEvaluation("Reference to Record")("userDefinedReferenceTests", "userDefinedReferenceRecordTest")( - Data.String("Tom Tit Tot") - ), - testEvaluation("Reference to Union Type")("userDefinedReferenceTests", "userDefinedReferenceUnionTest")( - Data.Int(-6) - ), - testEval("Reference to Union with type args")( - "userDefinedReferenceTests", - "typeArgUnionTest", - (1, "Red") - )(Data.Case( - List( - (EnumLabel.Named("arg1"), Data.Int(1)), - (EnumLabel.Named("arg2"), Data.String("Red")) - ), - "Morphir.Examples.App:ExampleModule:aB", - typeArgUnionShape(Concept.Int32, Concept.String) - )) @@ ignore @@ tag("Failing because of non-matching order of union cases") - ), - suite("Dictionary Tests")( - testEvaluation("Returns a dictionary")("dictionaryTests", "returnDictionaryTest")(Data.Map( - (Data.Int(1), Data.String("Red")), - (Data.Int(2), Data.String("Blue")) - )), - testEvaluation("Get")("dictionaryTests", "dictGetTest")(Data.Optional.Some(Data.String("Cat"))) - ), - suite("Optional Tests")( - testEvaluation("Returns a Just 1")("optionTests", "returnJustIntTest")(Data.Optional.Some(Data.Int(1))), - testEvaluation("Option String")("optionTests", "returnJustStringTest")( - Data.Optional.Some(Data.String("Hello")) - ), - testEvaluation("Returns a None")("optionTests", "returnNoneIntTest")(Data.Optional.None(Concept.Int32)), - testEval("Returns success result")("optionTests", "returnResultType", 0)(Data.Result.Ok( - Data.Int(0), - resultStringIntShape - )), - testEval("Returns error result")("optionTests", "returnResultType", -1)(Data.Result.Err( - Data.String("Negative"), - resultStringIntShape - )), - testEval("Resolves success input")("optionTests", "resolveResultType", Right(5))(Data.Int(5)), - testEval("Resolves error input")("optionTests", "resolveResultType", Left(true))(Data.Int(1)) - ), - suite("SDK Basics Tests")( - testEvaluation("Plus")("sdkBasicsTests", "sdkAddTest")(Data.Int(3)), - testEvaluation("Minus")("sdkBasicsTests", "sdkSubtractTest")(Data.Int(2)), - testEvaluation("Divide")("sdkBasicsTests", "sdkDivideTest")(Data.Decimal(2.0)), - testEvaluation("ModBy")("sdkBasicsTests", "sdkModByTest")(Data.Int(2)), - testEvaluation("And")("sdkBasicsTests", "sdkAndTest")(Data.Boolean(false)), - testEvaluation("LessThanInt")("sdkBasicsTests", "sdkLessThanTestInt")(Data.Boolean(true)), - testEvaluation("ToFloat")("sdkBasicsTests", "toFloatTest")(Data.Decimal(2.0)), - testEvaluation("Negate")("sdkBasicsTests", "sdkNegateTest")(Data.Int(-3)), - testEvaluation("Negate")("sdkBasicsTests", "sdkNegateTest2")(Data.Int(3)), - testEvaluation("Equal")("sdkBasicsTests", "sdkEqualTest")(Data.Boolean(true)), - testEvaluation("Equal")("sdkBasicsTests", "sdkEqualTest2")(Data.Boolean(true)), - testEvaluation("Equal")("sdkBasicsTests", "sdkEqualTest3")(Data.Boolean(true)), - testEvaluation("Equal")("sdkBasicsTests", "sdkEqualTest4")(Data.Boolean(true)), - testEvaluation("Equal")("sdkBasicsTests", "sdkEqualTest5")(Data.Boolean(true)), - testEvaluation("Equal")("sdkBasicsTests", "sdkEqualTest6")(Data.Boolean(true)), - testEvaluation("Equal")("sdkBasicsTests", "sdkEqualTest7")(Data.Boolean(true)), - testEvaluation("Or")("sdkBasicsTests", "sdkOrTest")(Data.Boolean(true)), - testEvaluation("LogBase")("sdkBasicsTests", "sdkLogBaseTest")(Data.Decimal(2.0)), - testEvaluation("Plus overflow")("sdkBasicsTests", "sdkIntOverflowTest")( - Data.Int(3) - ) @@ ignore @@ TestAspect.tag("Not Implemented yet"), - testEvaluation("Plus Float")("sdkBasicsTests", "sdkAddFloatTest")( - Data.Decimal(3.0) - ) @@ ignore @@ TestAspect.tag("Not Implemented yet"), - testEvaluation("Multiply")("sdkBasicsTests", "sdkMultiplyTest")(Data.Int(6)) @@ ignore @@ TestAspect.tag( - "Not Implemented yet" - ), - testEvaluation("Integer Divide")("sdkBasicsTests", "sdkIntegerDivideTest")( - Data.Decimal(2.0) - ) @@ ignore @@ TestAspect.tag("Not Implemented yet"), - testEvaluation("Divide by 0")("sdkBasicsTests", "sdkDivideByZeroTest")( - Data.Decimal(2.0) - ) @@ ignore @@ TestAspect.tag("Not Implemented yet"), - testEvaluation("LessThanFloat")("sdkBasicsTests", "sdkLessThanTestFloat")( - Data.Boolean(true) - ) @@ ignore @@ TestAspect.tag("Not Implemented yet"), - testEvaluation("LessThanChar")("sdkBasicsTests", "sdkLessThanTestChar")( - Data.Boolean(true) - ) @@ ignore @@ TestAspect.tag("Not Implemented yet") + // TODO: Other lit tests ) - ).provideLayerShared(morphirRuntimeLayer) + ).provideLayerShared(typeCheckerLayer) } From 6da75fc4d33124dfa9f8da552a1b4a56b5caf1c6 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 08:58:17 -0700 Subject: [PATCH 128/323] Incremental --- .../finos/morphir/runtime/TypeCheckerTests.scala.scala | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala index a4b78b93a..578114c1d 100644 --- a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala +++ b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala @@ -83,8 +83,14 @@ object TypeCheckerTests extends MorphirBaseSpec { test("Strings are not ints") { testTypeCheck(invalidInt)(1) }, - test("ints are not Strings") { + test("Ints are not Strings") { testTypeCheck(V.int(1) :> sdk.String.stringType)(0) + }, + test("Ints are not Floats") { + testTypeCheck(V.int(1) :> sdk.Basics.floatType)(0) + }, + test("Bools are not Floats") { + testTypeCheck(V.bool(true) :> sdk.Basics.floatType)(0) } // TODO: Other lit tests ) From f95898848df83501501d0b1a33b6339f4e17bfdc Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 09:02:12 -0700 Subject: [PATCH 129/323] Incremental --- .../morphir/runtime/TypeCheckerTests.scala.scala | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala index 578114c1d..6f606203a 100644 --- a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala +++ b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala @@ -35,9 +35,9 @@ object TypeCheckerTests extends MorphirBaseSpec { def testTypeCheck(value: TypedValue)(expectedErrors: Int): ZIO[TypeChecker, Throwable, TestResult] = for { errors <- runTypeCheck(value) - errorMsgs = errors.map(_.getMsg) + errorMsgs = errors.map(s"\n\t${_.getMsg"}) assert <- if (errors.length == expectedErrors) assertCompletes - else assertTrue(errorMsgs == List("Unexpected Errors Found")) + else assertTrue(errorMsgs == s"Expected $expectedErrors errors") } yield assert // TODO: Cleaner "fails" impl def runTypeCheck(value: TypedValue): ZIO[TypeChecker, Throwable, List[MorphirTypeError]] = ZIO.serviceWithZIO[TypeChecker] { checker => @@ -65,7 +65,7 @@ object TypeCheckerTests extends MorphirBaseSpec { val badApply: TypedValue = V.apply(Basics.intType, intToInt, validString) testTypeCheck(badApply)(1) }, - test("Apply arg type wrong") { + test("Apply return type wrong") { val badApply: TypedValue = V.apply(Basics.boolType, intToInt, V.intTyped(1)) testTypeCheck(badApply)(1) }, @@ -80,17 +80,17 @@ object TypeCheckerTests extends MorphirBaseSpec { // TODO: Body is recursively checked ), suite("Literal Node")( - test("Strings are not ints") { + test("Strings are not Ints") { testTypeCheck(invalidInt)(1) }, test("Ints are not Strings") { - testTypeCheck(V.int(1) :> sdk.String.stringType)(0) + testTypeCheck(V.int(1) :> sdk.String.stringType)(1) }, test("Ints are not Floats") { - testTypeCheck(V.int(1) :> sdk.Basics.floatType)(0) + testTypeCheck(V.int(1) :> sdk.Basics.floatType)(1) }, test("Bools are not Floats") { - testTypeCheck(V.bool(true) :> sdk.Basics.floatType)(0) + testTypeCheck(V.boolean(true) :> sdk.Basics.floatType)(1) } // TODO: Other lit tests ) From 848d41752e94967d6f7cbd07bf65ede4731847c7 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 09:05:26 -0700 Subject: [PATCH 130/323] Incremental --- .../finos/morphir/runtime/TypeChecker.scala | 49 ++++++++++--------- 1 file changed, 27 insertions(+), 22 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index de88a020e..504bd7276 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -88,29 +88,34 @@ class TypeChecker(dists: Distributions) { def check(suspect: TypedValue, parentContext: Context): TypeCheckerResult = { import Value.{Unit as UnitValue, List as ListValue, Field as FieldValue, *} val context = parentContext.withDepth(parentContext.depth + 1) - suspect match { - case Literal(tpe, lit) => handleLiteral(tpe, lit, context) - case Apply(tpe, function, argument) => handleApply(tpe, function, argument, context) - case Destructure(tpe, pattern, valueToDestruct, inValue) => - handleDestructure(tpe, pattern, valueToDestruct, inValue, context) - case Constructor(tpe, name) => handleConstructor(tpe, name, context) - case FieldValue(tpe, recordValue, name) => handleFieldValue(tpe, recordValue, name, context) - case FieldFunction(tpe, name) => handleFieldFunction(tpe, name, context) - case IfThenElse(tpe, condition, thenValue, elseValue) => - handleIfThenElse(tpe, condition, thenValue, elseValue, context) - case Lambda(tpe, pattern, body) => handleLambda(tpe, pattern, body, context) - case LetDefinition(tpe, name, definition, inValue) => - handleLetDefinition(tpe, name, definition, inValue, context) - case LetRecursion(tpe, definitions, inValue) => handleLetRecursion(tpe, definitions, inValue, context) - case ListValue(tpe, elements) => handleListValue(tpe, elements.toList, context) - case PatternMatch(tpe, value, cases) => handlePatternMatch(tpe, value, cases.toList, context) - case Record(tpe, fields) => handleRecord(tpe, fields.toList, context) - case Reference(tpe, name) => handleReference(tpe, name, context) - case Tuple(tpe, elements) => handleTuple(tpe, elements.toList, context) - case UnitValue(va) => handleUnitValue(va, context) - case UpdateRecord(tpe, valueToUpdate, fields) => handleUpdateRecord(tpe, valueToUpdate, fields, context) - case Variable(tpe, name) => handleVariable(tpe, name, context) + dealias(suspect.attributes) match{ + case Right(tpe) => suspect match { + case Literal(_, lit) => handleLiteral(tpe, lit, context) + case Apply(tpe, function, argument) => handleApply(tpe, function, argument, context) + case Destructure(tpe, pattern, valueToDestruct, inValue) => + handleDestructure(tpe, pattern, valueToDestruct, inValue, context) + case Constructor(tpe, name) => handleConstructor(tpe, name, context) + case FieldValue(tpe, recordValue, name) => handleFieldValue(tpe, recordValue, name, context) + case FieldFunction(tpe, name) => handleFieldFunction(tpe, name, context) + case IfThenElse(tpe, condition, thenValue, elseValue) => + handleIfThenElse(tpe, condition, thenValue, elseValue, context) + case Lambda(tpe, pattern, body) => handleLambda(tpe, pattern, body, context) + case LetDefinition(tpe, name, definition, inValue) => + handleLetDefinition(tpe, name, definition, inValue, context) + case LetRecursion(tpe, definitions, inValue) => handleLetRecursion(tpe, definitions, inValue, context) + case ListValue(tpe, elements) => handleListValue(tpe, elements.toList, context) + case PatternMatch(tpe, value, cases) => handlePatternMatch(tpe, value, cases.toList, context) + case Record(tpe, fields) => handleRecord(tpe, fields.toList, context) + case Reference(tpe, name) => handleReference(tpe, name, context) + case Tuple(tpe, elements) => handleTuple(tpe, elements.toList, context) + case UnitValue(va) => handleUnitValue(va, context) + case UpdateRecord(tpe, valueToUpdate, fields) => handleUpdateRecord(tpe, valueToUpdate, fields, context) + case Variable(tpe, name) => handleVariable(tpe, name, context) + } + case Left(err) => List(er) } + + } def handleLiteral(tpe: UType, literal: Lit, context: Context): TypeCheckerResult = { import Extractors.Types.* From 611a4560c7caee206c44ad06bd07c09cc807f96a Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 09:07:52 -0700 Subject: [PATCH 131/323] Incremental --- .../finos/morphir/runtime/TypeChecker.scala | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 504bd7276..180a5ba8e 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -91,28 +91,28 @@ class TypeChecker(dists: Distributions) { dealias(suspect.attributes) match{ case Right(tpe) => suspect match { case Literal(_, lit) => handleLiteral(tpe, lit, context) - case Apply(tpe, function, argument) => handleApply(tpe, function, argument, context) - case Destructure(tpe, pattern, valueToDestruct, inValue) => + case Apply(_, function, argument) => handleApply(tpe, function, argument, context) + case Destructure(_, pattern, valueToDestruct, inValue) => handleDestructure(tpe, pattern, valueToDestruct, inValue, context) - case Constructor(tpe, name) => handleConstructor(tpe, name, context) - case FieldValue(tpe, recordValue, name) => handleFieldValue(tpe, recordValue, name, context) - case FieldFunction(tpe, name) => handleFieldFunction(tpe, name, context) - case IfThenElse(tpe, condition, thenValue, elseValue) => + case Constructor(_, name) => handleConstructor(tpe, name, context) + case FieldValue(_, recordValue, name) => handleFieldValue(tpe, recordValue, name, context) + case FieldFunction(_, name) => handleFieldFunction(tpe, name, context) + case IfThenElse(_, condition, thenValue, elseValue) => handleIfThenElse(tpe, condition, thenValue, elseValue, context) - case Lambda(tpe, pattern, body) => handleLambda(tpe, pattern, body, context) - case LetDefinition(tpe, name, definition, inValue) => + case Lambda(_, pattern, body) => handleLambda(tpe, pattern, body, context) + case LetDefinition(_, name, definition, inValue) => handleLetDefinition(tpe, name, definition, inValue, context) - case LetRecursion(tpe, definitions, inValue) => handleLetRecursion(tpe, definitions, inValue, context) - case ListValue(tpe, elements) => handleListValue(tpe, elements.toList, context) - case PatternMatch(tpe, value, cases) => handlePatternMatch(tpe, value, cases.toList, context) - case Record(tpe, fields) => handleRecord(tpe, fields.toList, context) - case Reference(tpe, name) => handleReference(tpe, name, context) - case Tuple(tpe, elements) => handleTuple(tpe, elements.toList, context) - case UnitValue(va) => handleUnitValue(va, context) - case UpdateRecord(tpe, valueToUpdate, fields) => handleUpdateRecord(tpe, valueToUpdate, fields, context) - case Variable(tpe, name) => handleVariable(tpe, name, context) + case LetRecursion(_, definitions, inValue) => handleLetRecursion(tpe, definitions, inValue, context) + case ListValue(_, elements) => handleListValue(tpe, elements.toList, context) + case PatternMatch(_, value, cases) => handlePatternMatch(tpe, value, cases.toList, context) + case Record(_, fields) => handleRecord(tpe, fields.toList, context) + case Reference(_, name) => handleReference(tpe, name, context) + case Tuple(_, elements) => handleTuple(tpe, elements.toList, context) + case UnitValue(_) => handleUnitValue(tpe, context) + case UpdateRecord(_, valueToUpdate, fields) => handleUpdateRecord(tpe, valueToUpdate, fields, context) + case Variable(_, name) => handleVariable(tpe, name, context) } - case Left(err) => List(er) + case Left(err) => List(err) } From 25e60f8b2cb38f53fb2511f07196ae1b4dc8c8de Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 09:24:40 -0700 Subject: [PATCH 132/323] Incremental --- .../runtime/src/org/finos/morphir/runtime/TypeChecker.scala | 4 +--- .../org/finos/morphir/runtime/TypeCheckerTests.scala.scala | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 180a5ba8e..e78de4e57 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -88,7 +88,7 @@ class TypeChecker(dists: Distributions) { def check(suspect: TypedValue, parentContext: Context): TypeCheckerResult = { import Value.{Unit as UnitValue, List as ListValue, Field as FieldValue, *} val context = parentContext.withDepth(parentContext.depth + 1) - dealias(suspect.attributes) match{ + dealias(suspect.attributes, context) match{ case Right(tpe) => suspect match { case Literal(_, lit) => handleLiteral(tpe, lit, context) case Apply(_, function, argument) => handleApply(tpe, function, argument, context) @@ -114,8 +114,6 @@ class TypeChecker(dists: Distributions) { } case Left(err) => List(err) } - - } def handleLiteral(tpe: UType, literal: Lit, context: Context): TypeCheckerResult = { import Extractors.Types.* diff --git a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala index 6f606203a..bd791bd19 100644 --- a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala +++ b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala @@ -35,7 +35,7 @@ object TypeCheckerTests extends MorphirBaseSpec { def testTypeCheck(value: TypedValue)(expectedErrors: Int): ZIO[TypeChecker, Throwable, TestResult] = for { errors <- runTypeCheck(value) - errorMsgs = errors.map(s"\n\t${_.getMsg"}) + errorMsgs = errors.map(error => s"\n\t${error.getMsg}").mkString("") assert <- if (errors.length == expectedErrors) assertCompletes else assertTrue(errorMsgs == s"Expected $expectedErrors errors") } yield assert // TODO: Cleaner "fails" impl From 44d8c5e1de75a3649bce15654d3d33393a61fab0 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 09:27:15 -0700 Subject: [PATCH 133/323] Incremental --- .../finos/morphir/runtime/TypeChecker.scala | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index e78de4e57..80ab99152 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -119,17 +119,14 @@ class TypeChecker(dists: Distributions) { import Extractors.Types.* import Lit.* val fromChildren = List() - val matchErrors = dealias(tpe, context) match { - case Right(dealiasedTpe) => (literal, dealiasedTpe) match { - case (StringLiteral (_), StringRef () ) => List () - case (FloatLiteral (_), FloatRef () ) => List () - case (CharLiteral (_), CharRef () ) => List () - case (BoolLiteral (_), BoolRef () ) => List () - case (WholeNumberLiteral (_), IntRef () ) => List () //TODO: "WholeNumberRef" extractor - case (DecimalLiteral (_), DecimalRef () ) => List () - case (otherLit, otherTpe) => List (new LiteralTypeMismatch(otherLit, otherTpe)) - } - case Left(err) => List(err) + val matchErrors = (literal, tpe) match { + case (StringLiteral (_), StringRef () ) => List () + case (FloatLiteral (_), FloatRef () ) => List () + case (CharLiteral (_), CharRef () ) => List () + case (BoolLiteral (_), BoolRef () ) => List () + case (WholeNumberLiteral (_), IntRef () ) => List () //TODO: "WholeNumberRef" extractor + case (DecimalLiteral (_), DecimalRef () ) => List () + case (otherLit, otherTpe) => List (new LiteralTypeMismatch(otherLit, otherTpe)) } fromChildren ++ matchErrors } From ab7bdfce5d2fbfe687ffa949cabec7ad2e488983 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 09:31:13 -0700 Subject: [PATCH 134/323] Incremental --- morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala | 1 + morphir/runtime/src/org/finos/morphir/runtime/Utils.scala | 2 -- .../src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 80ab99152..c78ab1e1a 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -242,6 +242,7 @@ class TypeChecker(dists: Distributions) { } def handleReference(tpe: UType, fqn: FQName, context: Context): TypeCheckerResult = { val fromChildren = List() + // TODO: Check the value dealiases to a definition that translates to this tpe fromChildren } diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala index 114ed3a4c..39696384a 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala @@ -162,8 +162,6 @@ object Utils { fqn.getPackagePath == example.getPackagePath } - // TODO: Implement - def typeCheck[TA](t1: Type[TA], t2: Type[TA]): RTAction[Any, TypeError, Unit] = RTAction.succeed(()) def curryTypeFunction[TA](inner: Type[TA], params: Chunk[(Name, Type[TA])]): Type[TA] = params match { case Chunk() => inner diff --git a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala index bd791bd19..2f973ec6c 100644 --- a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala +++ b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala @@ -77,7 +77,7 @@ object TypeCheckerTests extends MorphirBaseSpec { val badApply: TypedValue = V.apply(Basics.boolType, invalidFunction, V.intTyped(2)) testTypeCheck(badApply)(-1) } - // TODO: Body is recursively checked + // TODO: Aliased function type ), suite("Literal Node")( test("Strings are not Ints") { From 0e76037aeab5399156a736c8079308a7ba8b5ad6 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 09:34:45 -0700 Subject: [PATCH 135/323] Incremental --- .../runtime/src/org/finos/morphir/runtime/TypeChecker.scala | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index c78ab1e1a..cc316ed61 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -82,7 +82,9 @@ class TypeChecker(dists: Distributions) { } loop(tpe, None, context) } - private def pretty(tpe: UType): String = pretty(tpe, 2) + def conformsTo(valueType : UType, interfaceType : UType, context : Context) : List[MorphirTypeError] = { + List() + } def check(suspect: TypedValue): TypeCheckerResult = check(suspect, Context.empty) def check(suspect: TypedValue, parentContext: Context): TypeCheckerResult = { @@ -242,6 +244,8 @@ class TypeChecker(dists: Distributions) { } def handleReference(tpe: UType, fqn: FQName, context: Context): TypeCheckerResult = { val fromChildren = List() + val spec = dists.lookupTypeSpecification(fqn) + val curried = Utils.curryTypeFunction(spec) // TODO: Check the value dealiases to a definition that translates to this tpe fromChildren From 550459dc7f081c7c566d5ccf7a4c0a129e371d69 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 09:38:52 -0700 Subject: [PATCH 136/323] Incremental --- .../src/org/finos/morphir/runtime/TypeChecker.scala | 8 +++++--- morphir/runtime/src/org/finos/morphir/runtime/Utils.scala | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index cc316ed61..f4348c4ae 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -57,7 +57,6 @@ class TypeChecker(dists: Distributions) { private def nameMissingValue(value: TypedValue, dists: Distributions): MorphirTypeError = ??? private def nameMissingType(fqn: FQName, dists: Distributions): MorphirTypeError = ??? private def nameMissingConstructor(fqn: FQName, tpe: UType, dists: Distributions): MorphirTypeError = ??? - private def pretty(tpe: UType, depthBudget: Int): String = ??? def dealias(tpe: UType, context: Context): Either[MorphirTypeError, UType] = { def loop(tpe: UType, original_fqn: Option[FQName], context: Context): Either[MorphirTypeError, UType] = @@ -82,9 +81,12 @@ class TypeChecker(dists: Distributions) { } loop(tpe, None, context) } - def conformsTo(valueType : UType, interfaceType : UType, context : Context) : List[MorphirTypeError] = { - List() + def conformsTo(valueType : UType, declaredType : UType, context : Context) : List[MorphirTypeError] = { + (valueType, declaredType) match { + + } } + def check(suspect: TypedValue): TypeCheckerResult = check(suspect, Context.empty) def check(suspect: TypedValue, parentContext: Context): TypeCheckerResult = { diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala index 39696384a..4bc792de9 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala @@ -166,7 +166,7 @@ object Utils { params match { case Chunk() => inner case chunk => - curryTypeFunction(Type.Function(inner.attributes, chunk.head._2, inner), chunk.tail) + curryTypeFunction(Type.Function(inner.attributes, chunk.head._2, inner), chunk.tail) //TODO: Backwards? } } From 1dcc5f49a76129693b996c31b1d6d051576c6c64 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 09:40:42 -0700 Subject: [PATCH 137/323] Incremental --- .../src/org/finos/morphir/runtime/TypeChecker.scala | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index f4348c4ae..52ad31df5 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -22,11 +22,11 @@ import MorphirTypeError.* object TypeChecker { type TypeCheckerResult = List[MorphirTypeError] case class Context( - bindings: Map[Name, UType], + typeBindings: Map[Name, UType], depth: Int, prefix: String ) { - def withBindings(bindings: Map[Name, UType]) = this.copy(bindings = bindings) + def withTypeBindings(typeBindings: Map[Name, UType]) = this.copy(typeBindings = typeBindings) def withDepth(depth: Int) = this.copy(depth = depth) def withPrefix(prefix: String) = this.copy(prefix = prefix) } @@ -34,6 +34,7 @@ object TypeChecker { def empty = Context(Map(), 0, "") } def helper(condition: Boolean, error: MorphirTypeError) = if (condition) List(error) else List() + def getTypeVariable(name : Name) : Option[UType] = typeBindings.get(name) } class TypeChecker(dists: Distributions) { @@ -83,7 +84,8 @@ class TypeChecker(dists: Distributions) { } def conformsTo(valueType : UType, declaredType : UType, context : Context) : List[MorphirTypeError] = { (valueType, declaredType) match { - + // case (_, Type.Variable(_, name)) => List(Unimplemented("Tell Ned to add variable bindings")) + // case (Type.Variable(_, name), _) => List(Unimplemented("Tell Ned to add variable bindings")) } } From f067034e1f19e23925c668ec79e5976060ca7c71 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 09:41:49 -0700 Subject: [PATCH 138/323] Incremental --- .../runtime/src/org/finos/morphir/runtime/TypeChecker.scala | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 52ad31df5..c5ff8f74b 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -84,8 +84,10 @@ class TypeChecker(dists: Distributions) { } def conformsTo(valueType : UType, declaredType : UType, context : Context) : List[MorphirTypeError] = { (valueType, declaredType) match { - // case (_, Type.Variable(_, name)) => List(Unimplemented("Tell Ned to add variable bindings")) - // case (Type.Variable(_, name), _) => List(Unimplemented("Tell Ned to add variable bindings")) + case (_, Type.Variable(_, name)) => context.getTypeVariable(name) match { + case None => List(new TypeVariableMissing(name)) + } + case (Type.Variable(_, name), _) => List(Unimplemented("Tell Ned to add variable bindings")) } } From aecd36111fb2af5dfb57f0747e1bc3b36bcbe0eb Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 09:45:27 -0700 Subject: [PATCH 139/323] Incremental --- .../src/org/finos/morphir/runtime/MorphirTypeError.scala | 1 + .../src/org/finos/morphir/runtime/TypeChecker.scala | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala index 5f8f02a45..8464d8d8d 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala @@ -30,6 +30,7 @@ object MorphirTypeError { case class ImproperType(tpe: UType, message: String) extends MorphirTypeError("Todo") case class CannotDealias(err: LookupError, msg: String = "Cannot dealias type") extends MorphirTypeError(s"$msg: ${err.getMsg}") + case class TypeVariableMissing(name : Name) extends MorphirTypeError(s"Missing type variable $name.toTitleCase") case class ValueMissing(value: TypedValue) extends MorphirTypeError("Todo") case class ConstructorMissing(fqn: FQName, tpe: UType) extends MorphirTypeError("Todo") case class ModuleMissing(modName: ModuleName) extends MorphirTypeError("Todo") diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index c5ff8f74b..ed577b9f8 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -86,9 +86,12 @@ class TypeChecker(dists: Distributions) { (valueType, declaredType) match { case (_, Type.Variable(_, name)) => context.getTypeVariable(name) match { case None => List(new TypeVariableMissing(name)) + case some(lookedUp) => conformsTo(valueType, lookedUp, context) //TODO: Type parameter wrangling + } + case (Type.Variable(_, name), _) => context.getTypeVariable(name) match { + case None => List(new TypeVariableMissing(name)) + case some(lookedUp) => conformsTo(lookedUp, declaredType, context) } - case (Type.Variable(_, name), _) => List(Unimplemented("Tell Ned to add variable bindings")) - } } def check(suspect: TypedValue): TypeCheckerResult = From 97b2cd6a6220aaa91c4709597fad9095addebf7d Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 09:46:31 -0700 Subject: [PATCH 140/323] Incremental --- .../runtime/src/org/finos/morphir/runtime/Extractors.scala | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala b/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala index bff4eb86d..ca0e01723 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala @@ -84,7 +84,11 @@ object Extractors { object LocalTimeRef extends CommonReference { final val tpe = sdk.LocalTime.localTimeType } - + object LeafType{ + def unapply(tpe : Utype) : boolean = { + + } + } object NonNativeRef { def unapply(tpe: UType): Option[(FQName, Chunk[UType])] = tpe match { From 3671b14c334f79e0682bc995fbff40bc03e42652 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 09:47:17 -0700 Subject: [PATCH 141/323] Incremental --- .../runtime/src/org/finos/morphir/runtime/Extractors.scala | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala b/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala index ca0e01723..63b160cc0 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala @@ -86,7 +86,9 @@ object Extractors { } object LeafType{ def unapply(tpe : Utype) : boolean = { - + tpe match { + case Reference(_, _, Chunk()) => true + } } } object NonNativeRef { From 59d59385e7ac2c4266f5637d6200cc7503dae531 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 09:49:05 -0700 Subject: [PATCH 142/323] Incremental --- .../runtime/src/org/finos/morphir/runtime/Extractors.scala | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala b/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala index 63b160cc0..1761c322e 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala @@ -84,10 +84,13 @@ object Extractors { object LocalTimeRef extends CommonReference { final val tpe = sdk.LocalTime.localTimeType } + object LeafType{ def unapply(tpe : Utype) : boolean = { tpe match { - case Reference(_, _, Chunk()) => true + case Type.Reference(_, _, Chunk()) => true + case Type.Unit => true + case _ => false } } } From 5cd2a2709f16374968a20202a535c64f8c123252 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 09:52:23 -0700 Subject: [PATCH 143/323] Incremental --- .../finos/morphir/runtime/Extractors.scala | 2 +- .../finos/morphir/runtime/TypeChecker.scala | 22 ++++++++++++------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala b/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala index 1761c322e..cbd936f56 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala @@ -84,7 +84,7 @@ object Extractors { object LocalTimeRef extends CommonReference { final val tpe = sdk.LocalTime.localTimeType } - + //Matches anything w/o nested subtypes object LeafType{ def unapply(tpe : Utype) : boolean = { tpe match { diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index ed577b9f8..a8ceb9547 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -83,15 +83,21 @@ class TypeChecker(dists: Distributions) { loop(tpe, None, context) } def conformsTo(valueType : UType, declaredType : UType, context : Context) : List[MorphirTypeError] = { + import Extractors.Types.* + (valueType, declaredType) match { - case (_, Type.Variable(_, name)) => context.getTypeVariable(name) match { - case None => List(new TypeVariableMissing(name)) - case some(lookedUp) => conformsTo(valueType, lookedUp, context) //TODO: Type parameter wrangling - } - case (Type.Variable(_, name), _) => context.getTypeVariable(name) match { - case None => List(new TypeVariableMissing(name)) - case some(lookedUp) => conformsTo(lookedUp, declaredType, context) - } + case (_, Type.Variable(_, name)) => context.getTypeVariable(name) match { + case None => List(new TypeVariableMissing(name)) + case some(lookedUp) => conformsTo(valueType, lookedUp, context) //TODO: Type parameter wrangling + } + case (Type.Variable(_, name), _) => context.getTypeVariable(name) match { + case None => List(new TypeVariableMissing(name)) + case some(lookedUp) => conformsTo(lookedUp, declaredType, context) + } + case (left @LeafType(), right @ LeafType()) => { + if (left == right) List() else List(TypesMismatch(left, right, "value type does not match declared type")) + } + } } def check(suspect: TypedValue): TypeCheckerResult = From 8619b3aebca514ac4923eeb6670a1abb2359c30e Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 09:53:03 -0700 Subject: [PATCH 144/323] Incremental --- .../src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala | 3 +++ 1 file changed, 3 insertions(+) diff --git a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala index 2f973ec6c..7fecc8eee 100644 --- a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala +++ b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala @@ -93,6 +93,9 @@ object TypeCheckerTests extends MorphirBaseSpec { testTypeCheck(V.boolean(true) :> sdk.Basics.floatType)(1) } // TODO: Other lit tests + ), + suite("Type confomrity")( + ) ).provideLayerShared(typeCheckerLayer) } From 981392cfddd6d9975762dc0d1c34ad67192d4cf4 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 09:53:25 -0700 Subject: [PATCH 145/323] Incremental --- .../org/finos/morphir/runtime/TypeCheckerTests.scala.scala | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala index 7fecc8eee..25f65a24b 100644 --- a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala +++ b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala @@ -95,7 +95,9 @@ object TypeCheckerTests extends MorphirBaseSpec { // TODO: Other lit tests ), suite("Type confomrity")( - + test("IntType is not StringType"){ + + } ) ).provideLayerShared(typeCheckerLayer) } From 4269572d574c8712f7229a758e4603ee13c180ae Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 09:54:14 -0700 Subject: [PATCH 146/323] Incremental --- .../org/finos/morphir/runtime/TypeCheckerTests.scala.scala | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala index 25f65a24b..58ceaeab1 100644 --- a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala +++ b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala @@ -32,6 +32,9 @@ object TypeCheckerTests extends MorphirBaseSpec { dist <- EvaluationLibrary.loadDistributionFromFileZIO(irFilePath.toString) } yield TypeChecker(Distributions(dist))) + def testTypeConforms(tpe1: UType, tpe2 : UType) : ZIO[TypeChecker, Throwable, TestResult] = { + + } def testTypeCheck(value: TypedValue)(expectedErrors: Int): ZIO[TypeChecker, Throwable, TestResult] = for { errors <- runTypeCheck(value) @@ -96,7 +99,7 @@ object TypeCheckerTests extends MorphirBaseSpec { ), suite("Type confomrity")( test("IntType is not StringType"){ - + } ) ).provideLayerShared(typeCheckerLayer) From 2a175b02e08421fa972842c650f0ec697bb21fb5 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 09:56:00 -0700 Subject: [PATCH 147/323] Incremental --- .../runtime/src/org/finos/morphir/runtime/Extractors.scala | 2 +- .../org/finos/morphir/runtime/TypeCheckerTests.scala.scala | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala b/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala index cbd936f56..2bc345bcb 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala @@ -86,7 +86,7 @@ object Extractors { } //Matches anything w/o nested subtypes object LeafType{ - def unapply(tpe : Utype) : boolean = { + def unapply(tpe : UType) : Boolean = { tpe match { case Type.Reference(_, _, Chunk()) => true case Type.Unit => true diff --git a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala index 58ceaeab1..9a65b8233 100644 --- a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala +++ b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala @@ -33,11 +33,11 @@ object TypeCheckerTests extends MorphirBaseSpec { } yield TypeChecker(Distributions(dist))) def testTypeConforms(tpe1: UType, tpe2 : UType) : ZIO[TypeChecker, Throwable, TestResult] = { - + ??? } def testTypeCheck(value: TypedValue)(expectedErrors: Int): ZIO[TypeChecker, Throwable, TestResult] = for { - errors <- runTypeCheck(value) + errors <- ZIO.succeed(checker.check(value)) errorMsgs = errors.map(error => s"\n\t${error.getMsg}").mkString("") assert <- if (errors.length == expectedErrors) assertCompletes else assertTrue(errorMsgs == s"Expected $expectedErrors errors") From 673a6b09c6cee3e03a8dec844bfbe628d6b4f48a Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 09:58:25 -0700 Subject: [PATCH 148/323] Incremental --- .../runtime/src/org/finos/morphir/runtime/Extractors.scala | 2 +- .../runtime/src/org/finos/morphir/runtime/TypeChecker.scala | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala b/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala index 2bc345bcb..96abd2518 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala @@ -89,7 +89,7 @@ object Extractors { def unapply(tpe : UType) : Boolean = { tpe match { case Type.Reference(_, _, Chunk()) => true - case Type.Unit => true + case Type.Unit(_) => true case _ => false } } diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index a8ceb9547..81f46863d 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -29,12 +29,13 @@ object TypeChecker { def withTypeBindings(typeBindings: Map[Name, UType]) = this.copy(typeBindings = typeBindings) def withDepth(depth: Int) = this.copy(depth = depth) def withPrefix(prefix: String) = this.copy(prefix = prefix) + + def getTypeVariable(name: Name): Option[UType] = typeBindings.get(name) } object Context { def empty = Context(Map(), 0, "") } def helper(condition: Boolean, error: MorphirTypeError) = if (condition) List(error) else List() - def getTypeVariable(name : Name) : Option[UType] = typeBindings.get(name) } class TypeChecker(dists: Distributions) { @@ -52,7 +53,7 @@ class TypeChecker(dists: Distributions) { val modPart = if (mod1 != mod2) s"{$mod1 $mod2}" else mod1 val locPart = if (loc1 != loc2) s"{${loc1.toTitleCase} ${loc2.toTitleCase}" else loc1.toTitleCase s"$packPart:$modPart:$locPart" - case _ => s"(${pretty(tpe1, 2)} vs ${pretty(tpe2, 2)})" + case _ => s"(${Succinct.Type(tpe1, 2)} vs ${Succinct.Type(tpe2, 2)})" } } private def nameMissingValue(value: TypedValue, dists: Distributions): MorphirTypeError = ??? From 32c5c775372a35c281fb9b63adfacd424062d586 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 09:59:23 -0700 Subject: [PATCH 149/323] Incremental --- .../runtime/src/org/finos/morphir/runtime/TypeChecker.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 81f46863d..cfdd9a63d 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -69,7 +69,7 @@ class TypeChecker(dists: Distributions) { lookedUp match { case Right(T.Specification.TypeAliasSpecification(typeParams, expr)) => val newBindings = typeParams.zip(typeArgs).toMap - loop(expr, original_fqn.orElse(Some(typeName)), context.withBindings(newBindings)) + loop(expr, original_fqn.orElse(Some(typeName)), context.withTypeBindings(newBindings)) case Right(_) => Right(tpe) // TODO: Bindings case Left(lookupErr) => original_fqn match { @@ -89,7 +89,7 @@ class TypeChecker(dists: Distributions) { (valueType, declaredType) match { case (_, Type.Variable(_, name)) => context.getTypeVariable(name) match { case None => List(new TypeVariableMissing(name)) - case some(lookedUp) => conformsTo(valueType, lookedUp, context) //TODO: Type parameter wrangling + case Some(lookedUp) => conformsTo(valueType, lookedUp, context) //TODO: Type parameter wrangling } case (Type.Variable(_, name), _) => context.getTypeVariable(name) match { case None => List(new TypeVariableMissing(name)) From b53b2fc41345f366d5a042eccff385ff6378e560 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 10:01:20 -0700 Subject: [PATCH 150/323] Incremental --- .../src/org/finos/morphir/runtime/MorphirTypeError.scala | 2 +- .../runtime/src/org/finos/morphir/runtime/TypeChecker.scala | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala index 8464d8d8d..84ef02527 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala @@ -31,7 +31,7 @@ object MorphirTypeError { case class CannotDealias(err: LookupError, msg: String = "Cannot dealias type") extends MorphirTypeError(s"$msg: ${err.getMsg}") case class TypeVariableMissing(name : Name) extends MorphirTypeError(s"Missing type variable $name.toTitleCase") - case class ValueMissing(value: TypedValue) extends MorphirTypeError("Todo") + case class DefinitionMissing(err : LookupError) extends MorphirTypeError(s"Cannot find definition: ${err.getMsg}") case class ConstructorMissing(fqn: FQName, tpe: UType) extends MorphirTypeError("Todo") case class ModuleMissing(modName: ModuleName) extends MorphirTypeError("Todo") case class PackageMissing(pckName: PackageName) extends MorphirTypeError("Todo") diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index cfdd9a63d..e10288db8 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -93,7 +93,7 @@ class TypeChecker(dists: Distributions) { } case (Type.Variable(_, name), _) => context.getTypeVariable(name) match { case None => List(new TypeVariableMissing(name)) - case some(lookedUp) => conformsTo(lookedUp, declaredType, context) + case Some(lookedUp) => conformsTo(lookedUp, declaredType, context) } case (left @LeafType(), right @ LeafType()) => { if (left == right) List() else List(TypesMismatch(left, right, "value type does not match declared type")) @@ -261,6 +261,9 @@ class TypeChecker(dists: Distributions) { def handleReference(tpe: UType, fqn: FQName, context: Context): TypeCheckerResult = { val fromChildren = List() val spec = dists.lookupTypeSpecification(fqn) + spec match{ + case Left(err) => List() + } val curried = Utils.curryTypeFunction(spec) // TODO: Check the value dealiases to a definition that translates to this tpe From 3116aaa8138e6d305f26111e2673c93086b90ca7 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 10:02:11 -0700 Subject: [PATCH 151/323] Incremental --- .../src/org/finos/morphir/runtime/TypeChecker.scala | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index e10288db8..cf267c67f 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -260,11 +260,13 @@ class TypeChecker(dists: Distributions) { } def handleReference(tpe: UType, fqn: FQName, context: Context): TypeCheckerResult = { val fromChildren = List() - val spec = dists.lookupTypeSpecification(fqn) - spec match{ - case Left(err) => List() + val spec = dists.lookupTypeSpecification(fqn) match{ + case Left(err) => List(new DefinitionMissing(err)) + case Right(spec) => { + val curried = Utils.curryTypeFunction(spec) + + } } - val curried = Utils.curryTypeFunction(spec) // TODO: Check the value dealiases to a definition that translates to this tpe fromChildren From 6ee91fcdbb14f2e8d90ec5801c217ece4f051d24 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 10:04:00 -0700 Subject: [PATCH 152/323] Incremental --- .../src/org/finos/morphir/runtime/TypeChecker.scala | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index cf267c67f..237621ec2 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -260,16 +260,14 @@ class TypeChecker(dists: Distributions) { } def handleReference(tpe: UType, fqn: FQName, context: Context): TypeCheckerResult = { val fromChildren = List() - val spec = dists.lookupTypeSpecification(fqn) match{ + val fromType = dists.lookupTypeSpecification(fqn) match{ case Left(err) => List(new DefinitionMissing(err)) case Right(spec) => { - val curried = Utils.curryTypeFunction(spec) - + val curried = Utils.curryTypeFunction(spec.output, spec.inputs) + conformsTo(curried, tpe) } } - - // TODO: Check the value dealiases to a definition that translates to this tpe - fromChildren + fromChildren ++ fromType } def handleTuple(tpe: UType, elements: List[TypedValue], context: Context): TypeCheckerResult = { val fromChildren = elements.flatMap(check(_, context)) From 0ac97c65b17995112e8b75a8fc34c613c6e7569b Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 10:05:44 -0700 Subject: [PATCH 153/323] Incremental --- .../runtime/src/org/finos/morphir/runtime/TypeChecker.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 237621ec2..6be5290fc 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -260,11 +260,11 @@ class TypeChecker(dists: Distributions) { } def handleReference(tpe: UType, fqn: FQName, context: Context): TypeCheckerResult = { val fromChildren = List() - val fromType = dists.lookupTypeSpecification(fqn) match{ + val fromType = dists.lookupValueSpecification(fqn) match{ case Left(err) => List(new DefinitionMissing(err)) case Right(spec) => { val curried = Utils.curryTypeFunction(spec.output, spec.inputs) - conformsTo(curried, tpe) + conformsTo(curried, tpe, context) } } fromChildren ++ fromType From 3d46f84c590c37c69b0babbee48099e40e896c42 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 10:08:57 -0700 Subject: [PATCH 154/323] Incremental --- .../morphir/runtime/TypeCheckerTests.scala.scala | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala index 9a65b8233..6046f7029 100644 --- a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala +++ b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala @@ -36,12 +36,14 @@ object TypeCheckerTests extends MorphirBaseSpec { ??? } def testTypeCheck(value: TypedValue)(expectedErrors: Int): ZIO[TypeChecker, Throwable, TestResult] = - for { - errors <- ZIO.succeed(checker.check(value)) - errorMsgs = errors.map(error => s"\n\t${error.getMsg}").mkString("") - assert <- if (errors.length == expectedErrors) assertCompletes - else assertTrue(errorMsgs == s"Expected $expectedErrors errors") - } yield assert // TODO: Cleaner "fails" impl + ZIO.serviceWithZIO[TypeChecker] { checker => + for { + errors <- ZIO.succeed(checker.check(value)) + errorMsgs = errors.map(error => s"\n\t${error.getMsg}").mkString("") + assert <- if (errors.length == expectedErrors) assertCompletes + else assertTrue(errorMsgs == s"Expected $expectedErrors errors") + } yield assert // TODO: Cleaner "fails" impl + } def runTypeCheck(value: TypedValue): ZIO[TypeChecker, Throwable, List[MorphirTypeError]] = ZIO.serviceWithZIO[TypeChecker] { checker => ZIO.succeed(checker.check(value)) From cd6ec79e8ebf938fbd1bdd2575879cf7c14c72ca Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 10:10:02 -0700 Subject: [PATCH 155/323] Incremental --- morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala | 2 +- .../src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 6be5290fc..4ace4deea 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -83,9 +83,9 @@ class TypeChecker(dists: Distributions) { } loop(tpe, None, context) } + def conformsTo(valueType : UType, declaredType : UType, context : Context) : List[MorphirTypeError] = { import Extractors.Types.* - (valueType, declaredType) match { case (_, Type.Variable(_, name)) => context.getTypeVariable(name) match { case None => List(new TypeVariableMissing(name)) diff --git a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala index 6046f7029..73bf2f0ac 100644 --- a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala +++ b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala @@ -101,7 +101,7 @@ object TypeCheckerTests extends MorphirBaseSpec { ), suite("Type confomrity")( test("IntType is not StringType"){ - + testTypeConforms(Basics.intType, sdk.String.stringType) } ) ).provideLayerShared(typeCheckerLayer) From 679652149ad8df792aba7ec1f9f0240c4664eb7f Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 10:11:14 -0700 Subject: [PATCH 156/323] Incremental --- morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala | 1 + 1 file changed, 1 insertion(+) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 4ace4deea..cb80b1e76 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -84,6 +84,7 @@ class TypeChecker(dists: Distributions) { loop(tpe, None, context) } + def conformsTo(valueType: UType, declaredType: UType): List[MorphirTypeError] = conformsTo(valueType, declaredType, Context.empty) def conformsTo(valueType : UType, declaredType : UType, context : Context) : List[MorphirTypeError] = { import Extractors.Types.* (valueType, declaredType) match { From eb24acec63df056261d9232088059ac2fe52384f Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 10:11:58 -0700 Subject: [PATCH 157/323] Incremental --- .../org/finos/morphir/runtime/TypeCheckerTests.scala.scala | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala index 73bf2f0ac..c3605ed76 100644 --- a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala +++ b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala @@ -33,7 +33,11 @@ object TypeCheckerTests extends MorphirBaseSpec { } yield TypeChecker(Distributions(dist))) def testTypeConforms(tpe1: UType, tpe2 : UType) : ZIO[TypeChecker, Throwable, TestResult] = { - ??? + ZIO.serviceWithZIO[TypeChecker] { checker => + for{ + + } + } } def testTypeCheck(value: TypedValue)(expectedErrors: Int): ZIO[TypeChecker, Throwable, TestResult] = ZIO.serviceWithZIO[TypeChecker] { checker => From 666a7b043634f9af3007be0279b9cd3dc4933061 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 10:13:05 -0700 Subject: [PATCH 158/323] Incremental --- .../org/finos/morphir/runtime/TypeCheckerTests.scala.scala | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala index c3605ed76..cfc4ed96b 100644 --- a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala +++ b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala @@ -35,8 +35,11 @@ object TypeCheckerTests extends MorphirBaseSpec { def testTypeConforms(tpe1: UType, tpe2 : UType) : ZIO[TypeChecker, Throwable, TestResult] = { ZIO.serviceWithZIO[TypeChecker] { checker => for{ - - } + errors <- ZIO.succeed(checker.conformsTo(tpe1, tpe2)) + errorMsgs = errors.map(error => s"\n\t${error.getMsg}").mkString("") + assert <- if (errors.length == expectedErrors) assertCompletes + else assertTrue(errorMsgs == s"Expected $expectedErrors errors") + } yield assert } } def testTypeCheck(value: TypedValue)(expectedErrors: Int): ZIO[TypeChecker, Throwable, TestResult] = From d1655384a0e96a7e8bfce85b4b2625e9c60e7975 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 10:15:47 -0700 Subject: [PATCH 159/323] Incremental --- .../org/finos/morphir/runtime/TypeCheckerTests.scala.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala index cfc4ed96b..1790fb38f 100644 --- a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala +++ b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala @@ -32,7 +32,7 @@ object TypeCheckerTests extends MorphirBaseSpec { dist <- EvaluationLibrary.loadDistributionFromFileZIO(irFilePath.toString) } yield TypeChecker(Distributions(dist))) - def testTypeConforms(tpe1: UType, tpe2 : UType) : ZIO[TypeChecker, Throwable, TestResult] = { + def testTypeConforms(tpe1: UType, tpe2 : UType)(expectedErrors : Int) : ZIO[TypeChecker, Throwable, TestResult] = { ZIO.serviceWithZIO[TypeChecker] { checker => for{ errors <- ZIO.succeed(checker.conformsTo(tpe1, tpe2)) @@ -108,7 +108,7 @@ object TypeCheckerTests extends MorphirBaseSpec { ), suite("Type confomrity")( test("IntType is not StringType"){ - testTypeConforms(Basics.intType, sdk.String.stringType) + testTypeConforms(Basics.intType, sdk.String.stringType)(0) } ) ).provideLayerShared(typeCheckerLayer) From 2032c5ca7c8608838f556d8bf69831301994feb0 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 10:17:19 -0700 Subject: [PATCH 160/323] Incremental --- .../runtime/src/org/finos/morphir/runtime/TypeChecker.scala | 3 +++ 1 file changed, 3 insertions(+) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index cb80b1e76..756b28f20 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -98,6 +98,9 @@ class TypeChecker(dists: Distributions) { } case (left @LeafType(), right @ LeafType()) => { if (left == right) List() else List(TypesMismatch(left, right, "value type does not match declared type")) + case (Type.Function(_, valueArg, valueRet), Type.Function(_, declaredArg, declaredRet)) => { + conformsTo(valueRet, declaredRet, context) ++ conformsTo(declaredArg, valueArg, context) + } } } } From e92248e803fa71c0c5947c77297b5aa6aeda7c19 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 10:19:00 -0700 Subject: [PATCH 161/323] Incremental --- .../runtime/src/org/finos/morphir/runtime/TypeChecker.scala | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 756b28f20..1ed3cd242 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -97,11 +97,13 @@ class TypeChecker(dists: Distributions) { case Some(lookedUp) => conformsTo(lookedUp, declaredType, context) } case (left @LeafType(), right @ LeafType()) => { - if (left == right) List() else List(TypesMismatch(left, right, "value type does not match declared type")) + if (left == right) List() else List(TypesMismatch(left, right, "Value type does not match declared type")) + } case (Type.Function(_, valueArg, valueRet), Type.Function(_, declaredArg, declaredRet)) => { + //Note reversed order - covariance vs. contravariance. conformsTo(valueRet, declaredRet, context) ++ conformsTo(declaredArg, valueArg, context) } - } + } } From aaab0521072128a9243362a8313bd0adb629de06 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 10:21:50 -0700 Subject: [PATCH 162/323] Incremental --- .../org/finos/morphir/runtime/TypeCheckerTests.scala.scala | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala index 1790fb38f..c0a592875 100644 --- a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala +++ b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala @@ -87,7 +87,7 @@ object TypeCheckerTests extends MorphirBaseSpec { }, test("Body is recursively checked") { val badApply: TypedValue = V.apply(Basics.boolType, invalidFunction, V.intTyped(2)) - testTypeCheck(badApply)(-1) + testTypeCheck(badApply)(1) } // TODO: Aliased function type ), @@ -108,7 +108,10 @@ object TypeCheckerTests extends MorphirBaseSpec { ), suite("Type confomrity")( test("IntType is not StringType"){ - testTypeConforms(Basics.intType, sdk.String.stringType)(0) + testTypeConforms(Basics.intType, sdk.String.stringType)(1) + }, + test("UnitType is not StringType") { + testTypeConforms(T.unit(()), sdk.String.stringType)(1-) } ) ).provideLayerShared(typeCheckerLayer) From 4b2629a7c5f6c554a9e10cf53ba8d7bc91e044ea Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 10:24:17 -0700 Subject: [PATCH 163/323] Incremental --- .../runtime/src/org/finos/morphir/runtime/TypeChecker.scala | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 1ed3cd242..b7fd6cf49 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -161,8 +161,7 @@ class TypeChecker(dists: Distributions) { dealias(function.attributes, context) match { case Right(Type.Function(_, paramType, returnType)) => // TODO: Better than != - helper(paramType != argument.attributes, new ArgumentDoesNotMatchParameter(argument, paramType)) ++ - helper(returnType != tpe, new TypesMismatch(tpe, returnType, "Function return does not match apply node")) + conformsTo(argument.attributes, paramType) ++ conformsTo(returnType, tpe) case Right(other) => List(new ApplyToNonFunction(function, argument)) case Left(err) => List(err) } From f9f123d9ef2949ad45d8155be6fab57cc47ceb12 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 10:24:48 -0700 Subject: [PATCH 164/323] Incremental --- .../runtime/src/org/finos/morphir/runtime/TypeChecker.scala | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index b7fd6cf49..47ca578b3 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -160,8 +160,7 @@ class TypeChecker(dists: Distributions) { val fromTpe = dealias(function.attributes, context) match { case Right(Type.Function(_, paramType, returnType)) => - // TODO: Better than != - conformsTo(argument.attributes, paramType) ++ conformsTo(returnType, tpe) + conformsTo(argument.attributes, paramType, context) ++ conformsTo(returnType, tpe, context) //TODO: Useful context lost here case Right(other) => List(new ApplyToNonFunction(function, argument)) case Left(err) => List(err) } From 4043292c299aa30459f057f73a7b5f4eb1bb1a34 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 10:31:00 -0700 Subject: [PATCH 165/323] Incremental --- .../runtime/src/org/finos/morphir/runtime/TypeChecker.scala | 6 +++--- .../org/finos/morphir/runtime/TypeCheckerTests.scala.scala | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 47ca578b3..216a62c9a 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -164,7 +164,6 @@ class TypeChecker(dists: Distributions) { case Right(other) => List(new ApplyToNonFunction(function, argument)) case Left(err) => List(err) } - // TODO: Check it's a function with matching arg and return fromChildren ++ fromTpe } @@ -176,13 +175,14 @@ class TypeChecker(dists: Distributions) { context: Context ): TypeCheckerResult = { val fromChildren = check(value, context) ++ check(inValue, context) - // TODO: Check inValue matches tpe // TODO: Check pattern can be value // TODO: Check value must be pattern - fromChildren + val fromTpe = conformsTo(inValue, tpe, context) + fromTpe ++ fromChildren } def handleConstructor(tpe: UType, fqn: FQName, context: Context): TypeCheckerResult = { val fromChildren = List() + val fromTpe // TODO: Check it's a function onion for a type with that constructor fromChildren } diff --git a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala index c0a592875..8a0984ea9 100644 --- a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala +++ b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala @@ -111,7 +111,7 @@ object TypeCheckerTests extends MorphirBaseSpec { testTypeConforms(Basics.intType, sdk.String.stringType)(1) }, test("UnitType is not StringType") { - testTypeConforms(T.unit(()), sdk.String.stringType)(1-) + testTypeConforms(T.unit(()), sdk.String.stringType)(1) } ) ).provideLayerShared(typeCheckerLayer) From e1a8f8be5a69435a632506d382cb3c8aba6fcf4b Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 10:34:02 -0700 Subject: [PATCH 166/323] Incremental --- .../runtime/src/org/finos/morphir/runtime/TypeChecker.scala | 2 +- morphir/runtime/src/org/finos/morphir/runtime/Utils.scala | 6 +++--- .../finos/morphir/runtime/quick/QuickMorphirRuntime.scala | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 216a62c9a..eeb8dfc21 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -182,7 +182,7 @@ class TypeChecker(dists: Distributions) { } def handleConstructor(tpe: UType, fqn: FQName, context: Context): TypeCheckerResult = { val fromChildren = List() - val fromTpe + val fromTpe = uncurryFunctionType // TODO: Check it's a function onion for a type with that constructor fromChildren } diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala index 4bc792de9..f56e350e4 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala @@ -132,7 +132,7 @@ object Utils { def specificationToType[TA](spec: V.Specification[TA]): Type[TA] = curryTypeFunction(spec.output, spec.inputs) - def unCurryTypeFunction( + def findTypeBindings( curried: UType, args: List[TypedValue], dists: Distributions, @@ -148,11 +148,11 @@ object Utils { // _ <- RTAction.fail( new ManyErrors(errors: _*)) //// errors = new TypeChecker().reallyTypeCheckArg(head, parameterType, "") //// _ <- RTAction.fail(new ManyErrors(errors:_*)) - appliedType <- unCurryTypeFunction(returnType, tail, dists, bindings) + appliedType <- findTypeBindings(returnType, tail, dists, bindings) } yield appliedType case (tpe, Nil) => RTAction.succeed(applyBindings(tpe, knownBindings)) case (dealiaser(inner, aliasBindings), args) => - unCurryTypeFunction(inner, args, dists, knownBindings ++ aliasBindings) + findTypeBindings(inner, args, dists, knownBindings ++ aliasBindings) case (nonFunction, head :: _) => RTAction.fail(TooManyArgs(s"Tried to apply argument $head to non-function $nonFunction")) } diff --git a/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala b/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala index c6f3cbd23..824a094a2 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala @@ -57,7 +57,7 @@ private[runtime] case class QuickMorphirRuntime(dists: Distributions, store: Sto entryPoint match { case Value.Reference.Typed(tpe, entryName) => for { - tpe <- unCurryTypeFunction(tpe, params.toList, dists, Map())(ctx.options) + tpe <- findTypeBindings(tpe, params.toList, dists, Map())(ctx.options) } yield V.apply(tpe, entryPoint, params.head, params.tail: _*) case other => RTAction.fail(UnsupportedType(s"Entry point must be a Reference, instead found $other")) } From d6da4cef6e07bf8aa994677942774e8fa5ed19df Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 10:38:25 -0700 Subject: [PATCH 167/323] Incremental --- morphir/runtime/src/org/finos/morphir/runtime/Utils.scala | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala index f56e350e4..087f35117 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala @@ -162,6 +162,12 @@ object Utils { fqn.getPackagePath == example.getPackagePath } + def uncurryTypeFunction(functionTpe : UType) : (UType, Chunk[UType]) = { + functioTpe match { + case Type.Function(_, innerFunction, arg) => uncurryTypeFunction(innerFunction) + + } + } def curryTypeFunction[TA](inner: Type[TA], params: Chunk[(Name, Type[TA])]): Type[TA] = params match { case Chunk() => inner From 9453c8418c532b4134b85d10a2b2ee68cfd2b974 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 10:39:05 -0700 Subject: [PATCH 168/323] Incremental --- morphir/runtime/src/org/finos/morphir/runtime/Utils.scala | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala index 087f35117..6bc829541 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala @@ -164,7 +164,10 @@ object Utils { def uncurryTypeFunction(functionTpe : UType) : (UType, Chunk[UType]) = { functioTpe match { - case Type.Function(_, innerFunction, arg) => uncurryTypeFunction(innerFunction) + case Type.Function(_, innerFunction, arg) => { + (ret, args) = uncurryTypeFunction(innerFunction) + (ret, args :+ arg) + } } } From 04367b2dee83002a8dc892605d2294212c1bb29a Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 10:40:28 -0700 Subject: [PATCH 169/323] Incremental --- morphir/runtime/src/org/finos/morphir/runtime/Utils.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala index 6bc829541..586108ff5 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala @@ -165,10 +165,10 @@ object Utils { def uncurryTypeFunction(functionTpe : UType) : (UType, Chunk[UType]) = { functioTpe match { case Type.Function(_, innerFunction, arg) => { - (ret, args) = uncurryTypeFunction(innerFunction) + val (ret, args) = uncurryTypeFunction(innerFunction) (ret, args :+ arg) } - + case other => (other, Chunk()) } } def curryTypeFunction[TA](inner: Type[TA], params: Chunk[(Name, Type[TA])]): Type[TA] = From 7c9d771a4216e57785320a71c1f81e63e7384a3d Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 10:44:02 -0700 Subject: [PATCH 170/323] Incremental --- .../runtime/src/org/finos/morphir/runtime/TypeChecker.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index eeb8dfc21..e88c6888d 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -177,12 +177,12 @@ class TypeChecker(dists: Distributions) { val fromChildren = check(value, context) ++ check(inValue, context) // TODO: Check pattern can be value // TODO: Check value must be pattern - val fromTpe = conformsTo(inValue, tpe, context) + val fromTpe = conformsTo(inValue.attributes, tpe, context) fromTpe ++ fromChildren } def handleConstructor(tpe: UType, fqn: FQName, context: Context): TypeCheckerResult = { val fromChildren = List() - val fromTpe = uncurryFunctionType + val (ret, args) = Utils.uncurryFunctionType(tpe) //TODO: Interleaved function type w/ aliases. // TODO: Check it's a function onion for a type with that constructor fromChildren } From 5c9226a07a04440e052716290ae20d1de12f34ed Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 10:47:25 -0700 Subject: [PATCH 171/323] Incremental --- .../runtime/src/org/finos/morphir/runtime/TypeChecker.scala | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index e88c6888d..042e3bd92 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -183,6 +183,11 @@ class TypeChecker(dists: Distributions) { def handleConstructor(tpe: UType, fqn: FQName, context: Context): TypeCheckerResult = { val fromChildren = List() val (ret, args) = Utils.uncurryFunctionType(tpe) //TODO: Interleaved function type w/ aliases. + val fromTpe = ret match{ + case Type.Referene(_, name, typeArgs) => dists.lookupTypeSpecification(name) match { + + } + } // TODO: Check it's a function onion for a type with that constructor fromChildren } From 2c15c50fd8d2264883e21dfe20f47e1829100e85 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 10:48:03 -0700 Subject: [PATCH 172/323] Incremental --- .../src/org/finos/morphir/runtime/TypeChecker.scala | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 042e3bd92..b23fed92e 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -185,7 +185,13 @@ class TypeChecker(dists: Distributions) { val (ret, args) = Utils.uncurryFunctionType(tpe) //TODO: Interleaved function type w/ aliases. val fromTpe = ret match{ case Type.Referene(_, name, typeArgs) => dists.lookupTypeSpecification(name) match { - + case Some(T.Specification.CustomTypeSpecification(typeParams, ctors)) => + // (typeArgs.zip(typeParams)).flatMap{case (arg, param) => checkTypesAgree(arg, param, context)} + List() + // TODO: Constructor specific checks + case Some(other) => + List(new ImproperTypeSpec(other, s"${pretty(tpe, 2)} should have produced a type union")) + case None => List(new ConstructorMissing(fqn, wrapped, dists)) } } // TODO: Check it's a function onion for a type with that constructor From 2b7ea26501b1676dfa319fe49dd8fe32c509fe15 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 10:51:48 -0700 Subject: [PATCH 173/323] Incremental --- .../src/org/finos/morphir/runtime/MorphirTypeError.scala | 6 +++++- .../runtime/src/org/finos/morphir/runtime/TypeChecker.scala | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala index 84ef02527..261f2da66 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala @@ -18,6 +18,8 @@ abstract class MorphirTypeError(msg: String) extends Exception(msg) { object MorphirTypeError { def succinct[TA, VA](value: Value[TA, VA]): String = Succinct.Value(value) def succinct[TA](tpe: Type[TA]): String = Succinct.Type(tpe) + + def succinct[TA](spec: TT.Specification[TA]): String = Succinct.Type(spec.getClass.simpleName()) case class TypesMismatch(tpe1: UType, tpe2: UType, msg: String) extends MorphirTypeError(s"$msg: ${succinct(tpe1)} vs ${succinct(tpe2)}") case class ArgumentDoesNotMatchParameter(arg: TypedValue, param: UType) extends MorphirTypeError( @@ -27,7 +29,9 @@ object MorphirTypeError { s"Tried to apply ${succinct(arg)} to ${succinct(nonFunction)} of type ${succinct(nonFunction.attributes)}, which is not a function" ) case class LiteralTypeMismatch(lit : Lit, tpe : UType) extends MorphirTypeError(s"Literal $lit is not of type ${succinct(tpe)}") - case class ImproperType(tpe: UType, message: String) extends MorphirTypeError("Todo") + case class ImproperType(tpe: UType, msg: String) extends MorphirTypeError(s"$msg. Found: ${succinct(tpe)}") + + case class ImproperTypeSpec(fqn : FQName, spec: USpecification, msg: String) extends MorphirTypeError(s"$msg. $fqn points to: ${succinct(tpe)}") case class CannotDealias(err: LookupError, msg: String = "Cannot dealias type") extends MorphirTypeError(s"$msg: ${err.getMsg}") case class TypeVariableMissing(name : Name) extends MorphirTypeError(s"Missing type variable $name.toTitleCase") diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index b23fed92e..4e435031f 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -190,7 +190,7 @@ class TypeChecker(dists: Distributions) { List() // TODO: Constructor specific checks case Some(other) => - List(new ImproperTypeSpec(other, s"${pretty(tpe, 2)} should have produced a type union")) + List(new ImproperTypeSpec(other, s"Type union expected")) case None => List(new ConstructorMissing(fqn, wrapped, dists)) } } From cf4f7996be27db7ecabecccd55d19291ddeff85a Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 10:52:43 -0700 Subject: [PATCH 174/323] Incremental --- .../src/org/finos/morphir/runtime/TypeChecker.scala | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 4e435031f..4c4c14333 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -185,13 +185,13 @@ class TypeChecker(dists: Distributions) { val (ret, args) = Utils.uncurryFunctionType(tpe) //TODO: Interleaved function type w/ aliases. val fromTpe = ret match{ case Type.Referene(_, name, typeArgs) => dists.lookupTypeSpecification(name) match { - case Some(T.Specification.CustomTypeSpecification(typeParams, ctors)) => + case Right(T.Specification.CustomTypeSpecification(typeParams, ctors)) => // (typeArgs.zip(typeParams)).flatMap{case (arg, param) => checkTypesAgree(arg, param, context)} List() // TODO: Constructor specific checks - case Some(other) => - List(new ImproperTypeSpec(other, s"Type union expected")) - case None => List(new ConstructorMissing(fqn, wrapped, dists)) + case Right(other) => + List(new ImproperTypeSpec(name, other, s"Type union expected")) + case Left(err) => List(new ConstructorMissing(err)) } } // TODO: Check it's a function onion for a type with that constructor From 8dd4cc373f624764c20c546e1ccadfe0c8062ce7 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 10:53:40 -0700 Subject: [PATCH 175/323] Incremental --- .../src/org/finos/morphir/runtime/MorphirTypeError.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala index 261f2da66..42d5905b4 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala @@ -36,7 +36,7 @@ object MorphirTypeError { extends MorphirTypeError(s"$msg: ${err.getMsg}") case class TypeVariableMissing(name : Name) extends MorphirTypeError(s"Missing type variable $name.toTitleCase") case class DefinitionMissing(err : LookupError) extends MorphirTypeError(s"Cannot find definition: ${err.getMsg}") - case class ConstructorMissing(fqn: FQName, tpe: UType) extends MorphirTypeError("Todo") + case class ConstructorMissing(err: LookupError, tpe: UType) extends MorphirTypeError(s"Cannot find definition of type ${succinct(tpe)}: ${err.getMsg}") case class ModuleMissing(modName: ModuleName) extends MorphirTypeError("Todo") case class PackageMissing(pckName: PackageName) extends MorphirTypeError("Todo") case class Unimplemented(s: String) extends MorphirTypeError(s) From f1dfb588788100856e7e33bea603942db5e5229b Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 10:55:45 -0700 Subject: [PATCH 176/323] Incremental --- .../src/org/finos/morphir/runtime/MorphirTypeError.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala index 42d5905b4..23acac589 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala @@ -19,7 +19,7 @@ object MorphirTypeError { def succinct[TA, VA](value: Value[TA, VA]): String = Succinct.Value(value) def succinct[TA](tpe: Type[TA]): String = Succinct.Type(tpe) - def succinct[TA](spec: TT.Specification[TA]): String = Succinct.Type(spec.getClass.simpleName()) + def succinct[TA](spec: T.Specification[TA]): String = Succinct.Type(spec.getClass.simpleName()) case class TypesMismatch(tpe1: UType, tpe2: UType, msg: String) extends MorphirTypeError(s"$msg: ${succinct(tpe1)} vs ${succinct(tpe2)}") case class ArgumentDoesNotMatchParameter(arg: TypedValue, param: UType) extends MorphirTypeError( @@ -31,7 +31,7 @@ object MorphirTypeError { case class LiteralTypeMismatch(lit : Lit, tpe : UType) extends MorphirTypeError(s"Literal $lit is not of type ${succinct(tpe)}") case class ImproperType(tpe: UType, msg: String) extends MorphirTypeError(s"$msg. Found: ${succinct(tpe)}") - case class ImproperTypeSpec(fqn : FQName, spec: USpecification, msg: String) extends MorphirTypeError(s"$msg. $fqn points to: ${succinct(tpe)}") + case class ImproperTypeSpec(fqn : FQName, spec: UTypeSpec, msg: String) extends MorphirTypeError(s"$msg. $fqn points to: ${succinct(spec)}") case class CannotDealias(err: LookupError, msg: String = "Cannot dealias type") extends MorphirTypeError(s"$msg: ${err.getMsg}") case class TypeVariableMissing(name : Name) extends MorphirTypeError(s"Missing type variable $name.toTitleCase") From a019cb515af5121227d9519248e1f1eb12c685c1 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 10:56:57 -0700 Subject: [PATCH 177/323] Incremental --- morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala | 2 +- morphir/runtime/src/org/finos/morphir/runtime/Utils.scala | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 4c4c14333..e938fcc7b 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -184,7 +184,7 @@ class TypeChecker(dists: Distributions) { val fromChildren = List() val (ret, args) = Utils.uncurryFunctionType(tpe) //TODO: Interleaved function type w/ aliases. val fromTpe = ret match{ - case Type.Referene(_, name, typeArgs) => dists.lookupTypeSpecification(name) match { + case Type.ReferenCe(_, name, typeArgs) => dists.lookupTypeSpecification(name) match { case Right(T.Specification.CustomTypeSpecification(typeParams, ctors)) => // (typeArgs.zip(typeParams)).flatMap{case (arg, param) => checkTypesAgree(arg, param, context)} List() diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala index 586108ff5..f30d97cf3 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala @@ -162,7 +162,7 @@ object Utils { fqn.getPackagePath == example.getPackagePath } - def uncurryTypeFunction(functionTpe : UType) : (UType, Chunk[UType]) = { + def uncurryFunctionType(functionTpe : UType) : (UType, Chunk[UType]) = { functioTpe match { case Type.Function(_, innerFunction, arg) => { val (ret, args) = uncurryTypeFunction(innerFunction) From 3bcb91b2f241fbdeb1dd5f34537b48c30be1543f Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 10:57:58 -0700 Subject: [PATCH 178/323] Incremental --- morphir/runtime/src/org/finos/morphir/runtime/Succinct.scala | 3 +++ 1 file changed, 3 insertions(+) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Succinct.scala b/morphir/runtime/src/org/finos/morphir/runtime/Succinct.scala index a648679b2..2d7555d56 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Succinct.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Succinct.scala @@ -38,4 +38,7 @@ object Succinct { def apply[VA](pattern: Pattern[VA]): String = apply(pattern, 2) } + object TypeSpec{ + def apply[TA](spec : T.Specification[TA, depth : Int]) + } } From 678399d6e2cc0ae6db674723879fb1a70d8523d6 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 10:58:46 -0700 Subject: [PATCH 179/323] Incremental --- morphir/runtime/src/org/finos/morphir/runtime/Succinct.scala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Succinct.scala b/morphir/runtime/src/org/finos/morphir/runtime/Succinct.scala index 2d7555d56..04c34c7b9 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Succinct.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Succinct.scala @@ -39,6 +39,7 @@ object Succinct { } object TypeSpec{ - def apply[TA](spec : T.Specification[TA, depth : Int]) + def apply[TA](spec : T.Specification[TA], depth : Int) : String + def apply[TA](spec : T.Specification[TA]) : String= apply(spec, 2) } } From 4648ea4b64c17d534196fed5a671dc072000b187 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 10:59:14 -0700 Subject: [PATCH 180/323] Incremental --- .../runtime/src/org/finos/morphir/runtime/Succinct.scala | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Succinct.scala b/morphir/runtime/src/org/finos/morphir/runtime/Succinct.scala index 04c34c7b9..17d09ae9e 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Succinct.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Succinct.scala @@ -39,7 +39,11 @@ object Succinct { } object TypeSpec{ - def apply[TA](spec : T.Specification[TA], depth : Int) : String + def apply[TA](spec : T.Specification[TA], depth : Int) : String = { + spec match{ + case other => other.getClass.getSimpleName + } + } def apply[TA](spec : T.Specification[TA]) : String= apply(spec, 2) } } From a6a666e5f851e902adee98d3b360e95ac39a3196 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 11:00:44 -0700 Subject: [PATCH 181/323] Incremental --- .../src/org/finos/morphir/runtime/MorphirTypeError.scala | 2 +- morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala index 23acac589..0905b7d3a 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala @@ -19,7 +19,7 @@ object MorphirTypeError { def succinct[TA, VA](value: Value[TA, VA]): String = Succinct.Value(value) def succinct[TA](tpe: Type[TA]): String = Succinct.Type(tpe) - def succinct[TA](spec: T.Specification[TA]): String = Succinct.Type(spec.getClass.simpleName()) + def succinct[TA](spec: T.Specification[TA]): String = Succinct.TypeSpec(spec) case class TypesMismatch(tpe1: UType, tpe2: UType, msg: String) extends MorphirTypeError(s"$msg: ${succinct(tpe1)} vs ${succinct(tpe2)}") case class ArgumentDoesNotMatchParameter(arg: TypedValue, param: UType) extends MorphirTypeError( diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index e938fcc7b..19b99b706 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -184,7 +184,7 @@ class TypeChecker(dists: Distributions) { val fromChildren = List() val (ret, args) = Utils.uncurryFunctionType(tpe) //TODO: Interleaved function type w/ aliases. val fromTpe = ret match{ - case Type.ReferenCe(_, name, typeArgs) => dists.lookupTypeSpecification(name) match { + case Type.Reference(_, name, typeArgs) => dists.lookupTypeSpecification(name) match { case Right(T.Specification.CustomTypeSpecification(typeParams, ctors)) => // (typeArgs.zip(typeParams)).flatMap{case (arg, param) => checkTypesAgree(arg, param, context)} List() From d71cf27d964abb793818cf5bb79d5ca8814f1469 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 11:02:55 -0700 Subject: [PATCH 182/323] Incremental --- .../src/org/finos/morphir/runtime/MorphirTypeError.scala | 6 ++++++ .../runtime/src/org/finos/morphir/runtime/TypeChecker.scala | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala index 0905b7d3a..f52a866f1 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala @@ -20,14 +20,18 @@ object MorphirTypeError { def succinct[TA](tpe: Type[TA]): String = Succinct.Type(tpe) def succinct[TA](spec: T.Specification[TA]): String = Succinct.TypeSpec(spec) + case class TypesMismatch(tpe1: UType, tpe2: UType, msg: String) extends MorphirTypeError(s"$msg: ${succinct(tpe1)} vs ${succinct(tpe2)}") + case class ArgumentDoesNotMatchParameter(arg: TypedValue, param: UType) extends MorphirTypeError( s"Argument ${succinct(arg)} of type ${succinct(arg.attributes)} does not match parameter ${succinct(param)}" ) + case class ApplyToNonFunction(nonFunction: TypedValue, arg: TypedValue) extends MorphirTypeError( s"Tried to apply ${succinct(arg)} to ${succinct(nonFunction)} of type ${succinct(nonFunction.attributes)}, which is not a function" ) + case class LiteralTypeMismatch(lit : Lit, tpe : UType) extends MorphirTypeError(s"Literal $lit is not of type ${succinct(tpe)}") case class ImproperType(tpe: UType, msg: String) extends MorphirTypeError(s"$msg. Found: ${succinct(tpe)}") @@ -36,6 +40,8 @@ object MorphirTypeError { extends MorphirTypeError(s"$msg: ${err.getMsg}") case class TypeVariableMissing(name : Name) extends MorphirTypeError(s"Missing type variable $name.toTitleCase") case class DefinitionMissing(err : LookupError) extends MorphirTypeError(s"Cannot find definition: ${err.getMsg}") + + case class TypeMissing(err: LookupError) extends MorphirTypeError(s"Cannot find type: ${err.getMsg}") case class ConstructorMissing(err: LookupError, tpe: UType) extends MorphirTypeError(s"Cannot find definition of type ${succinct(tpe)}: ${err.getMsg}") case class ModuleMissing(modName: ModuleName) extends MorphirTypeError("Todo") case class PackageMissing(pckName: PackageName) extends MorphirTypeError("Todo") diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 19b99b706..ecd192307 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -191,7 +191,7 @@ class TypeChecker(dists: Distributions) { // TODO: Constructor specific checks case Right(other) => List(new ImproperTypeSpec(name, other, s"Type union expected")) - case Left(err) => List(new ConstructorMissing(err)) + case Left(err) => List(new TypeMissing(err)) } } // TODO: Check it's a function onion for a type with that constructor From eccc3298a5694651506d889f2d103c94402232cc Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 11:04:19 -0700 Subject: [PATCH 183/323] Incremental --- morphir/runtime/src/org/finos/morphir/runtime/Utils.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala index f30d97cf3..46203d05e 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala @@ -163,9 +163,9 @@ object Utils { } def uncurryFunctionType(functionTpe : UType) : (UType, Chunk[UType]) = { - functioTpe match { + functionTpe match { case Type.Function(_, innerFunction, arg) => { - val (ret, args) = uncurryTypeFunction(innerFunction) + val (ret, args) = uncurryFunctionType(innerFunction) (ret, args :+ arg) } case other => (other, Chunk()) From 7cf62399771405992be2a980ad8ebb5b85def8e9 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 11:05:33 -0700 Subject: [PATCH 184/323] Incremental --- morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala | 1 + 1 file changed, 1 insertion(+) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index ecd192307..1ce842fb5 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -193,6 +193,7 @@ class TypeChecker(dists: Distributions) { List(new ImproperTypeSpec(name, other, s"Type union expected")) case Left(err) => List(new TypeMissing(err)) } + case other => List(new ImproperType(other, s"Reference to type union expected")) } // TODO: Check it's a function onion for a type with that constructor fromChildren From 9da115ff82258c4a020727e6df75b7a8549e7c05 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 11:13:51 -0700 Subject: [PATCH 185/323] Incremental --- .../org/finos/morphir/runtime/MorphirTypeError.scala | 2 +- .../src/org/finos/morphir/runtime/TypeChecker.scala | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala index f52a866f1..09cbfc314 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala @@ -40,8 +40,8 @@ object MorphirTypeError { extends MorphirTypeError(s"$msg: ${err.getMsg}") case class TypeVariableMissing(name : Name) extends MorphirTypeError(s"Missing type variable $name.toTitleCase") case class DefinitionMissing(err : LookupError) extends MorphirTypeError(s"Cannot find definition: ${err.getMsg}") - case class TypeMissing(err: LookupError) extends MorphirTypeError(s"Cannot find type: ${err.getMsg}") + case class OtherTypeError(msg : String) extends MorphirTypeError(msg) case class ConstructorMissing(err: LookupError, tpe: UType) extends MorphirTypeError(s"Cannot find definition of type ${succinct(tpe)}: ${err.getMsg}") case class ModuleMissing(modName: ModuleName) extends MorphirTypeError("Todo") case class PackageMissing(pckName: PackageName) extends MorphirTypeError("Todo") diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 1ce842fb5..68f2e3e75 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -187,8 +187,14 @@ class TypeChecker(dists: Distributions) { case Type.Reference(_, name, typeArgs) => dists.lookupTypeSpecification(name) match { case Right(T.Specification.CustomTypeSpecification(typeParams, ctors)) => // (typeArgs.zip(typeParams)).flatMap{case (arg, param) => checkTypesAgree(arg, param, context)} - List() - // TODO: Constructor specific checks + val missedName = helper(fqn.packageName != name.packageName || fqn.moduleName != name.moduleName, new OtherTypeError(s"Constructor $fqn does not match type name $name")) + val fromCtor = ctors.get(fqn.localName) match { + case Some => List() + //TODO: compare args to ctor args + case None => List(new OtherTypeError(s"Constructor type $name exists, but does not have arm for ${fqn.localName}")) + } + missedName ++ fromCtor + //TODO: Bindings case Right(other) => List(new ImproperTypeSpec(name, other, s"Type union expected")) case Left(err) => List(new TypeMissing(err)) From bb1dda2920fc61322817a44117332d5aa6378ff6 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 11:19:54 -0700 Subject: [PATCH 186/323] Incremental --- .../runtime/src/org/finos/morphir/runtime/TypeChecker.scala | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 68f2e3e75..98eec7472 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -187,9 +187,9 @@ class TypeChecker(dists: Distributions) { case Type.Reference(_, name, typeArgs) => dists.lookupTypeSpecification(name) match { case Right(T.Specification.CustomTypeSpecification(typeParams, ctors)) => // (typeArgs.zip(typeParams)).flatMap{case (arg, param) => checkTypesAgree(arg, param, context)} - val missedName = helper(fqn.packageName != name.packageName || fqn.moduleName != name.moduleName, new OtherTypeError(s"Constructor $fqn does not match type name $name")) - val fromCtor = ctors.get(fqn.localName) match { - case Some => List() + val missedName = helper(fqn.packagePath != name.packagePath || fqn.modulePath != name.modulePath, new OtherTypeError(s"Constructor $fqn does not match type name $name")) + val fromCtor = ctors.toMap.get(fqn.localName) match { + case Some(_) => List() //TODO: compare args to ctor args case None => List(new OtherTypeError(s"Constructor type $name exists, but does not have arm for ${fqn.localName}")) } From 5d5a4650567a530d9e8131687fa008fc142db761 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 11:23:39 -0700 Subject: [PATCH 187/323] Incremental --- .../runtime/src/org/finos/morphir/runtime/TypeChecker.scala | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 98eec7472..c68c31692 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -103,6 +103,10 @@ class TypeChecker(dists: Distributions) { //Note reversed order - covariance vs. contravariance. conformsTo(valueRet, declaredRet, context) ++ conformsTo(declaredArg, valueArg, context) } + case (DictRef(firstKey, firstValue), DictRef(secondKey, secondValue)) => + conformsTo(firstKey, secondKey, context) ++ conformsTo(firstValue, secondValue, context) + case (ResultRef(firstErr, firstOk), ResultRef(secondErr, secondOk)) => + conformsTo(firstErr, secondErr, context) ++ conformsTo(firstOk, secondOk, context) } } @@ -186,7 +190,6 @@ class TypeChecker(dists: Distributions) { val fromTpe = ret match{ case Type.Reference(_, name, typeArgs) => dists.lookupTypeSpecification(name) match { case Right(T.Specification.CustomTypeSpecification(typeParams, ctors)) => - // (typeArgs.zip(typeParams)).flatMap{case (arg, param) => checkTypesAgree(arg, param, context)} val missedName = helper(fqn.packagePath != name.packagePath || fqn.modulePath != name.modulePath, new OtherTypeError(s"Constructor $fqn does not match type name $name")) val fromCtor = ctors.toMap.get(fqn.localName) match { case Some(_) => List() From ec3c607d2a233d7b753b7609fc8b622ff5937df8 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 11:26:05 -0700 Subject: [PATCH 188/323] Incremental --- .../runtime/src/org/finos/morphir/runtime/TypeChecker.scala | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index c68c31692..e92e76544 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -103,10 +103,14 @@ class TypeChecker(dists: Distributions) { //Note reversed order - covariance vs. contravariance. conformsTo(valueRet, declaredRet, context) ++ conformsTo(declaredArg, valueArg, context) } + //TODO: Consider covariance/contravariance case (DictRef(firstKey, firstValue), DictRef(secondKey, secondValue)) => conformsTo(firstKey, secondKey, context) ++ conformsTo(firstValue, secondValue, context) case (ResultRef(firstErr, firstOk), ResultRef(secondErr, secondOk)) => conformsTo(firstErr, secondErr, context) ++ conformsTo(firstOk, secondOk, context) + case (ListRef(firstElement), ListRef(secondElement)) => conformsTo(firstElement, secondElement, context) + case (MaybeRef(firstElement), MaybeRef(secondElement)) => + conformsTo(firstElement, secondElement, context) } } From 3277e2fbd1b5033cdd5ece56c5e3581393c39669 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 11:27:06 -0700 Subject: [PATCH 189/323] Incremental --- .../src/org/finos/morphir/runtime/TypeChecker.scala | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index e92e76544..1e24fcd3e 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -103,6 +103,15 @@ class TypeChecker(dists: Distributions) { //Note reversed order - covariance vs. contravariance. conformsTo(valueRet, declaredRet, context) ++ conformsTo(declaredArg, valueArg, context) } + case (first@Type.Tuple(_, firstElements), second@Type.Tuple(_, secondElements)) => + if (firstElements.length != secondElements.length) { + List(new TupleWrongSize(first, second)) + } else { + firstElements.toList.zip(secondElements).flatMap { + case (first, second) => + checkTypesAgree(first, second, context) + } + } //TODO: Consider covariance/contravariance case (DictRef(firstKey, firstValue), DictRef(secondKey, secondValue)) => conformsTo(firstKey, secondKey, context) ++ conformsTo(firstValue, secondValue, context) From 60e8595673edba91a7943b83b8d131e6156a2f35 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 11:32:21 -0700 Subject: [PATCH 190/323] Incremental --- .../src/org/finos/morphir/runtime/TypeChecker.scala | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 1e24fcd3e..60bbba217 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -105,11 +105,11 @@ class TypeChecker(dists: Distributions) { } case (first@Type.Tuple(_, firstElements), second@Type.Tuple(_, secondElements)) => if (firstElements.length != secondElements.length) { - List(new TupleWrongSize(first, second)) + List(new TypesMismatch(first, second, s"Tuple sizes differ (${firstElements.length} vs ${secondElements.length})")) } else { firstElements.toList.zip(secondElements).flatMap { case (first, second) => - checkTypesAgree(first, second, context) + conformsTo(first, second, context) } } //TODO: Consider covariance/contravariance @@ -120,7 +120,8 @@ class TypeChecker(dists: Distributions) { case (ListRef(firstElement), ListRef(secondElement)) => conformsTo(firstElement, secondElement, context) case (MaybeRef(firstElement), MaybeRef(secondElement)) => conformsTo(firstElement, secondElement, context) - + case (firstOther, secondOther) if firstOther.getClass == secondOther.getClass => List(new Unimplemented(s"No matching support for ${Succinct.Type(firstOther)} vs ${Succinct.Type(secondOther)}")) + case (firstOther, secondOther) => List(new TypesMismatch(firstOther, secondOther, "Different types")) } } From 90715dca688ce16e8c7de4b8c32b18bc0d9f3295 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 11:34:08 -0700 Subject: [PATCH 191/323] Incremental --- .../src/org/finos/morphir/runtime/TypeChecker.scala | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 60bbba217..e5782e23c 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -112,6 +112,15 @@ class TypeChecker(dists: Distributions) { conformsTo(first, second, context) } } + case (Type.Record(_, firstFields), Type.Record(_, secondFields)) => + if (firstFields.length != secondFields.length) { + List(new TypesMismatch(first, second, "Record lengths differ (${firstField.length} vs ${secondElements.length})")) // TODO: Details! + } else { + firstFields.toList.zip(secondFields).flatMap { + case (firstField, secondField) => + conformsTo(firstField.data, secondField.data, context) + } + } //TODO: Consider covariance/contravariance case (DictRef(firstKey, firstValue), DictRef(secondKey, secondValue)) => conformsTo(firstKey, secondKey, context) ++ conformsTo(firstValue, secondValue, context) From 35ca3e6a492f555b93e4701ce6458a9e587ee785 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 11:35:15 -0700 Subject: [PATCH 192/323] Incremental --- .../src/org/finos/morphir/runtime/TypeChecker.scala | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index e5782e23c..3748e79d4 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -112,7 +112,14 @@ class TypeChecker(dists: Distributions) { conformsTo(first, second, context) } } - case (Type.Record(_, firstFields), Type.Record(_, secondFields)) => + case (Type.Record(_, firstFields), Type.Record(_, secondFields)) => { + val tpeFieldSet: Set[Name] = tpeFields.map(_._1).toSet + val valFieldSet: Set[Name] = valFields.map(_._1).toSet + // println(s"Type checking a record and we see ${tpeFieldSet.map(_._1)} vs ${valFieldSet.map(_._1)}") + val missingFromTpe = tpeFieldSet + .diff(valFieldSet).toList.map(missing => MissingRecordField(recordTpe, missing)) + val missingFromValue = valFieldSet + .diff(tpeFieldSet).toList.map(bonus => ExtraRecordField(recordTpe, bonus)) if (firstFields.length != secondFields.length) { List(new TypesMismatch(first, second, "Record lengths differ (${firstField.length} vs ${secondElements.length})")) // TODO: Details! } else { @@ -121,6 +128,7 @@ class TypeChecker(dists: Distributions) { conformsTo(firstField.data, secondField.data, context) } } + } //TODO: Consider covariance/contravariance case (DictRef(firstKey, firstValue), DictRef(secondKey, secondValue)) => conformsTo(firstKey, secondKey, context) ++ conformsTo(firstValue, secondValue, context) From 997e8f6faed6bf2929dfcf0ace9be068cfe258d9 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 11:36:21 -0700 Subject: [PATCH 193/323] Incremental --- .../finos/morphir/runtime/TypeChecker.scala | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 3748e79d4..7f1367703 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -103,16 +103,16 @@ class TypeChecker(dists: Distributions) { //Note reversed order - covariance vs. contravariance. conformsTo(valueRet, declaredRet, context) ++ conformsTo(declaredArg, valueArg, context) } - case (first@Type.Tuple(_, firstElements), second@Type.Tuple(_, secondElements)) => - if (firstElements.length != secondElements.length) { - List(new TypesMismatch(first, second, s"Tuple sizes differ (${firstElements.length} vs ${secondElements.length})")) + case (value@Type.Tuple(_, valueElements), declared@Type.Tuple(_, declaredElements)) => + if (valueElements.length != declaredElements.length) { + List(new TypesMismatch(value, declared, s"Tuple sizes differ (${valueElements.length} vs ${declaredElements.length})")) } else { - firstElements.toList.zip(secondElements).flatMap { - case (first, second) => - conformsTo(first, second, context) + valueElements.toList.zip(declaredElements).flatMap { + case (value, declared) => + conformsTo(value, declared, context) } } - case (Type.Record(_, firstFields), Type.Record(_, secondFields)) => { + case (Type.Record(_, valueFields), Type.Record(_, declaredFields)) => { val tpeFieldSet: Set[Name] = tpeFields.map(_._1).toSet val valFieldSet: Set[Name] = valFields.map(_._1).toSet // println(s"Type checking a record and we see ${tpeFieldSet.map(_._1)} vs ${valFieldSet.map(_._1)}") @@ -120,25 +120,25 @@ class TypeChecker(dists: Distributions) { .diff(valFieldSet).toList.map(missing => MissingRecordField(recordTpe, missing)) val missingFromValue = valFieldSet .diff(tpeFieldSet).toList.map(bonus => ExtraRecordField(recordTpe, bonus)) - if (firstFields.length != secondFields.length) { - List(new TypesMismatch(first, second, "Record lengths differ (${firstField.length} vs ${secondElements.length})")) // TODO: Details! + if (valueFields.length != declaredFields.length) { + List(new TypesMismatch(value, declared, "Record lengths differ (${valueField.length} vs ${declaredElements.length})")) // TODO: Details! } else { - firstFields.toList.zip(secondFields).flatMap { - case (firstField, secondField) => - conformsTo(firstField.data, secondField.data, context) + valueFields.toList.zip(declaredFields).flatMap { + case (valueField, declaredField) => + conformsTo(valueField.data, declaredField.data, context) } } } //TODO: Consider covariance/contravariance - case (DictRef(firstKey, firstValue), DictRef(secondKey, secondValue)) => - conformsTo(firstKey, secondKey, context) ++ conformsTo(firstValue, secondValue, context) - case (ResultRef(firstErr, firstOk), ResultRef(secondErr, secondOk)) => - conformsTo(firstErr, secondErr, context) ++ conformsTo(firstOk, secondOk, context) - case (ListRef(firstElement), ListRef(secondElement)) => conformsTo(firstElement, secondElement, context) - case (MaybeRef(firstElement), MaybeRef(secondElement)) => - conformsTo(firstElement, secondElement, context) - case (firstOther, secondOther) if firstOther.getClass == secondOther.getClass => List(new Unimplemented(s"No matching support for ${Succinct.Type(firstOther)} vs ${Succinct.Type(secondOther)}")) - case (firstOther, secondOther) => List(new TypesMismatch(firstOther, secondOther, "Different types")) + case (DictRef(valueKey, valueValue), DictRef(declaredKey, declaredValue)) => + conformsTo(valueKey, declaredKey, context) ++ conformsTo(valueValue, declaredValue, context) + case (ResultRef(valueErr, valueOk), ResultRef(declaredErr, declaredOk)) => + conformsTo(valueErr, declaredErr, context) ++ conformsTo(valueOk, declaredOk, context) + case (ListRef(valueElement), ListRef(declaredElement)) => conformsTo(valueElement, declaredElement, context) + case (MaybeRef(valueElement), MaybeRef(declaredElement)) => + conformsTo(valueElement, declaredElement, context) + case (valueOther, declaredOther) if valueOther.getClass == declaredOther.getClass => List(new Unimplemented(s"No matching support for ${Succinct.Type(valueOther)} vs ${Succinct.Type(declaredOther)}")) + case (valueOther, declaredOther) => List(new TypesMismatch(valueOther, declaredOther, "Different types")) } } From 2140a7afe7b93f3c8a4e191f45cfd975f54dd5f9 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 11:39:26 -0700 Subject: [PATCH 194/323] Incremental --- .../src/org/finos/morphir/runtime/TypeChecker.scala | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 7f1367703..bb85d2eba 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -113,13 +113,12 @@ class TypeChecker(dists: Distributions) { } } case (Type.Record(_, valueFields), Type.Record(_, declaredFields)) => { - val tpeFieldSet: Set[Name] = tpeFields.map(_._1).toSet - val valFieldSet: Set[Name] = valFields.map(_._1).toSet - // println(s"Type checking a record and we see ${tpeFieldSet.map(_._1)} vs ${valFieldSet.map(_._1)}") - val missingFromTpe = tpeFieldSet - .diff(valFieldSet).toList.map(missing => MissingRecordField(recordTpe, missing)) - val missingFromValue = valFieldSet - .diff(tpeFieldSet).toList.map(bonus => ExtraRecordField(recordTpe, bonus)) + val valueFieldSet: Set[Name] = valueFields.map(_._1).toSet + val declaredFieldSet: Set[Name] = declaredFields.map(_._1).toSet + val missingFromValue= valueFieldSet + .diff(declaredFieldSet).toList.map(missing => TypeLacksField(recordTpe, missing)) + val missingFromDeclared = declaredFieldSet + .diff(valueFieldSet).toList.map(bonus => TypeHasExtraField(recordTpe, bonus)) if (valueFields.length != declaredFields.length) { List(new TypesMismatch(value, declared, "Record lengths differ (${valueField.length} vs ${declaredElements.length})")) // TODO: Details! } else { From c8b618eab1af3223b34c70ec7571892e61171ac8 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 11:42:22 -0700 Subject: [PATCH 195/323] Incremental --- .../src/org/finos/morphir/runtime/MorphirTypeError.scala | 2 ++ 1 file changed, 2 insertions(+) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala index 09cbfc314..e91e831a5 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala @@ -42,6 +42,8 @@ object MorphirTypeError { case class DefinitionMissing(err : LookupError) extends MorphirTypeError(s"Cannot find definition: ${err.getMsg}") case class TypeMissing(err: LookupError) extends MorphirTypeError(s"Cannot find type: ${err.getMsg}") case class OtherTypeError(msg : String) extends MorphirTypeError(msg) + case class TypeLacksField(tpe : UType, contract : UType, field : Name) extends MorphirTypeError(s"${suscinct(tpe)} lacks field ${field.toCamelCase}, which is required by ${succinct(contract)}") + case class TypeHasExtraField(tpe: UType, contract: UType, field: Name) extends MorphirTypeError(s"${suscinct(tpe)} has field ${field.toCamelCase}, which is not included in ${succinct(contract)}") case class ConstructorMissing(err: LookupError, tpe: UType) extends MorphirTypeError(s"Cannot find definition of type ${succinct(tpe)}: ${err.getMsg}") case class ModuleMissing(modName: ModuleName) extends MorphirTypeError("Todo") case class PackageMissing(pckName: PackageName) extends MorphirTypeError("Todo") From 27250685e81b84f5eee22a987a57db2684d9a25f Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 11:45:55 -0700 Subject: [PATCH 196/323] Incremental --- .../src/org/finos/morphir/runtime/MorphirTypeError.scala | 3 +++ .../runtime/src/org/finos/morphir/runtime/TypeChecker.scala | 3 +-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala index e91e831a5..5f3bbe44a 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala @@ -44,6 +44,9 @@ object MorphirTypeError { case class OtherTypeError(msg : String) extends MorphirTypeError(msg) case class TypeLacksField(tpe : UType, contract : UType, field : Name) extends MorphirTypeError(s"${suscinct(tpe)} lacks field ${field.toCamelCase}, which is required by ${succinct(contract)}") case class TypeHasExtraField(tpe: UType, contract: UType, field: Name) extends MorphirTypeError(s"${suscinct(tpe)} has field ${field.toCamelCase}, which is not included in ${succinct(contract)}") + case class TypeHasDifferentFieldType(first : UType, second : UType, field : Name, firstTpe : UType, secondTpe : UType) extends MorphirTypeError( + s"tpe for field ${field.toCamelCase} is ${succinct(firstTpe)} in ${succinct(first)} but ${succinct(secondTpe)} in ${succinct(second)}" + ) case class ConstructorMissing(err: LookupError, tpe: UType) extends MorphirTypeError(s"Cannot find definition of type ${succinct(tpe)}: ${err.getMsg}") case class ModuleMissing(modName: ModuleName) extends MorphirTypeError("Todo") case class PackageMissing(pckName: PackageName) extends MorphirTypeError("Todo") diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index bb85d2eba..37c13ca8b 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -119,8 +119,7 @@ class TypeChecker(dists: Distributions) { .diff(declaredFieldSet).toList.map(missing => TypeLacksField(recordTpe, missing)) val missingFromDeclared = declaredFieldSet .diff(valueFieldSet).toList.map(bonus => TypeHasExtraField(recordTpe, bonus)) - if (valueFields.length != declaredFields.length) { - List(new TypesMismatch(value, declared, "Record lengths differ (${valueField.length} vs ${declaredElements.length})")) // TODO: Details! + valudFieldSet.intersect(declaredFieldSet) } else { valueFields.toList.zip(declaredFields).flatMap { case (valueField, declaredField) => From 67437dcf2c205c1066782735fa352d1d832caa5e Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 11:49:11 -0700 Subject: [PATCH 197/323] Incremental --- .../src/org/finos/morphir/runtime/TypeChecker.scala | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 37c13ca8b..a24d119cc 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -119,13 +119,11 @@ class TypeChecker(dists: Distributions) { .diff(declaredFieldSet).toList.map(missing => TypeLacksField(recordTpe, missing)) val missingFromDeclared = declaredFieldSet .diff(valueFieldSet).toList.map(bonus => TypeHasExtraField(recordTpe, bonus)) - valudFieldSet.intersect(declaredFieldSet) - } else { - valueFields.toList.zip(declaredFields).flatMap { - case (valueField, declaredField) => - conformsTo(valueField.data, declaredField.data, context) - } - } + val sharedFields = valueFieldSet.intersect(declaredFieldSet) + val valueFieldMap: Map[Name, TypedValue] = valueFields.map(field => field.name -> field.data).toMap + val declaredFieldMap: Map[Name, UType] = declaredFields.map(field => field.name -> field.data).toMap + val conflicts = sharedFields.map(field => conformsTo(valueFieldMap(field), declaredFieldMap(field), context)) + missingFromValue ++ missingFromDeclared ++ conflicts } //TODO: Consider covariance/contravariance case (DictRef(valueKey, valueValue), DictRef(declaredKey, declaredValue)) => From 5c8967c368d80f5406ebf5483c212bfdc542004c Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 11:56:07 -0700 Subject: [PATCH 198/323] Incremental --- .../finos/morphir/runtime/MorphirTypeError.scala | 4 ++-- .../src/org/finos/morphir/runtime/TypeChecker.scala | 13 ++++++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala index 5f3bbe44a..d0c6b3a11 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala @@ -42,8 +42,8 @@ object MorphirTypeError { case class DefinitionMissing(err : LookupError) extends MorphirTypeError(s"Cannot find definition: ${err.getMsg}") case class TypeMissing(err: LookupError) extends MorphirTypeError(s"Cannot find type: ${err.getMsg}") case class OtherTypeError(msg : String) extends MorphirTypeError(msg) - case class TypeLacksField(tpe : UType, contract : UType, field : Name) extends MorphirTypeError(s"${suscinct(tpe)} lacks field ${field.toCamelCase}, which is required by ${succinct(contract)}") - case class TypeHasExtraField(tpe: UType, contract: UType, field: Name) extends MorphirTypeError(s"${suscinct(tpe)} has field ${field.toCamelCase}, which is not included in ${succinct(contract)}") + case class TypeLacksField(tpe : UType, contract : UType, field : Name) extends MorphirTypeError(s"${succinct(tpe)} lacks field ${field.toCamelCase}, which is required by ${succinct(contract)}") + case class TypeHasExtraField(tpe: UType, contract: UType, field: Name) extends MorphirTypeError(s"${succinct(tpe)} has field ${field.toCamelCase}, which is not included in ${succinct(contract)}") case class TypeHasDifferentFieldType(first : UType, second : UType, field : Name, firstTpe : UType, secondTpe : UType) extends MorphirTypeError( s"tpe for field ${field.toCamelCase} is ${succinct(firstTpe)} in ${succinct(first)} but ${succinct(secondTpe)} in ${succinct(second)}" ) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index a24d119cc..2dab44686 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -112,17 +112,17 @@ class TypeChecker(dists: Distributions) { conformsTo(value, declared, context) } } - case (Type.Record(_, valueFields), Type.Record(_, declaredFields)) => { + case (valueTpe @ Type.Record(_, valueFields), declaredTpe @Type.Record(_, declaredFields)) => { val valueFieldSet: Set[Name] = valueFields.map(_._1).toSet val declaredFieldSet: Set[Name] = declaredFields.map(_._1).toSet val missingFromValue= valueFieldSet - .diff(declaredFieldSet).toList.map(missing => TypeLacksField(recordTpe, missing)) + .diff(declaredFieldSet).toList.map(missing => TypeLacksField(valueTpe, declaredTpe, missing)) val missingFromDeclared = declaredFieldSet - .diff(valueFieldSet).toList.map(bonus => TypeHasExtraField(recordTpe, bonus)) + .diff(valueFieldSet).toList.map(bonus => TypeHasExtraField(valueTpe, declaredTpe, bonus)) val sharedFields = valueFieldSet.intersect(declaredFieldSet) - val valueFieldMap: Map[Name, TypedValue] = valueFields.map(field => field.name -> field.data).toMap + val valueFieldMap: Map[Name, UType] = valueFields.map(field => field.name -> field.data).toMap val declaredFieldMap: Map[Name, UType] = declaredFields.map(field => field.name -> field.data).toMap - val conflicts = sharedFields.map(field => conformsTo(valueFieldMap(field), declaredFieldMap(field), context)) + val conflicts = sharedFields.flatMap(field => conformsTo(valueFieldMap(field), declaredFieldMap(field), context)) missingFromValue ++ missingFromDeclared ++ conflicts } //TODO: Consider covariance/contravariance @@ -133,6 +133,9 @@ class TypeChecker(dists: Distributions) { case (ListRef(valueElement), ListRef(declaredElement)) => conformsTo(valueElement, declaredElement, context) case (MaybeRef(valueElement), MaybeRef(declaredElement)) => conformsTo(valueElement, declaredElement, context) + case (Type.Reference(_, valueName, valueArgs), Type.Reference(_, declaredName, declaredArgs)) if valueName == valueArgs => { + + } case (valueOther, declaredOther) if valueOther.getClass == declaredOther.getClass => List(new Unimplemented(s"No matching support for ${Succinct.Type(valueOther)} vs ${Succinct.Type(declaredOther)}")) case (valueOther, declaredOther) => List(new TypesMismatch(valueOther, declaredOther, "Different types")) } From f445eb4483f0344953beff59b4e5d7a86d463e48 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 11:58:30 -0700 Subject: [PATCH 199/323] Incremental --- .../runtime/src/org/finos/morphir/runtime/TypeChecker.scala | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 2dab44686..8b1d2e071 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -134,7 +134,11 @@ class TypeChecker(dists: Distributions) { case (MaybeRef(valueElement), MaybeRef(declaredElement)) => conformsTo(valueElement, declaredElement, context) case (Type.Reference(_, valueName, valueArgs), Type.Reference(_, declaredName, declaredArgs)) if valueName == valueArgs => { - + if (valueArgs.length != declaredArgs.length) + List(new OtherTypeError(s"Reference $valueName has different number of parameters (${valueArgs.length} vs ${declaredArgs.length}")) + else + valueArgs.zip(declaredArgs).map{case (declared, value) => conformsTo(declard, Value)} + } case (valueOther, declaredOther) if valueOther.getClass == declaredOther.getClass => List(new Unimplemented(s"No matching support for ${Succinct.Type(valueOther)} vs ${Succinct.Type(declaredOther)}")) case (valueOther, declaredOther) => List(new TypesMismatch(valueOther, declaredOther, "Different types")) From b972c1aac688504fca7cf3a83d1060497c12c53a Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 12:00:00 -0700 Subject: [PATCH 200/323] Incremental --- morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala | 2 ++ 1 file changed, 2 insertions(+) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 8b1d2e071..08d4f4a48 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -41,6 +41,7 @@ object TypeChecker { class TypeChecker(dists: Distributions) { import TypeChecker.* private val functionOnion = Extractors.Types.FunctionOnion(dists) + private val dealiased = Extractors.Types.Dealiased(dists) private def nameThatMismatch(tpe1: UType, tpe2: UType): String = { import Extractors.Types.* (tpe1, tpe2) match { @@ -139,6 +140,7 @@ class TypeChecker(dists: Distributions) { else valueArgs.zip(declaredArgs).map{case (declared, value) => conformsTo(declard, Value)} + } case (valueOther, declaredOther) if valueOther.getClass == declaredOther.getClass => List(new Unimplemented(s"No matching support for ${Succinct.Type(valueOther)} vs ${Succinct.Type(declaredOther)}")) case (valueOther, declaredOther) => List(new TypesMismatch(valueOther, declaredOther, "Different types")) From 1403f1a4c742a58425bf49151225dda508ca6279 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 12:02:12 -0700 Subject: [PATCH 201/323] Incremental --- .../runtime/src/org/finos/morphir/runtime/TypeChecker.scala | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 08d4f4a48..18807d232 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -138,10 +138,12 @@ class TypeChecker(dists: Distributions) { if (valueArgs.length != declaredArgs.length) List(new OtherTypeError(s"Reference $valueName has different number of parameters (${valueArgs.length} vs ${declaredArgs.length}")) else - valueArgs.zip(declaredArgs).map{case (declared, value) => conformsTo(declard, Value)} + valueArgs.zip(declaredArgs).map{case (value, declared) => conformsTo(value, declared, context)} } + case (dealiased(value, valueArgs), declared) => conformsTo(value, declared, context) //TODO: Bindings, left side only! + case (value, dealiased(declared, declaredArgs)) => conformsTo(value, declared, context) //TODO: Bindings, right side only! case (valueOther, declaredOther) if valueOther.getClass == declaredOther.getClass => List(new Unimplemented(s"No matching support for ${Succinct.Type(valueOther)} vs ${Succinct.Type(declaredOther)}")) case (valueOther, declaredOther) => List(new TypesMismatch(valueOther, declaredOther, "Different types")) } From 09428f6781efafb14d92f4f2ba7dd9ab539c391b Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 12:09:24 -0700 Subject: [PATCH 202/323] Incremental --- .../src/org/finos/morphir/runtime/TypeChecker.scala | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 18807d232..756d96bbb 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -138,9 +138,7 @@ class TypeChecker(dists: Distributions) { if (valueArgs.length != declaredArgs.length) List(new OtherTypeError(s"Reference $valueName has different number of parameters (${valueArgs.length} vs ${declaredArgs.length}")) else - valueArgs.zip(declaredArgs).map{case (value, declared) => conformsTo(value, declared, context)} - - + valueArgs.zip(declaredArgs).toList.flatMap{case (value, declared) => conformsTo(value, declared, context)} } case (dealiased(value, valueArgs), declared) => conformsTo(value, declared, context) //TODO: Bindings, left side only! case (value, dealiased(declared, declaredArgs)) => conformsTo(value, declared, context) //TODO: Bindings, right side only! @@ -323,13 +321,15 @@ class TypeChecker(dists: Distributions) { } def handleReference(tpe: UType, fqn: FQName, context: Context): TypeCheckerResult = { val fromChildren = List() - val fromType = dists.lookupValueSpecification(fqn) match{ + val fromType = if (!Utils.isNative(fqn)) { + dists.lookupValueSpecification(fqn) match{ case Left(err) => List(new DefinitionMissing(err)) case Right(spec) => { val curried = Utils.curryTypeFunction(spec.output, spec.inputs) conformsTo(curried, tpe, context) } } + } else List() //TODO: Handle native type references fromChildren ++ fromType } def handleTuple(tpe: UType, elements: List[TypedValue], context: Context): TypeCheckerResult = { From 3c26819ca0b7245fee57de74aa7921761734a435 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 12:19:35 -0700 Subject: [PATCH 203/323] Incremental --- morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 756d96bbb..36f6757ed 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -134,7 +134,7 @@ class TypeChecker(dists: Distributions) { case (ListRef(valueElement), ListRef(declaredElement)) => conformsTo(valueElement, declaredElement, context) case (MaybeRef(valueElement), MaybeRef(declaredElement)) => conformsTo(valueElement, declaredElement, context) - case (Type.Reference(_, valueName, valueArgs), Type.Reference(_, declaredName, declaredArgs)) if valueName == valueArgs => { + case (Type.Reference(_, valueName, valueArgs), Type.Reference(_, declaredName, declaredArgs)) if valueName == declaredName => { if (valueArgs.length != declaredArgs.length) List(new OtherTypeError(s"Reference $valueName has different number of parameters (${valueArgs.length} vs ${declaredArgs.length}")) else From 43bf9a56bec29af8e12785aa20c141a97a88eede Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 12:29:04 -0700 Subject: [PATCH 204/323] Incremental --- .../finos/morphir/runtime/MorphirTypeError.scala | 2 +- .../org/finos/morphir/runtime/TypeChecker.scala | 16 +++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala index d0c6b3a11..a12597831 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala @@ -42,7 +42,7 @@ object MorphirTypeError { case class DefinitionMissing(err : LookupError) extends MorphirTypeError(s"Cannot find definition: ${err.getMsg}") case class TypeMissing(err: LookupError) extends MorphirTypeError(s"Cannot find type: ${err.getMsg}") case class OtherTypeError(msg : String) extends MorphirTypeError(msg) - case class TypeLacksField(tpe : UType, contract : UType, field : Name) extends MorphirTypeError(s"${succinct(tpe)} lacks field ${field.toCamelCase}, which is required by ${succinct(contract)}") + case class TypeLacksField(tpe : UType, field : Name, msg : String) extends MorphirTypeError(s"${succinct(tpe)} lacks field ${field.toCamelCase}. $msg") case class TypeHasExtraField(tpe: UType, contract: UType, field: Name) extends MorphirTypeError(s"${succinct(tpe)} has field ${field.toCamelCase}, which is not included in ${succinct(contract)}") case class TypeHasDifferentFieldType(first : UType, second : UType, field : Name, firstTpe : UType, secondTpe : UType) extends MorphirTypeError( s"tpe for field ${field.toCamelCase} is ${succinct(firstTpe)} in ${succinct(first)} but ${succinct(secondTpe)} in ${succinct(second)}" diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 36f6757ed..d505b69a2 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -117,7 +117,7 @@ class TypeChecker(dists: Distributions) { val valueFieldSet: Set[Name] = valueFields.map(_._1).toSet val declaredFieldSet: Set[Name] = declaredFields.map(_._1).toSet val missingFromValue= valueFieldSet - .diff(declaredFieldSet).toList.map(missing => TypeLacksField(valueTpe, declaredTpe, missing)) + .diff(declaredFieldSet).toList.map(missing => TypeLacksField(valueTpe, missing, s"Required by ${Succinct.Type(declaredTpe)}")) val missingFromDeclared = declaredFieldSet .diff(valueFieldSet).toList.map(bonus => TypeHasExtraField(valueTpe, declaredTpe, bonus)) val sharedFields = valueFieldSet.intersect(declaredFieldSet) @@ -240,17 +240,23 @@ class TypeChecker(dists: Distributions) { } case other => List(new ImproperType(other, s"Reference to type union expected")) } - // TODO: Check it's a function onion for a type with that constructor fromChildren } def handleFieldValue(tpe: UType, recordValue: TypedValue, name: Name, context: Context): TypeCheckerResult = { val fromChildren = check(recordValue, context) - // TODO: Check the value dealiases to a record which has that name - fromChildren + val fromTpe = recordValue.attributes match{ + case Type.Record(_, fields) => { + fields.map(field => field.name -> field.data).toMap.get(name) match { + case None => List(new TypeLacksField(tpe, name, "Referenced by field none")) + case Some(fieldTpe) => conformsTo(fieldTpe, tpe, context) + } + } + } + fromChildren ++ fromTpe } def handleFieldFunction(tpe: UType, name: Name, context: Context): TypeCheckerResult = { val fromChildren = List() - // TODO: Uh... Nothing. + // TODO: tpe should be... function from extensible record type to ??? fromChildren } def handleIfThenElse( From efba69838074991f093cd195468d5efd23bb6065 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 12:31:01 -0700 Subject: [PATCH 205/323] Incremental --- .../runtime/src/org/finos/morphir/runtime/TypeChecker.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index d505b69a2..35f04fa27 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -267,8 +267,8 @@ class TypeChecker(dists: Distributions) { context: Context ): TypeCheckerResult = { val fromChildren = check(condition, context) ++ check(thenValue, context) ++ check(elseValue, context) - // TODO: Check condition is boolean and branches agree withe ach other/tpe - fromChildren + val internal = conformsTo(thenValue.attributes, tpe, context) ++ conformsTo(elseValue.attributes, tpe, context) ++ conformsTo(condition.attributes, Basics.boolType, context) + fromChildren ++ internal } def handleLambda(tpe: UType, pattern: Pattern[UType], body: TypedValue, context: Context): TypeCheckerResult = { val fromChildren = check(body, context) From ec0946cd863360bf130bdd349f5f73d6dad49a24 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 12:31:41 -0700 Subject: [PATCH 206/323] Incremental --- .../src/org/finos/morphir/runtime/TypeChecker.scala | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 35f04fa27..7bef0ca2f 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -303,6 +303,19 @@ class TypeChecker(dists: Distributions) { } def handleListValue(tpe: UType, elements: List[TypedValue], context: Context): TypeCheckerResult = { val fromChildren = elements.flatMap(check(_, context)) + val fromTpe = dealias(tpe, context) match { + // case Right(ListRef(elementType)) => + // val fromSignature = List() // checkTypesAgree(tpe, elementType, context) TODO: What was this? + // val fromElements = elements.foldLeft(List(): List[GoodTypeError]) { (acc, next) => + // acc ++ checkTypesAgree(elementType, next.attributes, context) + // // if (acc.size != 0) acc else { + // // checkTypesAgree(elementType, next.attributes, context) //Check each element vs. the declared element type (only keep first errors) + // // } + // } + // fromSignature ++ fromElements + // case Right(other) => List(ImproperType(other, s"Found ${other.getClass} while expecting list")) + // case Left(error) => List(error) + // } // TODO: Check tpe is a list, check children types agree w/ parent type (probably only report one mismatch, but inspect all values fromChildren } From ef23d35702087cc9ad6d924b6bdbf2a0ac375fb3 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 12:33:14 -0700 Subject: [PATCH 207/323] Incremental --- .../finos/morphir/runtime/TypeChecker.scala | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 7bef0ca2f..85c641c5f 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -303,21 +303,21 @@ class TypeChecker(dists: Distributions) { } def handleListValue(tpe: UType, elements: List[TypedValue], context: Context): TypeCheckerResult = { val fromChildren = elements.flatMap(check(_, context)) - val fromTpe = dealias(tpe, context) match { - // case Right(ListRef(elementType)) => - // val fromSignature = List() // checkTypesAgree(tpe, elementType, context) TODO: What was this? - // val fromElements = elements.foldLeft(List(): List[GoodTypeError]) { (acc, next) => - // acc ++ checkTypesAgree(elementType, next.attributes, context) - // // if (acc.size != 0) acc else { - // // checkTypesAgree(elementType, next.attributes, context) //Check each element vs. the declared element type (only keep first errors) - // // } - // } - // fromSignature ++ fromElements - // case Right(other) => List(ImproperType(other, s"Found ${other.getClass} while expecting list")) - // case Left(error) => List(error) - // } + val fromTpe = tpe match{ + case Right(ListRef(elementType)) => + val fromSignature = List() // checkTypesAgree(tpe, elementType, context) TODO: What was this? + val fromElements = elements.foldLeft(List(): List[GoodTypeError]) { (acc, next) => + acc ++ checkTypesAgree(elementType, next.attributes, context) + // if (acc.size != 0) acc else { + // checkTypesAgree(elementType, next.attributes, context) //Check each element vs. the declared element type (only keep first errors) + // } + } + fromSignature ++ fromElements + case Right(other) => List(ImproperType(other, s"Found ${other.getClass} while expecting list")) + case Left(error) => List(error) + } // TODO: Check tpe is a list, check children types agree w/ parent type (probably only report one mismatch, but inspect all values - fromChildren + fromChildren ++ fromTpe } def handlePatternMatch( tpe: UType, From 97776b4e2c005ba31a23c1e8dbed5888d7825f7f Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 12:34:02 -0700 Subject: [PATCH 208/323] Incremental --- .../runtime/src/org/finos/morphir/runtime/TypeChecker.scala | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 85c641c5f..b77a07b81 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -304,7 +304,7 @@ class TypeChecker(dists: Distributions) { def handleListValue(tpe: UType, elements: List[TypedValue], context: Context): TypeCheckerResult = { val fromChildren = elements.flatMap(check(_, context)) val fromTpe = tpe match{ - case Right(ListRef(elementType)) => + case ListRef(elementType) => val fromSignature = List() // checkTypesAgree(tpe, elementType, context) TODO: What was this? val fromElements = elements.foldLeft(List(): List[GoodTypeError]) { (acc, next) => acc ++ checkTypesAgree(elementType, next.attributes, context) @@ -313,8 +313,7 @@ class TypeChecker(dists: Distributions) { // } } fromSignature ++ fromElements - case Right(other) => List(ImproperType(other, s"Found ${other.getClass} while expecting list")) - case Left(error) => List(error) + case other=> List(ImproperType(other, s"Expected list")) } // TODO: Check tpe is a list, check children types agree w/ parent type (probably only report one mismatch, but inspect all values fromChildren ++ fromTpe From 9f4910a691d3a6974def4b89b8bacecedcf62bc9 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 12:37:15 -0700 Subject: [PATCH 209/323] Incremental --- .../org/finos/morphir/runtime/TypeChecker.scala | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index b77a07b81..fc24928d2 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -302,17 +302,16 @@ class TypeChecker(dists: Distributions) { fromChildren } def handleListValue(tpe: UType, elements: List[TypedValue], context: Context): TypeCheckerResult = { + //We expect declared element types to be the same, but values may differ; so we only grab the first set of errors at the type level, but fully explore all elements. val fromChildren = elements.flatMap(check(_, context)) val fromTpe = tpe match{ case ListRef(elementType) => - val fromSignature = List() // checkTypesAgree(tpe, elementType, context) TODO: What was this? - val fromElements = elements.foldLeft(List(): List[GoodTypeError]) { (acc, next) => - acc ++ checkTypesAgree(elementType, next.attributes, context) - // if (acc.size != 0) acc else { - // checkTypesAgree(elementType, next.attributes, context) //Check each element vs. the declared element type (only keep first errors) - // } - } - fromSignature ++ fromElements + elements.foldLeft(List(): List[MorphirTypeError]) { (acc, next) => + acc ++ checkConforms(elementType, next.attributes, context) + if (acc.size != 0) acc else { + checkConforms(elementType, next.attributes, context) //Check each element vs. the declared element type (only keep first errors) + } + } case other=> List(ImproperType(other, s"Expected list")) } // TODO: Check tpe is a list, check children types agree w/ parent type (probably only report one mismatch, but inspect all values From 22eed6c701b117f261a02f77d23f9d382fbf9fc6 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 14:46:18 -0700 Subject: [PATCH 210/323] Incremental --- .../src/org/finos/morphir/runtime/TypeChecker.scala | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index fc24928d2..8c31d2ccd 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -305,16 +305,15 @@ class TypeChecker(dists: Distributions) { //We expect declared element types to be the same, but values may differ; so we only grab the first set of errors at the type level, but fully explore all elements. val fromChildren = elements.flatMap(check(_, context)) val fromTpe = tpe match{ - case ListRef(elementType) => + case Extractors.Types.ListRef(elementType) => elements.foldLeft(List(): List[MorphirTypeError]) { (acc, next) => - acc ++ checkConforms(elementType, next.attributes, context) + acc ++ conformsTo(elementType, next.attributes, context) if (acc.size != 0) acc else { - checkConforms(elementType, next.attributes, context) //Check each element vs. the declared element type (only keep first errors) + conformsTo(elementType, next.attributes, context) //Check each element vs. the declared element type (only keep first errors) } } case other=> List(ImproperType(other, s"Expected list")) } - // TODO: Check tpe is a list, check children types agree w/ parent type (probably only report one mismatch, but inspect all values fromChildren ++ fromTpe } def handlePatternMatch( @@ -332,6 +331,7 @@ class TypeChecker(dists: Distributions) { } def handleRecord(tpe: UType, fields: List[(Name, TypedValue)], context: Context): TypeCheckerResult = { val fromChildren = fields.flatMap { case (_, value) => check(value, context) } + // TODO: Check tpe dealises to a record // TODO: Check each field agrees with the type from the name fromChildren From 02466e289e13dbd46ff8ab3ce0bc3d1bb48f318c Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 14:47:26 -0700 Subject: [PATCH 211/323] Incremental --- .../src/org/finos/morphir/runtime/TypeChecker.scala | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 8c31d2ccd..1a8d35772 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -331,7 +331,14 @@ class TypeChecker(dists: Distributions) { } def handleRecord(tpe: UType, fields: List[(Name, TypedValue)], context: Context): TypeCheckerResult = { val fromChildren = fields.flatMap { case (_, value) => check(value, context) } - + + val fromTpe = dealias(tpe, context) match { + case Right(recordTpe@Type.Record(_, tpeFields)) => + ) + missingFromTpe ++ missingFromValue ++ conflicts + case Right(other) => List(ImproperType(other, s"Found ${other.getClass}while expecting record")) + case Left(error) => List(error) + } // TODO: Check tpe dealises to a record // TODO: Check each field agrees with the type from the name fromChildren From 61968eaec3d2c27310fe5b0e24fec86cd2d07d30 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 14:47:54 -0700 Subject: [PATCH 212/323] Incremental --- .../src/org/finos/morphir/runtime/TypeChecker.scala | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 1a8d35772..f73375845 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -334,6 +334,17 @@ class TypeChecker(dists: Distributions) { val fromTpe = dealias(tpe, context) match { case Right(recordTpe@Type.Record(_, tpeFields)) => + val tpeFieldSet: Set[Name] = tpeFields.map(_._1).toSet + val valFieldSet: Set[Name] = valFields.map(_._1).toSet + // println(s"Type checking a record and we see ${tpeFieldSet.map(_._1)} vs ${valFieldSet.map(_._1)}") + val missingFromTpe = tpeFieldSet + .diff(valFieldSet).toList.map(missing => MissingRecordField(recordTpe, missing)) + val missingFromValue = valFieldSet + .diff(tpeFieldSet).toList.map(bonus => ExtraRecordField(recordTpe, bonus)) + val valFieldMap: Map[Name, TypedValue] = valFields.toMap + val tpeFieldMap: Map[Name, UType] = tpeFields.map(field => field.name -> field.data).toMap + val conflicts = tpeFieldSet.intersect(valFieldSet).flatMap(name => + checkTypesAgree(valFieldMap(name).attributes, tpeFieldMap(name), context) ) missingFromTpe ++ missingFromValue ++ conflicts case Right(other) => List(ImproperType(other, s"Found ${other.getClass}while expecting record")) From 30a888be579b4df92a312f734c1632b324af60f2 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 14:52:55 -0700 Subject: [PATCH 213/323] Incremental --- .../src/org/finos/morphir/runtime/MorphirTypeError.scala | 3 +++ .../src/org/finos/morphir/runtime/TypeChecker.scala | 8 +++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala index a12597831..eb7c47101 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala @@ -44,6 +44,9 @@ object MorphirTypeError { case class OtherTypeError(msg : String) extends MorphirTypeError(msg) case class TypeLacksField(tpe : UType, field : Name, msg : String) extends MorphirTypeError(s"${succinct(tpe)} lacks field ${field.toCamelCase}. $msg") case class TypeHasExtraField(tpe: UType, contract: UType, field: Name) extends MorphirTypeError(s"${succinct(tpe)} has field ${field.toCamelCase}, which is not included in ${succinct(contract)}") + + case class ValueLacksField(value : TypedValue, contract : UType, field: Name, msg: String) extends MorphirTypeError(s"${succinct(value)} lacks field ${field.toCamelCase}, which is required by ${succinct(contract)}") + case class ValueHasExtraField(tpe: UType, contract: UType, field: Name) extends MorphirTypeError(s"${succinct(value)} has field ${field.toCamelCase}, which is not included in ${succinct(contract)}") case class TypeHasDifferentFieldType(first : UType, second : UType, field : Name, firstTpe : UType, secondTpe : UType) extends MorphirTypeError( s"tpe for field ${field.toCamelCase} is ${succinct(firstTpe)} in ${succinct(first)} but ${succinct(secondTpe)} in ${succinct(second)}" ) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index f73375845..853c0218a 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -332,11 +332,10 @@ class TypeChecker(dists: Distributions) { def handleRecord(tpe: UType, fields: List[(Name, TypedValue)], context: Context): TypeCheckerResult = { val fromChildren = fields.flatMap { case (_, value) => check(value, context) } - val fromTpe = dealias(tpe, context) match { - case Right(recordTpe@Type.Record(_, tpeFields)) => + val fromTpe = tpe match { + case recordTpe@Type.Record(_, tpeFields) => val tpeFieldSet: Set[Name] = tpeFields.map(_._1).toSet val valFieldSet: Set[Name] = valFields.map(_._1).toSet - // println(s"Type checking a record and we see ${tpeFieldSet.map(_._1)} vs ${valFieldSet.map(_._1)}") val missingFromTpe = tpeFieldSet .diff(valFieldSet).toList.map(missing => MissingRecordField(recordTpe, missing)) val missingFromValue = valFieldSet @@ -347,8 +346,7 @@ class TypeChecker(dists: Distributions) { checkTypesAgree(valFieldMap(name).attributes, tpeFieldMap(name), context) ) missingFromTpe ++ missingFromValue ++ conflicts - case Right(other) => List(ImproperType(other, s"Found ${other.getClass}while expecting record")) - case Left(error) => List(error) + case other => List(ImproperType(other, "Value is of type Record")) } // TODO: Check tpe dealises to a record // TODO: Check each field agrees with the type from the name From d9fc1336515359008f887e9ba01963ea54b09777 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 15:07:58 -0700 Subject: [PATCH 214/323] Incremental --- .../finos/morphir/runtime/MorphirTypeError.scala | 4 ++-- .../org/finos/morphir/runtime/TypeChecker.scala | 16 +++++++--------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala index eb7c47101..f13afbc25 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala @@ -45,8 +45,8 @@ object MorphirTypeError { case class TypeLacksField(tpe : UType, field : Name, msg : String) extends MorphirTypeError(s"${succinct(tpe)} lacks field ${field.toCamelCase}. $msg") case class TypeHasExtraField(tpe: UType, contract: UType, field: Name) extends MorphirTypeError(s"${succinct(tpe)} has field ${field.toCamelCase}, which is not included in ${succinct(contract)}") - case class ValueLacksField(value : TypedValue, contract : UType, field: Name, msg: String) extends MorphirTypeError(s"${succinct(value)} lacks field ${field.toCamelCase}, which is required by ${succinct(contract)}") - case class ValueHasExtraField(tpe: UType, contract: UType, field: Name) extends MorphirTypeError(s"${succinct(value)} has field ${field.toCamelCase}, which is not included in ${succinct(contract)}") + case class ValueLacksField(value : TypedValue, contract : UType, field: Name) extends MorphirTypeError(s"${succinct(value)} lacks field ${field.toCamelCase}, which is required by ${succinct(contract)}") + case class ValueHasExtraField(value : TypedValue, contract: UType, field: Name) extends MorphirTypeError(s"${succinct(value)} has field ${field.toCamelCase}, which is not included in ${succinct(contract)}") case class TypeHasDifferentFieldType(first : UType, second : UType, field : Name, firstTpe : UType, secondTpe : UType) extends MorphirTypeError( s"tpe for field ${field.toCamelCase} is ${succinct(firstTpe)} in ${succinct(first)} but ${succinct(secondTpe)} in ${succinct(second)}" ) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 853c0218a..304301db8 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -169,7 +169,7 @@ class TypeChecker(dists: Distributions) { case LetRecursion(_, definitions, inValue) => handleLetRecursion(tpe, definitions, inValue, context) case ListValue(_, elements) => handleListValue(tpe, elements.toList, context) case PatternMatch(_, value, cases) => handlePatternMatch(tpe, value, cases.toList, context) - case Record(_, fields) => handleRecord(tpe, fields.toList, context) + case recordValue @Record(_, fields) => handleRecord(tpe, fields.toList, recordValue, context) case Reference(_, name) => handleReference(tpe, name, context) case Tuple(_, elements) => handleTuple(tpe, elements.toList, context) case UnitValue(_) => handleUnitValue(tpe, context) @@ -329,28 +329,26 @@ class TypeChecker(dists: Distributions) { // TODO: Check value must be one of the patterns fromChildren } - def handleRecord(tpe: UType, fields: List[(Name, TypedValue)], context: Context): TypeCheckerResult = { - val fromChildren = fields.flatMap { case (_, value) => check(value, context) } + def handleRecord(tpe: UType, valFields: List[(Name, TypedValue)], value : Value.Record[Unit, UType], context: Context): TypeCheckerResult = { + val fromChildren = valFields.flatMap { case (_, value) => check(value, context) } val fromTpe = tpe match { case recordTpe@Type.Record(_, tpeFields) => val tpeFieldSet: Set[Name] = tpeFields.map(_._1).toSet val valFieldSet: Set[Name] = valFields.map(_._1).toSet val missingFromTpe = tpeFieldSet - .diff(valFieldSet).toList.map(missing => MissingRecordField(recordTpe, missing)) + .diff(valFieldSet).toList.map(missing => ValueLacksField(value, recordTpe, missing)) val missingFromValue = valFieldSet - .diff(tpeFieldSet).toList.map(bonus => ExtraRecordField(recordTpe, bonus)) + .diff(tpeFieldSet).toList.map(bonus => ValueHasExtraField(value ,recordTpe, bonus)) val valFieldMap: Map[Name, TypedValue] = valFields.toMap val tpeFieldMap: Map[Name, UType] = tpeFields.map(field => field.name -> field.data).toMap val conflicts = tpeFieldSet.intersect(valFieldSet).flatMap(name => - checkTypesAgree(valFieldMap(name).attributes, tpeFieldMap(name), context) + conformsTo(valFieldMap(name).attributes, tpeFieldMap(name), context) ) missingFromTpe ++ missingFromValue ++ conflicts case other => List(ImproperType(other, "Value is of type Record")) } - // TODO: Check tpe dealises to a record - // TODO: Check each field agrees with the type from the name - fromChildren + fromChildren ++ fromTpe } def handleReference(tpe: UType, fqn: FQName, context: Context): TypeCheckerResult = { val fromChildren = List() From 6bfe038499e83027abc063ea72c144b9925ca1f4 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 15:08:34 -0700 Subject: [PATCH 215/323] Incremental --- .../src/org/finos/morphir/runtime/TypeChecker.scala | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 304301db8..68b28da78 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -364,6 +364,17 @@ class TypeChecker(dists: Distributions) { fromChildren ++ fromType } def handleTuple(tpe: UType, elements: List[TypedValue], context: Context): TypeCheckerResult = { + val fromTpe = tpe match { + // case tupleTpe@Type.Tuple(_, elementTypes) => + // helper( + // elementTypes.length != elements.length, + // new TupleSizeMismatch(tupleTpe, elementTypes.length, elements.length) + // ) ++ + // (elements.map(_.attributes)).zip(elementTypes).flatMap { case (actual, declared) => + // checkTypesAgree(actual, declared, context) + // } + // case other => List(new ImproperType(other, "Tuple expected")) + // } val fromChildren = elements.flatMap(check(_, context)) // TODO: Check tpe dealiases to a tuple // TODO: Check tuple types vs. nested value types From 8a283a07ff6620ddaafa1bea1e09b1b83c2a76ec Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 15:09:02 -0700 Subject: [PATCH 216/323] Incremental --- .../finos/morphir/runtime/TypeChecker.scala | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 68b28da78..528ab1294 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -365,16 +365,16 @@ class TypeChecker(dists: Distributions) { } def handleTuple(tpe: UType, elements: List[TypedValue], context: Context): TypeCheckerResult = { val fromTpe = tpe match { - // case tupleTpe@Type.Tuple(_, elementTypes) => - // helper( - // elementTypes.length != elements.length, - // new TupleSizeMismatch(tupleTpe, elementTypes.length, elements.length) - // ) ++ - // (elements.map(_.attributes)).zip(elementTypes).flatMap { case (actual, declared) => - // checkTypesAgree(actual, declared, context) - // } - // case other => List(new ImproperType(other, "Tuple expected")) - // } + case tupleTpe@Type.Tuple(_, elementTypes) => + helper( + elementTypes.length != elements.length, + new TupleSizeMismatch(tupleTpe, elementTypes.length, elements.length) + ) ++ + (elements.map(_.attributes)).zip(elementTypes).flatMap { case (actual, declared) => + checkTypesAgree(actual, declared, context) + } + case other => List(new ImproperType(other, "Tuple expected")) + } val fromChildren = elements.flatMap(check(_, context)) // TODO: Check tpe dealiases to a tuple // TODO: Check tuple types vs. nested value types From d831b1821a73b46ce626c54513239c7668414ae7 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 15:11:09 -0700 Subject: [PATCH 217/323] Incremental --- .../finos/morphir/runtime/TypeChecker.scala | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 528ab1294..9200e0cee 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -365,16 +365,16 @@ class TypeChecker(dists: Distributions) { } def handleTuple(tpe: UType, elements: List[TypedValue], context: Context): TypeCheckerResult = { val fromTpe = tpe match { - case tupleTpe@Type.Tuple(_, elementTypes) => - helper( - elementTypes.length != elements.length, - new TupleSizeMismatch(tupleTpe, elementTypes.length, elements.length) - ) ++ - (elements.map(_.attributes)).zip(elementTypes).flatMap { case (actual, declared) => - checkTypesAgree(actual, declared, context) - } - case other => List(new ImproperType(other, "Tuple expected")) - } + case tupleTpe@Type.Tuple(_, elementTypes) => + helper( + elementTypes.length != elements.length, + new OtherTypeError(s"Value typed as tuple with ${elementTypes.length} elements has ${elements.length} elements.") + ) ++ + (elements.map(_.attributes)).zip(elementTypes).flatMap { case (actual, declared) => + checkTypesAgree(actual, declared, context) + } + case other => List(new ImproperType(other, "Tuple expected")) + } val fromChildren = elements.flatMap(check(_, context)) // TODO: Check tpe dealiases to a tuple // TODO: Check tuple types vs. nested value types From 80924d2ade25badfc08867d41080b22f7c87c258 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 15 Aug 2023 15:16:45 -0700 Subject: [PATCH 218/323] Incremental --- .../finos/morphir/runtime/Extractors.scala | 11 +- .../morphir/runtime/MorphirTypeError.scala | 47 ++-- .../org/finos/morphir/runtime/Succinct.scala | 9 +- .../finos/morphir/runtime/TypeChecker.scala | 248 ++++++++++-------- .../src/org/finos/morphir/runtime/Utils.scala | 8 +- .../runtime/TypeCheckerTests.scala.scala | 7 +- 6 files changed, 184 insertions(+), 146 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala b/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala index 96abd2518..c46873274 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala @@ -84,15 +84,14 @@ object Extractors { object LocalTimeRef extends CommonReference { final val tpe = sdk.LocalTime.localTimeType } - //Matches anything w/o nested subtypes - object LeafType{ - def unapply(tpe : UType) : Boolean = { + // Matches anything w/o nested subtypes + object LeafType { + def unapply(tpe: UType): Boolean = tpe match { case Type.Reference(_, _, Chunk()) => true - case Type.Unit(_) => true - case _ => false + case Type.Unit(_) => true + case _ => false } - } } object NonNativeRef { def unapply(tpe: UType): Option[(FQName, Chunk[UType])] = diff --git a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala index f13afbc25..d12a3a1a6 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala @@ -32,26 +32,37 @@ object MorphirTypeError { s"Tried to apply ${succinct(arg)} to ${succinct(nonFunction)} of type ${succinct(nonFunction.attributes)}, which is not a function" ) - case class LiteralTypeMismatch(lit : Lit, tpe : UType) extends MorphirTypeError(s"Literal $lit is not of type ${succinct(tpe)}") + case class LiteralTypeMismatch(lit: Lit, tpe: UType) + extends MorphirTypeError(s"Literal $lit is not of type ${succinct(tpe)}") case class ImproperType(tpe: UType, msg: String) extends MorphirTypeError(s"$msg. Found: ${succinct(tpe)}") - case class ImproperTypeSpec(fqn : FQName, spec: UTypeSpec, msg: String) extends MorphirTypeError(s"$msg. $fqn points to: ${succinct(spec)}") + case class ImproperTypeSpec(fqn: FQName, spec: UTypeSpec, msg: String) + extends MorphirTypeError(s"$msg. $fqn points to: ${succinct(spec)}") case class CannotDealias(err: LookupError, msg: String = "Cannot dealias type") extends MorphirTypeError(s"$msg: ${err.getMsg}") - case class TypeVariableMissing(name : Name) extends MorphirTypeError(s"Missing type variable $name.toTitleCase") - case class DefinitionMissing(err : LookupError) extends MorphirTypeError(s"Cannot find definition: ${err.getMsg}") - case class TypeMissing(err: LookupError) extends MorphirTypeError(s"Cannot find type: ${err.getMsg}") - case class OtherTypeError(msg : String) extends MorphirTypeError(msg) - case class TypeLacksField(tpe : UType, field : Name, msg : String) extends MorphirTypeError(s"${succinct(tpe)} lacks field ${field.toCamelCase}. $msg") - case class TypeHasExtraField(tpe: UType, contract: UType, field: Name) extends MorphirTypeError(s"${succinct(tpe)} has field ${field.toCamelCase}, which is not included in ${succinct(contract)}") - - case class ValueLacksField(value : TypedValue, contract : UType, field: Name) extends MorphirTypeError(s"${succinct(value)} lacks field ${field.toCamelCase}, which is required by ${succinct(contract)}") - case class ValueHasExtraField(value : TypedValue, contract: UType, field: Name) extends MorphirTypeError(s"${succinct(value)} has field ${field.toCamelCase}, which is not included in ${succinct(contract)}") - case class TypeHasDifferentFieldType(first : UType, second : UType, field : Name, firstTpe : UType, secondTpe : UType) extends MorphirTypeError( - s"tpe for field ${field.toCamelCase} is ${succinct(firstTpe)} in ${succinct(first)} but ${succinct(secondTpe)} in ${succinct(second)}" - ) - case class ConstructorMissing(err: LookupError, tpe: UType) extends MorphirTypeError(s"Cannot find definition of type ${succinct(tpe)}: ${err.getMsg}") - case class ModuleMissing(modName: ModuleName) extends MorphirTypeError("Todo") - case class PackageMissing(pckName: PackageName) extends MorphirTypeError("Todo") - case class Unimplemented(s: String) extends MorphirTypeError(s) + case class TypeVariableMissing(name: Name) extends MorphirTypeError(s"Missing type variable $name.toTitleCase") + case class DefinitionMissing(err: LookupError) extends MorphirTypeError(s"Cannot find definition: ${err.getMsg}") + case class TypeMissing(err: LookupError) extends MorphirTypeError(s"Cannot find type: ${err.getMsg}") + case class OtherTypeError(msg: String) extends MorphirTypeError(msg) + case class TypeLacksField(tpe: UType, field: Name, msg: String) + extends MorphirTypeError(s"${succinct(tpe)} lacks field ${field.toCamelCase}. $msg") + case class TypeHasExtraField(tpe: UType, contract: UType, field: Name) extends MorphirTypeError( + s"${succinct(tpe)} has field ${field.toCamelCase}, which is not included in ${succinct(contract)}" + ) + + case class ValueLacksField(value: TypedValue, contract: UType, field: Name) extends MorphirTypeError( + s"${succinct(value)} lacks field ${field.toCamelCase}, which is required by ${succinct(contract)}" + ) + case class ValueHasExtraField(value: TypedValue, contract: UType, field: Name) extends MorphirTypeError( + s"${succinct(value)} has field ${field.toCamelCase}, which is not included in ${succinct(contract)}" + ) + case class TypeHasDifferentFieldType(first: UType, second: UType, field: Name, firstTpe: UType, secondTpe: UType) + extends MorphirTypeError( + s"tpe for field ${field.toCamelCase} is ${succinct(firstTpe)} in ${succinct(first)} but ${succinct(secondTpe)} in ${succinct(second)}" + ) + case class ConstructorMissing(err: LookupError, tpe: UType) + extends MorphirTypeError(s"Cannot find definition of type ${succinct(tpe)}: ${err.getMsg}") + case class ModuleMissing(modName: ModuleName) extends MorphirTypeError("Todo") + case class PackageMissing(pckName: PackageName) extends MorphirTypeError("Todo") + case class Unimplemented(s: String) extends MorphirTypeError(s) } diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Succinct.scala b/morphir/runtime/src/org/finos/morphir/runtime/Succinct.scala index 17d09ae9e..cf8f32c74 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Succinct.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Succinct.scala @@ -38,12 +38,11 @@ object Succinct { def apply[VA](pattern: Pattern[VA]): String = apply(pattern, 2) } - object TypeSpec{ - def apply[TA](spec : T.Specification[TA], depth : Int) : String = { - spec match{ + object TypeSpec { + def apply[TA](spec: T.Specification[TA], depth: Int): String = + spec match { case other => other.getClass.getSimpleName } - } - def apply[TA](spec : T.Specification[TA]) : String= apply(spec, 2) + def apply[TA](spec: T.Specification[TA]): String = apply(spec, 2) } } diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 9200e0cee..a92ea54a9 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -27,8 +27,8 @@ object TypeChecker { prefix: String ) { def withTypeBindings(typeBindings: Map[Name, UType]) = this.copy(typeBindings = typeBindings) - def withDepth(depth: Int) = this.copy(depth = depth) - def withPrefix(prefix: String) = this.copy(prefix = prefix) + def withDepth(depth: Int) = this.copy(depth = depth) + def withPrefix(prefix: String) = this.copy(prefix = prefix) def getTypeVariable(name: Name): Option[UType] = typeBindings.get(name) } @@ -41,7 +41,7 @@ object TypeChecker { class TypeChecker(dists: Distributions) { import TypeChecker.* private val functionOnion = Extractors.Types.FunctionOnion(dists) - private val dealiased = Extractors.Types.Dealiased(dists) + private val dealiased = Extractors.Types.Dealiased(dists) private def nameThatMismatch(tpe1: UType, tpe2: UType): String = { import Extractors.Types.* (tpe1, tpe2) match { @@ -85,48 +85,53 @@ class TypeChecker(dists: Distributions) { loop(tpe, None, context) } - def conformsTo(valueType: UType, declaredType: UType): List[MorphirTypeError] = conformsTo(valueType, declaredType, Context.empty) - def conformsTo(valueType : UType, declaredType : UType, context : Context) : List[MorphirTypeError] = { + def conformsTo(valueType: UType, declaredType: UType): List[MorphirTypeError] = + conformsTo(valueType, declaredType, Context.empty) + def conformsTo(valueType: UType, declaredType: UType, context: Context): List[MorphirTypeError] = { import Extractors.Types.* (valueType, declaredType) match { case (_, Type.Variable(_, name)) => context.getTypeVariable(name) match { - case None => List(new TypeVariableMissing(name)) - case Some(lookedUp) => conformsTo(valueType, lookedUp, context) //TODO: Type parameter wrangling - } + case None => List(new TypeVariableMissing(name)) + case Some(lookedUp) => conformsTo(valueType, lookedUp, context) // TODO: Type parameter wrangling + } case (Type.Variable(_, name), _) => context.getTypeVariable(name) match { - case None => List(new TypeVariableMissing(name)) - case Some(lookedUp) => conformsTo(lookedUp, declaredType, context) - } - case (left @LeafType(), right @ LeafType()) => { - if (left == right) List() else List(TypesMismatch(left, right, "Value type does not match declared type")) - } - case (Type.Function(_, valueArg, valueRet), Type.Function(_, declaredArg, declaredRet)) => { - //Note reversed order - covariance vs. contravariance. - conformsTo(valueRet, declaredRet, context) ++ conformsTo(declaredArg, valueArg, context) + case None => List(new TypeVariableMissing(name)) + case Some(lookedUp) => conformsTo(lookedUp, declaredType, context) } - case (value@Type.Tuple(_, valueElements), declared@Type.Tuple(_, declaredElements)) => + case (left @ LeafType(), right @ LeafType()) => + if (left == right) List() else List(TypesMismatch(left, right, "Value type does not match declared type")) + case (Type.Function(_, valueArg, valueRet), Type.Function(_, declaredArg, declaredRet)) => + // Note reversed order - covariance vs. contravariance. + conformsTo(valueRet, declaredRet, context) ++ conformsTo(declaredArg, valueArg, context) + case (value @ Type.Tuple(_, valueElements), declared @ Type.Tuple(_, declaredElements)) => if (valueElements.length != declaredElements.length) { - List(new TypesMismatch(value, declared, s"Tuple sizes differ (${valueElements.length} vs ${declaredElements.length})")) + List(new TypesMismatch( + value, + declared, + s"Tuple sizes differ (${valueElements.length} vs ${declaredElements.length})" + )) } else { valueElements.toList.zip(declaredElements).flatMap { case (value, declared) => conformsTo(value, declared, context) } } - case (valueTpe @ Type.Record(_, valueFields), declaredTpe @Type.Record(_, declaredFields)) => { - val valueFieldSet: Set[Name] = valueFields.map(_._1).toSet + case (valueTpe @ Type.Record(_, valueFields), declaredTpe @ Type.Record(_, declaredFields)) => + val valueFieldSet: Set[Name] = valueFields.map(_._1).toSet val declaredFieldSet: Set[Name] = declaredFields.map(_._1).toSet - val missingFromValue= valueFieldSet - .diff(declaredFieldSet).toList.map(missing => TypeLacksField(valueTpe, missing, s"Required by ${Succinct.Type(declaredTpe)}")) + val missingFromValue = valueFieldSet + .diff(declaredFieldSet).toList.map(missing => + TypeLacksField(valueTpe, missing, s"Required by ${Succinct.Type(declaredTpe)}") + ) val missingFromDeclared = declaredFieldSet .diff(valueFieldSet).toList.map(bonus => TypeHasExtraField(valueTpe, declaredTpe, bonus)) - val sharedFields = valueFieldSet.intersect(declaredFieldSet) - val valueFieldMap: Map[Name, UType] = valueFields.map(field => field.name -> field.data).toMap + val sharedFields = valueFieldSet.intersect(declaredFieldSet) + val valueFieldMap: Map[Name, UType] = valueFields.map(field => field.name -> field.data).toMap val declaredFieldMap: Map[Name, UType] = declaredFields.map(field => field.name -> field.data).toMap - val conflicts = sharedFields.flatMap(field => conformsTo(valueFieldMap(field), declaredFieldMap(field), context)) + val conflicts = + sharedFields.flatMap(field => conformsTo(valueFieldMap(field), declaredFieldMap(field), context)) missingFromValue ++ missingFromDeclared ++ conflicts - } - //TODO: Consider covariance/contravariance + // TODO: Consider covariance/contravariance case (DictRef(valueKey, valueValue), DictRef(declaredKey, declaredValue)) => conformsTo(valueKey, declaredKey, context) ++ conformsTo(valueValue, declaredValue, context) case (ResultRef(valueErr, valueOk), ResultRef(declaredErr, declaredOk)) => @@ -134,15 +139,22 @@ class TypeChecker(dists: Distributions) { case (ListRef(valueElement), ListRef(declaredElement)) => conformsTo(valueElement, declaredElement, context) case (MaybeRef(valueElement), MaybeRef(declaredElement)) => conformsTo(valueElement, declaredElement, context) - case (Type.Reference(_, valueName, valueArgs), Type.Reference(_, declaredName, declaredArgs)) if valueName == declaredName => { + case (Type.Reference(_, valueName, valueArgs), Type.Reference(_, declaredName, declaredArgs)) + if valueName == declaredName => if (valueArgs.length != declaredArgs.length) - List(new OtherTypeError(s"Reference $valueName has different number of parameters (${valueArgs.length} vs ${declaredArgs.length}")) + List(new OtherTypeError( + s"Reference $valueName has different number of parameters (${valueArgs.length} vs ${declaredArgs.length}" + )) else - valueArgs.zip(declaredArgs).toList.flatMap{case (value, declared) => conformsTo(value, declared, context)} - } - case (dealiased(value, valueArgs), declared) => conformsTo(value, declared, context) //TODO: Bindings, left side only! - case (value, dealiased(declared, declaredArgs)) => conformsTo(value, declared, context) //TODO: Bindings, right side only! - case (valueOther, declaredOther) if valueOther.getClass == declaredOther.getClass => List(new Unimplemented(s"No matching support for ${Succinct.Type(valueOther)} vs ${Succinct.Type(declaredOther)}")) + valueArgs.zip(declaredArgs).toList.flatMap { case (value, declared) => conformsTo(value, declared, context) } + case (dealiased(value, valueArgs), declared) => + conformsTo(value, declared, context) // TODO: Bindings, left side only! + case (value, dealiased(declared, declaredArgs)) => + conformsTo(value, declared, context) // TODO: Bindings, right side only! + case (valueOther, declaredOther) if valueOther.getClass == declaredOther.getClass => + List( + new Unimplemented(s"No matching support for ${Succinct.Type(valueOther)} vs ${Succinct.Type(declaredOther)}") + ) case (valueOther, declaredOther) => List(new TypesMismatch(valueOther, declaredOther, "Different types")) } } @@ -152,30 +164,30 @@ class TypeChecker(dists: Distributions) { def check(suspect: TypedValue, parentContext: Context): TypeCheckerResult = { import Value.{Unit as UnitValue, List as ListValue, Field as FieldValue, *} val context = parentContext.withDepth(parentContext.depth + 1) - dealias(suspect.attributes, context) match{ + dealias(suspect.attributes, context) match { case Right(tpe) => suspect match { - case Literal(_, lit) => handleLiteral(tpe, lit, context) - case Apply(_, function, argument) => handleApply(tpe, function, argument, context) - case Destructure(_, pattern, valueToDestruct, inValue) => - handleDestructure(tpe, pattern, valueToDestruct, inValue, context) - case Constructor(_, name) => handleConstructor(tpe, name, context) - case FieldValue(_, recordValue, name) => handleFieldValue(tpe, recordValue, name, context) - case FieldFunction(_, name) => handleFieldFunction(tpe, name, context) - case IfThenElse(_, condition, thenValue, elseValue) => - handleIfThenElse(tpe, condition, thenValue, elseValue, context) - case Lambda(_, pattern, body) => handleLambda(tpe, pattern, body, context) - case LetDefinition(_, name, definition, inValue) => - handleLetDefinition(tpe, name, definition, inValue, context) - case LetRecursion(_, definitions, inValue) => handleLetRecursion(tpe, definitions, inValue, context) - case ListValue(_, elements) => handleListValue(tpe, elements.toList, context) - case PatternMatch(_, value, cases) => handlePatternMatch(tpe, value, cases.toList, context) - case recordValue @Record(_, fields) => handleRecord(tpe, fields.toList, recordValue, context) - case Reference(_, name) => handleReference(tpe, name, context) - case Tuple(_, elements) => handleTuple(tpe, elements.toList, context) - case UnitValue(_) => handleUnitValue(tpe, context) - case UpdateRecord(_, valueToUpdate, fields) => handleUpdateRecord(tpe, valueToUpdate, fields, context) - case Variable(_, name) => handleVariable(tpe, name, context) - } + case Literal(_, lit) => handleLiteral(tpe, lit, context) + case Apply(_, function, argument) => handleApply(tpe, function, argument, context) + case Destructure(_, pattern, valueToDestruct, inValue) => + handleDestructure(tpe, pattern, valueToDestruct, inValue, context) + case Constructor(_, name) => handleConstructor(tpe, name, context) + case FieldValue(_, recordValue, name) => handleFieldValue(tpe, recordValue, name, context) + case FieldFunction(_, name) => handleFieldFunction(tpe, name, context) + case IfThenElse(_, condition, thenValue, elseValue) => + handleIfThenElse(tpe, condition, thenValue, elseValue, context) + case Lambda(_, pattern, body) => handleLambda(tpe, pattern, body, context) + case LetDefinition(_, name, definition, inValue) => + handleLetDefinition(tpe, name, definition, inValue, context) + case LetRecursion(_, definitions, inValue) => handleLetRecursion(tpe, definitions, inValue, context) + case ListValue(_, elements) => handleListValue(tpe, elements.toList, context) + case PatternMatch(_, value, cases) => handlePatternMatch(tpe, value, cases.toList, context) + case recordValue @ Record(_, fields) => handleRecord(tpe, fields.toList, recordValue, context) + case Reference(_, name) => handleReference(tpe, name, context) + case Tuple(_, elements) => handleTuple(tpe, elements.toList, context) + case UnitValue(_) => handleUnitValue(tpe, context) + case UpdateRecord(_, valueToUpdate, fields) => handleUpdateRecord(tpe, valueToUpdate, fields, context) + case Variable(_, name) => handleVariable(tpe, name, context) + } case Left(err) => List(err) } } @@ -184,13 +196,13 @@ class TypeChecker(dists: Distributions) { import Lit.* val fromChildren = List() val matchErrors = (literal, tpe) match { - case (StringLiteral (_), StringRef () ) => List () - case (FloatLiteral (_), FloatRef () ) => List () - case (CharLiteral (_), CharRef () ) => List () - case (BoolLiteral (_), BoolRef () ) => List () - case (WholeNumberLiteral (_), IntRef () ) => List () //TODO: "WholeNumberRef" extractor - case (DecimalLiteral (_), DecimalRef () ) => List () - case (otherLit, otherTpe) => List (new LiteralTypeMismatch(otherLit, otherTpe)) + case (StringLiteral(_), StringRef()) => List() + case (FloatLiteral(_), FloatRef()) => List() + case (CharLiteral(_), CharRef()) => List() + case (BoolLiteral(_), BoolRef()) => List() + case (WholeNumberLiteral(_), IntRef()) => List() // TODO: "WholeNumberRef" extractor + case (DecimalLiteral(_), DecimalRef()) => List() + case (otherLit, otherTpe) => List(new LiteralTypeMismatch(otherLit, otherTpe)) } fromChildren ++ matchErrors } @@ -200,7 +212,11 @@ class TypeChecker(dists: Distributions) { val fromTpe = dealias(function.attributes, context) match { case Right(Type.Function(_, paramType, returnType)) => - conformsTo(argument.attributes, paramType, context) ++ conformsTo(returnType, tpe, context) //TODO: Useful context lost here + conformsTo(argument.attributes, paramType, context) ++ conformsTo( + returnType, + tpe, + context + ) // TODO: Useful context lost here case Right(other) => List(new ApplyToNonFunction(function, argument)) case Left(err) => List(err) } @@ -222,35 +238,38 @@ class TypeChecker(dists: Distributions) { } def handleConstructor(tpe: UType, fqn: FQName, context: Context): TypeCheckerResult = { val fromChildren = List() - val (ret, args) = Utils.uncurryFunctionType(tpe) //TODO: Interleaved function type w/ aliases. - val fromTpe = ret match{ + val (ret, args) = Utils.uncurryFunctionType(tpe) // TODO: Interleaved function type w/ aliases. + val fromTpe = ret match { case Type.Reference(_, name, typeArgs) => dists.lookupTypeSpecification(name) match { - case Right(T.Specification.CustomTypeSpecification(typeParams, ctors)) => - val missedName = helper(fqn.packagePath != name.packagePath || fqn.modulePath != name.modulePath, new OtherTypeError(s"Constructor $fqn does not match type name $name")) - val fromCtor = ctors.toMap.get(fqn.localName) match { - case Some(_) => List() - //TODO: compare args to ctor args - case None => List(new OtherTypeError(s"Constructor type $name exists, but does not have arm for ${fqn.localName}")) - } - missedName ++ fromCtor - //TODO: Bindings - case Right(other) => - List(new ImproperTypeSpec(name, other, s"Type union expected")) - case Left(err) => List(new TypeMissing(err)) - } + case Right(T.Specification.CustomTypeSpecification(typeParams, ctors)) => + val missedName = helper( + fqn.packagePath != name.packagePath || fqn.modulePath != name.modulePath, + new OtherTypeError(s"Constructor $fqn does not match type name $name") + ) + val fromCtor = ctors.toMap.get(fqn.localName) match { + case Some(_) => List() + // TODO: compare args to ctor args + case None => + List(new OtherTypeError(s"Constructor type $name exists, but does not have arm for ${fqn.localName}")) + } + missedName ++ fromCtor + // TODO: Bindings + case Right(other) => + List(new ImproperTypeSpec(name, other, s"Type union expected")) + case Left(err) => List(new TypeMissing(err)) + } case other => List(new ImproperType(other, s"Reference to type union expected")) } fromChildren } def handleFieldValue(tpe: UType, recordValue: TypedValue, name: Name, context: Context): TypeCheckerResult = { val fromChildren = check(recordValue, context) - val fromTpe = recordValue.attributes match{ - case Type.Record(_, fields) => { + val fromTpe = recordValue.attributes match { + case Type.Record(_, fields) => fields.map(field => field.name -> field.data).toMap.get(name) match { - case None => List(new TypeLacksField(tpe, name, "Referenced by field none")) + case None => List(new TypeLacksField(tpe, name, "Referenced by field none")) case Some(fieldTpe) => conformsTo(fieldTpe, tpe, context) } - } } fromChildren ++ fromTpe } @@ -267,7 +286,11 @@ class TypeChecker(dists: Distributions) { context: Context ): TypeCheckerResult = { val fromChildren = check(condition, context) ++ check(thenValue, context) ++ check(elseValue, context) - val internal = conformsTo(thenValue.attributes, tpe, context) ++ conformsTo(elseValue.attributes, tpe, context) ++ conformsTo(condition.attributes, Basics.boolType, context) + val internal = conformsTo(thenValue.attributes, tpe, context) ++ conformsTo( + elseValue.attributes, + tpe, + context + ) ++ conformsTo(condition.attributes, Basics.boolType, context) fromChildren ++ internal } def handleLambda(tpe: UType, pattern: Pattern[UType], body: TypedValue, context: Context): TypeCheckerResult = { @@ -302,17 +325,22 @@ class TypeChecker(dists: Distributions) { fromChildren } def handleListValue(tpe: UType, elements: List[TypedValue], context: Context): TypeCheckerResult = { - //We expect declared element types to be the same, but values may differ; so we only grab the first set of errors at the type level, but fully explore all elements. + // We expect declared element types to be the same, but values may differ; so we only grab the first set of errors at the type level, but fully explore all elements. val fromChildren = elements.flatMap(check(_, context)) - val fromTpe = tpe match{ + val fromTpe = tpe match { case Extractors.Types.ListRef(elementType) => elements.foldLeft(List(): List[MorphirTypeError]) { (acc, next) => acc ++ conformsTo(elementType, next.attributes, context) - if (acc.size != 0) acc else { - conformsTo(elementType, next.attributes, context) //Check each element vs. the declared element type (only keep first errors) - } + if (acc.size != 0) acc + else { + conformsTo( + elementType, + next.attributes, + context + ) // Check each element vs. the declared element type (only keep first errors) + } } - case other=> List(ImproperType(other, s"Expected list")) + case other => List(ImproperType(other, s"Expected list")) } fromChildren ++ fromTpe } @@ -329,19 +357,24 @@ class TypeChecker(dists: Distributions) { // TODO: Check value must be one of the patterns fromChildren } - def handleRecord(tpe: UType, valFields: List[(Name, TypedValue)], value : Value.Record[Unit, UType], context: Context): TypeCheckerResult = { + def handleRecord( + tpe: UType, + valFields: List[(Name, TypedValue)], + value: Value.Record[Unit, UType], + context: Context + ): TypeCheckerResult = { val fromChildren = valFields.flatMap { case (_, value) => check(value, context) } val fromTpe = tpe match { - case recordTpe@Type.Record(_, tpeFields) => + case recordTpe @ Type.Record(_, tpeFields) => val tpeFieldSet: Set[Name] = tpeFields.map(_._1).toSet val valFieldSet: Set[Name] = valFields.map(_._1).toSet val missingFromTpe = tpeFieldSet .diff(valFieldSet).toList.map(missing => ValueLacksField(value, recordTpe, missing)) val missingFromValue = valFieldSet - .diff(tpeFieldSet).toList.map(bonus => ValueHasExtraField(value ,recordTpe, bonus)) + .diff(tpeFieldSet).toList.map(bonus => ValueHasExtraField(value, recordTpe, bonus)) val valFieldMap: Map[Name, TypedValue] = valFields.toMap - val tpeFieldMap: Map[Name, UType] = tpeFields.map(field => field.name -> field.data).toMap + val tpeFieldMap: Map[Name, UType] = tpeFields.map(field => field.name -> field.data).toMap val conflicts = tpeFieldSet.intersect(valFieldSet).flatMap(name => conformsTo(valFieldMap(name).attributes, tpeFieldMap(name), context) ) @@ -353,31 +386,30 @@ class TypeChecker(dists: Distributions) { def handleReference(tpe: UType, fqn: FQName, context: Context): TypeCheckerResult = { val fromChildren = List() val fromType = if (!Utils.isNative(fqn)) { - dists.lookupValueSpecification(fqn) match{ - case Left(err) => List(new DefinitionMissing(err)) - case Right(spec) => { - val curried = Utils.curryTypeFunction(spec.output, spec.inputs) - conformsTo(curried, tpe, context) + dists.lookupValueSpecification(fqn) match { + case Left(err) => List(new DefinitionMissing(err)) + case Right(spec) => + val curried = Utils.curryTypeFunction(spec.output, spec.inputs) + conformsTo(curried, tpe, context) } - } - } else List() //TODO: Handle native type references + } else List() // TODO: Handle native type references fromChildren ++ fromType } def handleTuple(tpe: UType, elements: List[TypedValue], context: Context): TypeCheckerResult = { val fromTpe = tpe match { - case tupleTpe@Type.Tuple(_, elementTypes) => + case tupleTpe @ Type.Tuple(_, elementTypes) => helper( elementTypes.length != elements.length, - new OtherTypeError(s"Value typed as tuple with ${elementTypes.length} elements has ${elements.length} elements.") + new OtherTypeError( + s"Value typed as tuple with ${elementTypes.length} elements has ${elements.length} elements." + ) ) ++ (elements.map(_.attributes)).zip(elementTypes).flatMap { case (actual, declared) => - checkTypesAgree(actual, declared, context) + conformsTo(actual, declared, context) } case other => List(new ImproperType(other, "Tuple expected")) } val fromChildren = elements.flatMap(check(_, context)) - // TODO: Check tpe dealiases to a tuple - // TODO: Check tuple types vs. nested value types fromChildren } def handleUnitValue(tpe: UType, context: Context): TypeCheckerResult = diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala index 46203d05e..36092aabd 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala @@ -162,20 +162,18 @@ object Utils { fqn.getPackagePath == example.getPackagePath } - def uncurryFunctionType(functionTpe : UType) : (UType, Chunk[UType]) = { + def uncurryFunctionType(functionTpe: UType): (UType, Chunk[UType]) = functionTpe match { - case Type.Function(_, innerFunction, arg) => { + case Type.Function(_, innerFunction, arg) => val (ret, args) = uncurryFunctionType(innerFunction) (ret, args :+ arg) - } case other => (other, Chunk()) } - } def curryTypeFunction[TA](inner: Type[TA], params: Chunk[(Name, Type[TA])]): Type[TA] = params match { case Chunk() => inner case chunk => - curryTypeFunction(Type.Function(inner.attributes, chunk.head._2, inner), chunk.tail) //TODO: Backwards? + curryTypeFunction(Type.Function(inner.attributes, chunk.head._2, inner), chunk.tail) // TODO: Backwards? } } diff --git a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala index 8a0984ea9..bccbf64a6 100644 --- a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala +++ b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala @@ -32,16 +32,15 @@ object TypeCheckerTests extends MorphirBaseSpec { dist <- EvaluationLibrary.loadDistributionFromFileZIO(irFilePath.toString) } yield TypeChecker(Distributions(dist))) - def testTypeConforms(tpe1: UType, tpe2 : UType)(expectedErrors : Int) : ZIO[TypeChecker, Throwable, TestResult] = { + def testTypeConforms(tpe1: UType, tpe2: UType)(expectedErrors: Int): ZIO[TypeChecker, Throwable, TestResult] = ZIO.serviceWithZIO[TypeChecker] { checker => - for{ + for { errors <- ZIO.succeed(checker.conformsTo(tpe1, tpe2)) errorMsgs = errors.map(error => s"\n\t${error.getMsg}").mkString("") assert <- if (errors.length == expectedErrors) assertCompletes else assertTrue(errorMsgs == s"Expected $expectedErrors errors") } yield assert } - } def testTypeCheck(value: TypedValue)(expectedErrors: Int): ZIO[TypeChecker, Throwable, TestResult] = ZIO.serviceWithZIO[TypeChecker] { checker => for { @@ -107,7 +106,7 @@ object TypeCheckerTests extends MorphirBaseSpec { // TODO: Other lit tests ), suite("Type confomrity")( - test("IntType is not StringType"){ + test("IntType is not StringType") { testTypeConforms(Basics.intType, sdk.String.stringType)(1) }, test("UnitType is not StringType") { From eee6665ed019c73a2ae4015c0da21ce9cab8da61 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Wed, 16 Aug 2023 08:55:22 -0700 Subject: [PATCH 219/323] Incremental --- .../src/org/finos/morphir/runtime/MorphirTypeError.scala | 3 +++ .../runtime/src/org/finos/morphir/runtime/TypeChecker.scala | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala index d12a3a1a6..db5efd06f 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala @@ -64,5 +64,8 @@ object MorphirTypeError { extends MorphirTypeError(s"Cannot find definition of type ${succinct(tpe)}: ${err.getMsg}") case class ModuleMissing(modName: ModuleName) extends MorphirTypeError("Todo") case class PackageMissing(pckName: PackageName) extends MorphirTypeError("Todo") + + abstract class SizeMismatch(first: Int, second: Int, msg: String) extends MorphirTypeError(s"$msg: ($first vs $second)") + case class ArgNumberMismatch(first: Int, second: Int, msg: String) extends SizeMismatch(first: Int, second: Int, msg: String) case class Unimplemented(s: String) extends MorphirTypeError(s) } diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index a92ea54a9..a37becf33 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -247,8 +247,8 @@ class TypeChecker(dists: Distributions) { new OtherTypeError(s"Constructor $fqn does not match type name $name") ) val fromCtor = ctors.toMap.get(fqn.localName) match { - case Some(_) => List() - // TODO: compare args to ctor args + case Some(ctorArgs) => helper(args.len != ctorArgs.len, new ) + case None => List(new OtherTypeError(s"Constructor type $name exists, but does not have arm for ${fqn.localName}")) } From d9758e7703f1ec44498d187f36560d4edbe9b98a Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Thu, 17 Aug 2023 08:05:06 -0700 Subject: [PATCH 220/323] Incremental --- .../src/Morphir/Examples/App/TypeCheckerTests.elm | 5 ++++- .../src/org/finos/morphir/runtime/TypeChecker.scala | 7 +++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/examples/morphir-elm-projects/evaluator-tests/src/Morphir/Examples/App/TypeCheckerTests.elm b/examples/morphir-elm-projects/evaluator-tests/src/Morphir/Examples/App/TypeCheckerTests.elm index a38fb6af8..643d47803 100644 --- a/examples/morphir-elm-projects/evaluator-tests/src/Morphir/Examples/App/TypeCheckerTests.elm +++ b/examples/morphir-elm-projects/evaluator-tests/src/Morphir/Examples/App/TypeCheckerTests.elm @@ -1,4 +1,7 @@ module Morphir.Examples.App.TypeCheckerTests exposing (..) intToInt : Int -> Int -intToInt x = x \ No newline at end of file +intToInt x = x + +tupleUp : t -> t -> (t, t) +tupleUp x y = (x, y) \ No newline at end of file diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index a37becf33..85f9c0a41 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -60,7 +60,10 @@ class TypeChecker(dists: Distributions) { private def nameMissingValue(value: TypedValue, dists: Distributions): MorphirTypeError = ??? private def nameMissingType(fqn: FQName, dists: Distributions): MorphirTypeError = ??? private def nameMissingConstructor(fqn: FQName, tpe: UType, dists: Distributions): MorphirTypeError = ??? - + def checkList(argList : List[UType], paramList : List[UType], value : TypedValue, contract : UType, context : Context) = { //Maybe that should be in context? + if (argList.size != paramList.size) + new ArgNumberMismatch(argList.size, paramList.size, s"Incorrect arity between ") + } def dealias(tpe: UType, context: Context): Either[MorphirTypeError, UType] = { def loop(tpe: UType, original_fqn: Option[FQName], context: Context): Either[MorphirTypeError, UType] = tpe match { @@ -247,7 +250,7 @@ class TypeChecker(dists: Distributions) { new OtherTypeError(s"Constructor $fqn does not match type name $name") ) val fromCtor = ctors.toMap.get(fqn.localName) match { - case Some(ctorArgs) => helper(args.len != ctorArgs.len, new ) + case Some(ctorArgs) => List()//helper(args.len != ctorArgs.len, new ) case None => List(new OtherTypeError(s"Constructor type $name exists, but does not have arm for ${fqn.localName}")) From bf6280d4cba92182f1b6af767b759e321d2f7c13 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Thu, 17 Aug 2023 08:06:07 -0700 Subject: [PATCH 221/323] Incremental --- .../evaluator-tests/morphir-ir.json | 125 ++++++++++++++++++ 1 file changed, 125 insertions(+) diff --git a/examples/morphir-elm-projects/evaluator-tests/morphir-ir.json b/examples/morphir-elm-projects/evaluator-tests/morphir-ir.json index acf392f29..4a6a53a43 100644 --- a/examples/morphir-elm-projects/evaluator-tests/morphir-ir.json +++ b/examples/morphir-elm-projects/evaluator-tests/morphir-ir.json @@ -158804,6 +158804,131 @@ } } } + ], + [ + [ + "tuple", + "up" + ], + { + "access": "Public", + "value": { + "doc": "", + "value": { + "inputTypes": [ + [ + [ + "x" + ], + [ + "Variable", + {}, + [ + "t" + ] + ], + [ + "Variable", + {}, + [ + "t" + ] + ] + ], + [ + [ + "y" + ], + [ + "Variable", + {}, + [ + "t" + ] + ], + [ + "Variable", + {}, + [ + "t" + ] + ] + ] + ], + "outputType": [ + "Tuple", + {}, + [ + [ + "Variable", + {}, + [ + "t" + ] + ], + [ + "Variable", + {}, + [ + "t" + ] + ] + ] + ], + "body": [ + "Tuple", + [ + "Tuple", + {}, + [ + [ + "Variable", + {}, + [ + "t" + ] + ], + [ + "Variable", + {}, + [ + "t" + ] + ] + ] + ], + [ + [ + "Variable", + [ + "Variable", + {}, + [ + "t" + ] + ], + [ + "x" + ] + ], + [ + "Variable", + [ + "Variable", + {}, + [ + "t" + ] + ], + [ + "y" + ] + ] + ] + ] + } + } + } ] ], "doc": null From f302b8c392e3bd23af19fc8760aec8502da57905 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 22 Aug 2023 12:54:17 -0700 Subject: [PATCH 222/323] Incremental --- .../runtime/quick/QuickMorphirRuntime.scala | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala b/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala index 824a094a2..39aaf13b6 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala @@ -31,13 +31,16 @@ private[runtime] case class QuickMorphirRuntime(dists: Distributions, store: Sto res <- evaluate(Value.Reference.Typed(tpe, entryPoint), params) } yield res - def evaluate(value: Value[scala.Unit, UType]): RTAction[MorphirEnv, EvaluationError, Data] = + def evaluate(value: Value[scala.Unit, UType]): RTAction[MorphirEnv, EvaluationError, Data] = { val errors = new TypeChecker(dists).check(value) for { ctx <- ZPure.get[RTExecutionContext] - _ <- if (errors.length == 0) RTAction.succeed(()) else RTAction.fail(TypeCheckerErrors(errors)) + _ <- if (errors.length == 0) RTAction.succeed(()) else { + RTAction.fail(TypeCheckerErrors(errors)) + } res <- EvaluatorQuick.evalAction(value, store, dists) } yield res + } def fetchType(fqn: FQName): RTAction[MorphirEnv, MorphirRuntimeError, UType] = { val maybeSpec = dists.lookupValueSpecification(fqn) @@ -47,6 +50,13 @@ private[runtime] case class QuickMorphirRuntime(dists: Distributions, store: Sto } } + def typeCheck(value: Value[scala.Unit, UType]) : RTAction[MorphirEnv, MorphirRuntimeError, Unit] = for { + ctx <- ZPure.get[RTExecutionContext] + result <- ctx.options.enableTyper match { + } + + } yield Result + def applyParams( entryPoint: Value[scala.Unit, UType], params: Value[scala.Unit, UType]* From 29ec7fb1e6683e475a60f36b07ef91565326707f Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 22 Aug 2023 12:57:29 -0700 Subject: [PATCH 223/323] Incremental --- .../runtime/quick/QuickMorphirRuntime.scala | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala b/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala index 39aaf13b6..a454cc7c3 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala @@ -32,12 +32,14 @@ private[runtime] case class QuickMorphirRuntime(dists: Distributions, store: Sto } yield res def evaluate(value: Value[scala.Unit, UType]): RTAction[MorphirEnv, EvaluationError, Data] = { - val errors = new TypeChecker(dists).check(value) + //val errors = new TypeChecker(dists).check(value) for { - ctx <- ZPure.get[RTExecutionContext] - _ <- if (errors.length == 0) RTAction.succeed(()) else { - RTAction.fail(TypeCheckerErrors(errors)) - } +// ctx <- ZPure.get[RTExecutionContext] +// +// _ <- if (errors.length == 0) RTAction.succeed(()) else { +// RTAction.fail(TypeCheckerErrors(errors)) +// } + _ <- typeCheck(value) res <- EvaluatorQuick.evalAction(value, store, dists) } yield res } @@ -53,9 +55,11 @@ private[runtime] case class QuickMorphirRuntime(dists: Distributions, store: Sto def typeCheck(value: Value[scala.Unit, UType]) : RTAction[MorphirEnv, MorphirRuntimeError, Unit] = for { ctx <- ZPure.get[RTExecutionContext] result <- ctx.options.enableTyper match { + case EnableTyper.Disabled => RTAction.succeed(()) + case EnableTyper.Warn => RTAction.succeed(()) + case EnableTyper.Enabled => RTAction.succeed(()) } - - } yield Result + } yield result def applyParams( entryPoint: Value[scala.Unit, UType], From f55e430928b8391b8ee4f82853e9ff1e30b7c9e4 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 22 Aug 2023 13:08:47 -0700 Subject: [PATCH 224/323] Incremental --- morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala | 3 ++- .../org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala b/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala index c46873274..58b35a5e2 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala @@ -9,6 +9,7 @@ import org.finos.morphir.ir.sdk.Basics import org.finos.morphir.ir.Field import org.finos.morphir.runtime.exports.* import zio.Chunk +import Extractors.Types object Extractors { @@ -128,7 +129,7 @@ object Extractors { } class FunctionOnion(dists: Distributions) { - val dealiaser = Dealiased(dists) + val dealiaser = new Dealiased(dists) def unapply(tpe: UType): Option[(UType, List[UType])] = { val myself = this diff --git a/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala b/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala index a454cc7c3..a4b06ff39 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala @@ -52,7 +52,7 @@ private[runtime] case class QuickMorphirRuntime(dists: Distributions, store: Sto } } - def typeCheck(value: Value[scala.Unit, UType]) : RTAction[MorphirEnv, MorphirRuntimeError, Unit] = for { + def typeCheck(value: Value[scala.Unit, UType]) : RTAction[MorphirEnv, EvaluationError, Unit] = for { ctx <- ZPure.get[RTExecutionContext] result <- ctx.options.enableTyper match { case EnableTyper.Disabled => RTAction.succeed(()) From 8ead4ab63ac05fc75bbff24f3f7eb81da5c9ee9e Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 22 Aug 2023 13:12:50 -0700 Subject: [PATCH 225/323] Incremental --- .../src/org/finos/morphir/runtime/TypeChecker.scala | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 85f9c0a41..488942a2c 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -40,8 +40,8 @@ object TypeChecker { class TypeChecker(dists: Distributions) { import TypeChecker.* - private val functionOnion = Extractors.Types.FunctionOnion(dists) - private val dealiased = Extractors.Types.Dealiased(dists) + private val functionOnion = new Extractors.Types.FunctionOnion(dists) + private val dealiased = new Extractors.Types.Dealiased(dists) private def nameThatMismatch(tpe1: UType, tpe2: UType): String = { import Extractors.Types.* (tpe1, tpe2) match { @@ -120,8 +120,8 @@ class TypeChecker(dists: Distributions) { } } case (valueTpe @ Type.Record(_, valueFields), declaredTpe @ Type.Record(_, declaredFields)) => - val valueFieldSet: Set[Name] = valueFields.map(_._1).toSet - val declaredFieldSet: Set[Name] = declaredFields.map(_._1).toSet + val valueFieldSet: Set[Name] = valueFields.map(_.name).toSet + val declaredFieldSet: Set[Name] = declaredFields.map(_.name).toSet val missingFromValue = valueFieldSet .diff(declaredFieldSet).toList.map(missing => TypeLacksField(valueTpe, missing, s"Required by ${Succinct.Type(declaredTpe)}") @@ -370,7 +370,7 @@ class TypeChecker(dists: Distributions) { val fromTpe = tpe match { case recordTpe @ Type.Record(_, tpeFields) => - val tpeFieldSet: Set[Name] = tpeFields.map(_._1).toSet + val tpeFieldSet: Set[Name] = tpeFields.map(_.name).toSet val valFieldSet: Set[Name] = valFields.map(_._1).toSet val missingFromTpe = tpeFieldSet .diff(valFieldSet).toList.map(missing => ValueLacksField(value, recordTpe, missing)) From 83fc2eed440a52ae81dac4659e4d1a8f28fba31a Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 22 Aug 2023 13:18:13 -0700 Subject: [PATCH 226/323] Incremental --- .../finos/morphir/runtime/quick/QuickMorphirRuntime.scala | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala b/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala index a4b06ff39..9c64daf4e 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala @@ -55,9 +55,9 @@ private[runtime] case class QuickMorphirRuntime(dists: Distributions, store: Sto def typeCheck(value: Value[scala.Unit, UType]) : RTAction[MorphirEnv, EvaluationError, Unit] = for { ctx <- ZPure.get[RTExecutionContext] result <- ctx.options.enableTyper match { - case EnableTyper.Disabled => RTAction.succeed(()) - case EnableTyper.Warn => RTAction.succeed(()) - case EnableTyper.Enabled => RTAction.succeed(()) + case EnableTyper.Disabled => RTAction.succeed[RTExecutionContext, Unit](()) + case EnableTyper.Warn => RTAction.succeed[RTExecutionContext, Unit](()) + case EnableTyper.Enabled => RTAction.succeed[RTExecutionContext, Unit](()) } } yield result From 562c3b627c2a6f494f832eb06371a2f0f9c3c612 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 22 Aug 2023 13:20:33 -0700 Subject: [PATCH 227/323] Incremental --- .../runtime/src/org/finos/morphir/runtime/quick/Result.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/quick/Result.scala b/morphir/runtime/src/org/finos/morphir/runtime/quick/Result.scala index 0f8b8c454..84584530a 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/quick/Result.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/quick/Result.scala @@ -50,7 +50,7 @@ object Result { case class Tuple[TA, VA](elements: Any) extends Result[TA, VA] { override def succinct(depth: Int) = if (depth == 0) "Tuple(...)" else { - s"Tuple(${Helpers.tupleToList(elements).map(_.asInstanceOf[Result[TA, VA]]).map(_.succinct(depth - 1)).mkString(", ")})" + s"Tuple(${Helpers.tupleToList(elements).map((res : Any) => res.asInstanceOf[Result[TA, VA]]).map(_.succinct(depth - 1)).mkString(", ")})" } } From ba9fdccb2a0d40ef6d5d2de81b08224b8bb9f21c Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 22 Aug 2023 13:21:28 -0700 Subject: [PATCH 228/323] Incremental --- morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala | 1 + 1 file changed, 1 insertion(+) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 488942a2c..7e298aff7 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -273,6 +273,7 @@ class TypeChecker(dists: Distributions) { case None => List(new TypeLacksField(tpe, name, "Referenced by field none")) case Some(fieldTpe) => conformsTo(fieldTpe, tpe, context) } + case other => List(new ImproperType(other, s"Reference type expected")) } fromChildren ++ fromTpe } From e806727ca908008909e743d8ff3a29cd706245bf Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 22 Aug 2023 13:26:31 -0700 Subject: [PATCH 229/323] Incremental --- .../org/finos/morphir/runtime/TypeCheckerTests.scala.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala index bccbf64a6..d8745478f 100644 --- a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala +++ b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala @@ -30,7 +30,7 @@ object TypeCheckerTests extends MorphirBaseSpec { irFilePath <- ZIO.succeed(os.pwd / "examples" / "morphir-elm-projects" / "evaluator-tests" / "morphir-ir.json") _ <- Console.printLine(s"Loading distribution from $irFilePath") dist <- EvaluationLibrary.loadDistributionFromFileZIO(irFilePath.toString) - } yield TypeChecker(Distributions(dist))) + } yield new TypeChecker(Distributions(dist))) def testTypeConforms(tpe1: UType, tpe2: UType)(expectedErrors: Int): ZIO[TypeChecker, Throwable, TestResult] = ZIO.serviceWithZIO[TypeChecker] { checker => @@ -110,7 +110,7 @@ object TypeCheckerTests extends MorphirBaseSpec { testTypeConforms(Basics.intType, sdk.String.stringType)(1) }, test("UnitType is not StringType") { - testTypeConforms(T.unit(()), sdk.String.stringType)(1) + testTypeConforms(T.unit, sdk.String.stringType)(1) } ) ).provideLayerShared(typeCheckerLayer) From 80df6c033f7ad8852a78578717d8f35c3cba0790 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 22 Aug 2023 13:30:42 -0700 Subject: [PATCH 230/323] Incremental --- .../morphir/runtime/MorphirTypeError.scala | 8 ++++--- .../finos/morphir/runtime/TypeChecker.scala | 11 +++++++--- .../runtime/quick/QuickMorphirRuntime.scala | 22 +++++++++++++------ .../finos/morphir/runtime/quick/Result.scala | 2 +- 4 files changed, 29 insertions(+), 14 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala index db5efd06f..e4ed040fb 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala @@ -65,7 +65,9 @@ object MorphirTypeError { case class ModuleMissing(modName: ModuleName) extends MorphirTypeError("Todo") case class PackageMissing(pckName: PackageName) extends MorphirTypeError("Todo") - abstract class SizeMismatch(first: Int, second: Int, msg: String) extends MorphirTypeError(s"$msg: ($first vs $second)") - case class ArgNumberMismatch(first: Int, second: Int, msg: String) extends SizeMismatch(first: Int, second: Int, msg: String) - case class Unimplemented(s: String) extends MorphirTypeError(s) + abstract class SizeMismatch(first: Int, second: Int, msg: String) + extends MorphirTypeError(s"$msg: ($first vs $second)") + case class ArgNumberMismatch(first: Int, second: Int, msg: String) + extends SizeMismatch(first: Int, second: Int, msg: String) + case class Unimplemented(s: String) extends MorphirTypeError(s) } diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 7e298aff7..30eb871c1 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -60,10 +60,15 @@ class TypeChecker(dists: Distributions) { private def nameMissingValue(value: TypedValue, dists: Distributions): MorphirTypeError = ??? private def nameMissingType(fqn: FQName, dists: Distributions): MorphirTypeError = ??? private def nameMissingConstructor(fqn: FQName, tpe: UType, dists: Distributions): MorphirTypeError = ??? - def checkList(argList : List[UType], paramList : List[UType], value : TypedValue, contract : UType, context : Context) = { //Maybe that should be in context? + def checkList( + argList: List[UType], + paramList: List[UType], + value: TypedValue, + contract: UType, + context: Context + ) = // Maybe that should be in context? if (argList.size != paramList.size) new ArgNumberMismatch(argList.size, paramList.size, s"Incorrect arity between ") - } def dealias(tpe: UType, context: Context): Either[MorphirTypeError, UType] = { def loop(tpe: UType, original_fqn: Option[FQName], context: Context): Either[MorphirTypeError, UType] = tpe match { @@ -250,7 +255,7 @@ class TypeChecker(dists: Distributions) { new OtherTypeError(s"Constructor $fqn does not match type name $name") ) val fromCtor = ctors.toMap.get(fqn.localName) match { - case Some(ctorArgs) => List()//helper(args.len != ctorArgs.len, new ) + case Some(ctorArgs) => List() // helper(args.len != ctorArgs.len, new ) case None => List(new OtherTypeError(s"Constructor type $name exists, but does not have arm for ${fqn.localName}")) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala b/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala index 9c64daf4e..87b47293f 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala @@ -31,18 +31,17 @@ private[runtime] case class QuickMorphirRuntime(dists: Distributions, store: Sto res <- evaluate(Value.Reference.Typed(tpe, entryPoint), params) } yield res - def evaluate(value: Value[scala.Unit, UType]): RTAction[MorphirEnv, EvaluationError, Data] = { - //val errors = new TypeChecker(dists).check(value) + def evaluate(value: Value[scala.Unit, UType]): RTAction[MorphirEnv, EvaluationError, Data] = + // val errors = new TypeChecker(dists).check(value) for { // ctx <- ZPure.get[RTExecutionContext] // // _ <- if (errors.length == 0) RTAction.succeed(()) else { // RTAction.fail(TypeCheckerErrors(errors)) // } - _ <- typeCheck(value) + _ <- typeCheck(value) res <- EvaluatorQuick.evalAction(value, store, dists) } yield res - } def fetchType(fqn: FQName): RTAction[MorphirEnv, MorphirRuntimeError, UType] = { val maybeSpec = dists.lookupValueSpecification(fqn) @@ -52,12 +51,21 @@ private[runtime] case class QuickMorphirRuntime(dists: Distributions, store: Sto } } - def typeCheck(value: Value[scala.Unit, UType]) : RTAction[MorphirEnv, EvaluationError, Unit] = for { + def typeCheck(value: Value[scala.Unit, UType]): RTAction[MorphirEnv, EvaluationError, Unit] = for { ctx <- ZPure.get[RTExecutionContext] result <- ctx.options.enableTyper match { case EnableTyper.Disabled => RTAction.succeed[RTExecutionContext, Unit](()) - case EnableTyper.Warn => RTAction.succeed[RTExecutionContext, Unit](()) - case EnableTyper.Enabled => RTAction.succeed[RTExecutionContext, Unit](()) + case EnableTyper.Warn => { + val errors = new TypeChecker(dists).check(value) + for error <- errors do + println(s"TYPE WARNING: $error") + RTAction.succeed[RTExecutionContext, Unit](()) + } + case EnableTyper.Enabled => { + val errors = new TypeChecker(dists).check(value) + if (errors.length ==0) RTAction.succeed[RTExecutionContext, Unit](()) + else RTAction.fail(TypeCheckerErrors(errors)) + } } } yield result diff --git a/morphir/runtime/src/org/finos/morphir/runtime/quick/Result.scala b/morphir/runtime/src/org/finos/morphir/runtime/quick/Result.scala index 84584530a..4667642c9 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/quick/Result.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/quick/Result.scala @@ -50,7 +50,7 @@ object Result { case class Tuple[TA, VA](elements: Any) extends Result[TA, VA] { override def succinct(depth: Int) = if (depth == 0) "Tuple(...)" else { - s"Tuple(${Helpers.tupleToList(elements).map((res : Any) => res.asInstanceOf[Result[TA, VA]]).map(_.succinct(depth - 1)).mkString(", ")})" + s"Tuple(${Helpers.tupleToList(elements).map((res: Any) => res.asInstanceOf[Result[TA, VA]]).map(_.succinct(depth - 1)).mkString(", ")})" } } From 34e9d205d5f3fa9fd9f80e135f926fabd14ccff0 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 22 Aug 2023 13:40:18 -0700 Subject: [PATCH 231/323] Incremental --- .../org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala b/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala index 5ec5f2fae..11553164c 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala @@ -57,8 +57,7 @@ private[runtime] case class QuickMorphirRuntime(dists: Distributions, store: Sto case EnableTyper.Disabled => RTAction.succeed[RTExecutionContext, Unit](()) case EnableTyper.Warn => { val errors = new TypeChecker(dists).check(value) - for error <- errors do - println(s"TYPE WARNING: $error") + errors.foreach(error => println(s"TYPE WARNING: $error")) RTAction.succeed[RTExecutionContext, Unit](()) } case EnableTyper.Enabled => { From 63bf621c01eb98266adff2446df910db79734ee0 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 22 Aug 2023 13:47:51 -0700 Subject: [PATCH 232/323] Incremental --- .../src/org/finos/morphir/runtime/Extractors.scala | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala b/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala index 58b35a5e2..2ef716dcf 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala @@ -121,7 +121,7 @@ object Extractors { lookedUp match { case Right(T.Specification.TypeAliasSpecification(typeParams, expr)) => val newBindings = typeParams.zip(typeArgs).toMap - Some(expr, newBindings) + Some((expr, newBindings)) case _ => None // Missing name, but failing extractors cause problems } case _ => None @@ -135,12 +135,12 @@ object Extractors { val myself = this tpe match { case fun @ Type.Function(_, arg, myself(inner, args)) => - Some(inner, args :+ arg) + Some((inner, args :+ arg)) case ref @ dealiaser(myself(inner, args), bindings) => - Some(inner, args) + Some((inner, args)) // TODO: BINDINGS case other => - Some(other, List()) + Some((other, List())) } } } From 0d6289ec5403d462522c6695ed43524d7cd14217 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Tue, 22 Aug 2023 13:49:26 -0700 Subject: [PATCH 233/323] Incremental --- .../src/org/finos/morphir/runtime/Extractors.scala | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala b/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala index 2ef716dcf..26cfe5624 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala @@ -134,9 +134,9 @@ object Extractors { def unapply(tpe: UType): Option[(UType, List[UType])] = { val myself = this tpe match { - case fun @ Type.Function(_, arg, myself(inner, args)) => + case Type.Function(_, arg, myself(inner, args)) => Some((inner, args :+ arg)) - case ref @ dealiaser(myself(inner, args), bindings) => + case dealiaser(myself(inner, args), _) => Some((inner, args)) // TODO: BINDINGS case other => @@ -148,8 +148,8 @@ object Extractors { object Values { object ApplyChain { def unapply(value: TypedValue): Option[(TypedValue, List[TypedValue])] = value match { - case Value.Apply(_, ApplyChain(inner, args), arg) => Some(inner, args :+ arg) - case other => Some(other, List()) + case Value.Apply(_, ApplyChain(inner, args), arg) => Some((inner, args :+ arg)) + case other => Some((other, List())) } } object SomeConstructor { @@ -174,7 +174,7 @@ object Extractors { value match { case Value.Reference(tpe, name) if (name.packagePath != Basics.intType.asInstanceOf[Type.Reference[Unit]].typeName.packagePath) => - Some(tpe, name) + Some((tpe, name)) case _ => None } } @@ -184,7 +184,7 @@ object Extractors { value match { case Value.Reference(tpe, name) if (name.packagePath == Basics.intType.asInstanceOf[Type.Reference[Unit]].typeName.packagePath) => - Some(tpe, name) + Some((tpe, name)) case _ => None } } From f93263b7b71018725bfe90d86b07b092d214ad6a Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Wed, 23 Aug 2023 06:32:25 -0700 Subject: [PATCH 234/323] Incremental --- .../evaluator-tests/morphir-hashes.json | 1 + .../src/org/finos/morphir/runtime/Extractors.scala | 9 +++++++++ .../src/org/finos/morphir/runtime/TypeChecker.scala | 2 +- .../org/finos/morphir/runtime/EvaluatorMDMTests.scala | 4 ++-- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/examples/morphir-elm-projects/evaluator-tests/morphir-hashes.json b/examples/morphir-elm-projects/evaluator-tests/morphir-hashes.json index e619214c8..d723f0bbb 100644 --- a/examples/morphir-elm-projects/evaluator-tests/morphir-hashes.json +++ b/examples/morphir-elm-projects/evaluator-tests/morphir-hashes.json @@ -22,5 +22,6 @@ "src/Morphir/Examples/App/SimpleTests.elm": "f7794a1165f7fe3e5df89b84d0bdbcd8", "src/Morphir/Examples/App/SkdBasicTests.elm": "930eb32abe511d003720cfaffcc114b0", "src/Morphir/Examples/App/TupleTests.elm": "2c80092fe40ef7666906ee42214376ac", + "src/Morphir/Examples/App/TypeCheckerTests.elm": "11f2f667ce69629d1412791c49a765de", "src/Morphir/Examples/App/UserDefinedReferenceTests.elm": "9bf29afa60bad03b200d08ac8f099b99" } \ No newline at end of file diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala b/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala index 26cfe5624..c62077ee3 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala @@ -61,9 +61,18 @@ object Extractors { object IntRef extends CommonReference { final val tpe = Basics.intType } + + object Int16Ref extends CommonReference { + final val tpe = sdk.Int.int16Type + } + object Int32Ref extends CommonReference { final val tpe = sdk.Int.int32Type } + + object Int64Ref extends CommonReference { + final val tpe = sdk.Int.int64Type + } object BoolRef extends CommonReference { final val tpe = Basics.boolType } diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 30eb871c1..adf0e073a 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -278,7 +278,7 @@ class TypeChecker(dists: Distributions) { case None => List(new TypeLacksField(tpe, name, "Referenced by field none")) case Some(fieldTpe) => conformsTo(fieldTpe, tpe, context) } - case other => List(new ImproperType(other, s"Reference type expected")) + case other => List(new ImproperType(other, s"Reference type expected and let's make recompile")) } fromChildren ++ fromTpe } diff --git a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/EvaluatorMDMTests.scala b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/EvaluatorMDMTests.scala index 5af7ab803..66dba55a8 100644 --- a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/EvaluatorMDMTests.scala +++ b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/EvaluatorMDMTests.scala @@ -539,8 +539,8 @@ object EvaluatorMDMTests extends MorphirBaseSpec { suite("SDK Basics Tests")( testEvaluation("Plus")("sdkBasicsTests", "sdkAddTest")(Data.Int(3)), testEvaluation("Minus")("sdkBasicsTests", "sdkSubtractTest")(Data.Int(2)), - testEval("Plus")("sdkBasicsTests", "sdkAddTest64", abStruct(1L, 2L))(Data.Int64(3)), - testEval("Minus")("sdkBasicsTests", "sdkSubtractTest64", abStruct(4L, 2L))(Data.Int64(2)), + testEval("Plus(64)")("sdkBasicsTests", "sdkAddTest64", abStruct(1L, 2L))(Data.Int64(3)) @@ ignore @@ TestAspect.tag("Not properly typed"), + testEval("Minus(64)")("sdkBasicsTests", "sdkSubtractTest64", abStruct(4L, 2L))(Data.Int64(2)) @@ ignore @@ TestAspect.tag("Not properly typed"), testEvaluation("Divide")("sdkBasicsTests", "sdkDivideTest")(Data.Decimal(2.0)), testEvaluation("ModBy")("sdkBasicsTests", "sdkModByTest")(Data.Int(2)), testEvaluation("And")("sdkBasicsTests", "sdkAndTest")(Data.Boolean(false)), From fe80c5bb0006afe8d0fec8eb99943eddae658500 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Wed, 23 Aug 2023 06:56:07 -0700 Subject: [PATCH 235/323] Incremental --- .../src/org/finos/morphir/runtime/Extractors.scala | 1 + .../finos/morphir/runtime/quick/QuickMorphirRuntime.scala | 8 +++----- .../src/org/finos/morphir/runtime/EvaluatorMDMTests.scala | 8 ++++++-- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala b/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala index c62077ee3..d8f11698a 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala @@ -20,6 +20,7 @@ object Extractors { object ListRef { def unapply(tpe: UType): Option[UType] = tpe match { + // TODO: The SDK specification should make these names available, without requiring a type argument case Type.Reference(_, FQString("Morphir.SDK:List:list"), Chunk(elementType)) => Some(elementType) case _ => None diff --git a/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala b/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala index 11553164c..1f8c5c961 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala @@ -55,16 +55,14 @@ private[runtime] case class QuickMorphirRuntime(dists: Distributions, store: Sto ctx <- ZPure.get[RTExecutionContext] result <- ctx.options.enableTyper match { case EnableTyper.Disabled => RTAction.succeed[RTExecutionContext, Unit](()) - case EnableTyper.Warn => { + case EnableTyper.Warn => val errors = new TypeChecker(dists).check(value) errors.foreach(error => println(s"TYPE WARNING: $error")) RTAction.succeed[RTExecutionContext, Unit](()) - } - case EnableTyper.Enabled => { + case EnableTyper.Enabled => val errors = new TypeChecker(dists).check(value) - if (errors.length ==0) RTAction.succeed[RTExecutionContext, Unit](()) + if (errors.length == 0) RTAction.succeed[RTExecutionContext, Unit](()) else RTAction.fail(TypeCheckerErrors(errors)) - } } } yield result diff --git a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/EvaluatorMDMTests.scala b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/EvaluatorMDMTests.scala index 66dba55a8..b9da7daf8 100644 --- a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/EvaluatorMDMTests.scala +++ b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/EvaluatorMDMTests.scala @@ -539,8 +539,12 @@ object EvaluatorMDMTests extends MorphirBaseSpec { suite("SDK Basics Tests")( testEvaluation("Plus")("sdkBasicsTests", "sdkAddTest")(Data.Int(3)), testEvaluation("Minus")("sdkBasicsTests", "sdkSubtractTest")(Data.Int(2)), - testEval("Plus(64)")("sdkBasicsTests", "sdkAddTest64", abStruct(1L, 2L))(Data.Int64(3)) @@ ignore @@ TestAspect.tag("Not properly typed"), - testEval("Minus(64)")("sdkBasicsTests", "sdkSubtractTest64", abStruct(4L, 2L))(Data.Int64(2)) @@ ignore @@ TestAspect.tag("Not properly typed"), + testEval("Plus(64)")("sdkBasicsTests", "sdkAddTest64", abStruct(1L, 2L))( + Data.Int64(3) + ) @@ ignore @@ TestAspect.tag("Not properly typed"), + testEval("Minus(64)")("sdkBasicsTests", "sdkSubtractTest64", abStruct(4L, 2L))( + Data.Int64(2) + ) @@ ignore @@ TestAspect.tag("Not properly typed"), testEvaluation("Divide")("sdkBasicsTests", "sdkDivideTest")(Data.Decimal(2.0)), testEvaluation("ModBy")("sdkBasicsTests", "sdkModByTest")(Data.Int(2)), testEvaluation("And")("sdkBasicsTests", "sdkAndTest")(Data.Boolean(false)), From 99d183dfd52162c6fcd6256bddcb71a4934ee2d7 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Wed, 23 Aug 2023 07:06:25 -0700 Subject: [PATCH 236/323] Incremental --- .../src/org/finos/morphir/runtime/Extractors.scala | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala b/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala index d8f11698a..d0d465d8b 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala @@ -53,24 +53,23 @@ object Extractors { } trait CommonReference { val tpe: UType + //TODO: Consider exposing more at the SDK level, so that these type names may be looked up w/o the "asInstanceOf" + def ref = tpe.asInstanceOf[Type.Reference[Unit]] def unapply(argTpe: UType): Boolean = argTpe match { - case Type.Reference(_, fqName, Chunk()) if fqName == tpe.asInstanceOf[Type.Reference[Unit]].typeName => true + case Type.Reference(_, fqName, Chunk()) if fqName == ref.typeName => true case _ => false } } object IntRef extends CommonReference { final val tpe = Basics.intType } - object Int16Ref extends CommonReference { final val tpe = sdk.Int.int16Type } - object Int32Ref extends CommonReference { final val tpe = sdk.Int.int32Type } - object Int64Ref extends CommonReference { final val tpe = sdk.Int.int64Type } @@ -104,25 +103,30 @@ object Extractors { case _ => false } } + //Matches any reference that does not come from the morphir SDK object NonNativeRef { def unapply(tpe: UType): Option[(FQName, Chunk[UType])] = tpe match { case Type.Reference(_, name, args) + //TODO: Use single thing for checking name/ref is native if (name.packagePath != Basics.intType.asInstanceOf[Type.Reference[Unit]].typeName.packagePath) => Some((name, args)) case _ => None } } + //Matches any reference that does come from the DK object NativeRef { def unapply(tpe: UType): Boolean = tpe match { case Type.Reference(_, name, _) + //TODO: Use single thing for checking name/ref is native if (name.packagePath == Basics.intType.asInstanceOf[Type.Reference[Unit]].typeName.packagePath) => true case _ => false } } // Extractor object that unwraps a single layer of aliasing, and gives any type names that were bound in the process class Dealiased(dists: Distributions) { + //TODO: Consider just applying the bindings? def unapply(tpe: UType): Option[(UType, Map[Name, UType])] = // If it's aliased we may need to grab bindings tpe match { case NativeRef() => None From 515bba6b661a9fd7d939789abbef2d34f567b42f Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Wed, 23 Aug 2023 07:19:56 -0700 Subject: [PATCH 237/323] Incremental --- .../src/org/finos/morphir/runtime/Extractors.scala | 13 ++++++++----- .../org/finos/morphir/runtime/MorphirRuntime.scala | 1 - .../src/org/finos/morphir/runtime/TypeChecker.scala | 4 +++- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala b/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala index d0d465d8b..2171c8ff7 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala @@ -108,7 +108,7 @@ object Extractors { def unapply(tpe: UType): Option[(FQName, Chunk[UType])] = tpe match { case Type.Reference(_, name, args) - //TODO: Use single thing for checking name/ref is native + //TODO: NATIVE_CHECK if (name.packagePath != Basics.intType.asInstanceOf[Type.Reference[Unit]].typeName.packagePath) => Some((name, args)) case _ => None @@ -119,14 +119,14 @@ object Extractors { def unapply(tpe: UType): Boolean = tpe match { case Type.Reference(_, name, _) - //TODO: Use single thing for checking name/ref is native + //TODO: NATIVE_CHECK if (name.packagePath == Basics.intType.asInstanceOf[Type.Reference[Unit]].typeName.packagePath) => true case _ => false } } // Extractor object that unwraps a single layer of aliasing, and gives any type names that were bound in the process class Dealiased(dists: Distributions) { - //TODO: Consider just applying the bindings? + //TODO: DEALIASING_CLEANUP def unapply(tpe: UType): Option[(UType, Map[Name, UType])] = // If it's aliased we may need to grab bindings tpe match { case NativeRef() => None @@ -160,13 +160,14 @@ object Extractors { } } object Values { + //Extractor that helps handle currying object ApplyChain { def unapply(value: TypedValue): Option[(TypedValue, List[TypedValue])] = value match { case Value.Apply(_, ApplyChain(inner, args), arg) => Some((inner, args :+ arg)) case other => Some((other, List())) } } - object SomeConstructor { + object JustConstructor { def unapply(value: TypedValue): Option[TypedValue] = value match { case Value.Apply(attributes, Value.Constructor(_, FQString("Morphir.SDK:Maybe:just")), something) => @@ -174,7 +175,7 @@ object Extractors { case _ => None } } - object NoneConstructor { + object NothingConstructor { def unapply(value: TypedValue): Boolean = value match { case Value.Constructor(_, FQString("Morphir.SDK:Maybe:nothing")) => @@ -187,6 +188,7 @@ object Extractors { def unapply(value: TypedValue): Option[(UType, FQName)] = value match { case Value.Reference(tpe, name) + //TODO: NATIVE_CHECK if (name.packagePath != Basics.intType.asInstanceOf[Type.Reference[Unit]].typeName.packagePath) => Some((tpe, name)) case _ => None @@ -197,6 +199,7 @@ object Extractors { def unapply(value: TypedValue): Option[(UType, FQName)] = value match { case Value.Reference(tpe, name) + //TODO: NATIVE_CHECK if (name.packagePath == Basics.intType.asInstanceOf[Type.Reference[Unit]].typeName.packagePath) => Some((tpe, name)) case _ => None diff --git a/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntime.scala b/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntime.scala index 2a342ce59..b74495d5e 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntime.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntime.scala @@ -14,7 +14,6 @@ trait MorphirRuntime[TA, VA] { def evaluate(entryPoint: Value[TA, VA], params: Data): RTAction[MorphirEnv, MorphirRuntimeError, Data] def evaluate(entryPoint: FQName, params: Data): RTAction[MorphirEnv, MorphirRuntimeError, Data] def evaluate(entryPoint: FQName, params: Value[TA, VA]): RTAction[MorphirEnv, MorphirRuntimeError, Data] - // TODO: applyParams can fail if things are bad, but we can't combine Fs yet def applyParams(entryPoint: Value[TA, VA], params: Value[TA, VA]*): RTAction[MorphirEnv, TypeError, Value[TA, VA]] def evaluate(value: Value[TA, VA]): RTAction[MorphirEnv, EvaluationError, Data] diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index adf0e073a..a6f8a3010 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -68,7 +68,9 @@ class TypeChecker(dists: Distributions) { context: Context ) = // Maybe that should be in context? if (argList.size != paramList.size) - new ArgNumberMismatch(argList.size, paramList.size, s"Incorrect arity between ") + List(new ArgNumberMismatch(argList.size, paramList.size, s"Incorrect arity between ")) + else + List() def dealias(tpe: UType, context: Context): Either[MorphirTypeError, UType] = { def loop(tpe: UType, original_fqn: Option[FQName], context: Context): Either[MorphirTypeError, UType] = tpe match { From b74786880ec26181756d2aa5b11bf7f16db99bde Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Wed, 23 Aug 2023 07:30:50 -0700 Subject: [PATCH 238/323] Incremental --- .../src/org/finos/morphir/runtime/MorphirTypeError.scala | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala index e4ed040fb..0d9bc2312 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala @@ -18,7 +18,6 @@ abstract class MorphirTypeError(msg: String) extends Exception(msg) { object MorphirTypeError { def succinct[TA, VA](value: Value[TA, VA]): String = Succinct.Value(value) def succinct[TA](tpe: Type[TA]): String = Succinct.Type(tpe) - def succinct[TA](spec: T.Specification[TA]): String = Succinct.TypeSpec(spec) case class TypesMismatch(tpe1: UType, tpe2: UType, msg: String) @@ -34,16 +33,16 @@ object MorphirTypeError { case class LiteralTypeMismatch(lit: Lit, tpe: UType) extends MorphirTypeError(s"Literal $lit is not of type ${succinct(tpe)}") - case class ImproperType(tpe: UType, msg: String) extends MorphirTypeError(s"$msg. Found: ${succinct(tpe)}") + case class ImproperType(tpe: UType, msg: String) extends MorphirTypeError(s"$msg. Found: ${succinct(tpe)}") case class ImproperTypeSpec(fqn: FQName, spec: UTypeSpec, msg: String) extends MorphirTypeError(s"$msg. $fqn points to: ${succinct(spec)}") + case class CannotDealias(err: LookupError, msg: String = "Cannot dealias type") extends MorphirTypeError(s"$msg: ${err.getMsg}") case class TypeVariableMissing(name: Name) extends MorphirTypeError(s"Missing type variable $name.toTitleCase") case class DefinitionMissing(err: LookupError) extends MorphirTypeError(s"Cannot find definition: ${err.getMsg}") case class TypeMissing(err: LookupError) extends MorphirTypeError(s"Cannot find type: ${err.getMsg}") - case class OtherTypeError(msg: String) extends MorphirTypeError(msg) case class TypeLacksField(tpe: UType, field: Name, msg: String) extends MorphirTypeError(s"${succinct(tpe)} lacks field ${field.toCamelCase}. $msg") case class TypeHasExtraField(tpe: UType, contract: UType, field: Name) extends MorphirTypeError( From 2990e2c020e2e767141d763fb0abb16eb28c0ee5 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Wed, 23 Aug 2023 07:33:24 -0700 Subject: [PATCH 239/323] Incremental --- .../runtime/src/org/finos/morphir/runtime/Extractors.scala | 6 +++--- .../src/org/finos/morphir/runtime/MorphirTypeError.scala | 1 + .../src/org/finos/morphir/runtime/TypeChecker.scala | 7 ++----- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala b/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala index 2171c8ff7..259800f40 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala @@ -38,7 +38,7 @@ object Extractors { object ResultRef { def unapply(tpe: UType): Option[(UType, UType)] = tpe match { - case Type.Reference(attributes, FQString("Morphir.SDK:Result:result"), Chunk(keyType, valType)) => + case Type.Reference(_, FQString("Morphir.SDK:Result:result"), Chunk(keyType, valType)) => Some((keyType, valType)) case _ => None } @@ -46,7 +46,7 @@ object Extractors { object DictRef { def unapply(tpe: UType): Option[(UType, UType)] = tpe match { - case Type.Reference(attributes, FQString("Morphir.SDK:Dict:dict"), Chunk(keyType, valType)) => + case Type.Reference(_, FQString("Morphir.SDK:Dict:dict"), Chunk(keyType, valType)) => Some((keyType, valType)) case _ => None } @@ -170,7 +170,7 @@ object Extractors { object JustConstructor { def unapply(value: TypedValue): Option[TypedValue] = value match { - case Value.Apply(attributes, Value.Constructor(_, FQString("Morphir.SDK:Maybe:just")), something) => + case Value.Apply(_, Value.Constructor(_, FQString("Morphir.SDK:Maybe:just")), something) => Some(something) case _ => None } diff --git a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala index 0d9bc2312..3e50c5ccf 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala @@ -69,4 +69,5 @@ object MorphirTypeError { case class ArgNumberMismatch(first: Int, second: Int, msg: String) extends SizeMismatch(first: Int, second: Int, msg: String) case class Unimplemented(s: String) extends MorphirTypeError(s) + case class OtherTypeError(msg: String) extends MorphirTypeError(msg) } diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index a6f8a3010..a1bf84a20 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -40,9 +40,9 @@ object TypeChecker { class TypeChecker(dists: Distributions) { import TypeChecker.* - private val functionOnion = new Extractors.Types.FunctionOnion(dists) + //private val functionOnion = new Extractors.Types.FunctionOnion(dists) private val dealiased = new Extractors.Types.Dealiased(dists) - private def nameThatMismatch(tpe1: UType, tpe2: UType): String = { + def nameThatMismatch(tpe1: UType, tpe2: UType): String = { import Extractors.Types.* (tpe1, tpe2) match { case (NonNativeRef(fqn1, args1), NonNativeRef(fqn2, args2)) if fqn1 == fqn2 => @@ -57,9 +57,6 @@ class TypeChecker(dists: Distributions) { case _ => s"(${Succinct.Type(tpe1, 2)} vs ${Succinct.Type(tpe2, 2)})" } } - private def nameMissingValue(value: TypedValue, dists: Distributions): MorphirTypeError = ??? - private def nameMissingType(fqn: FQName, dists: Distributions): MorphirTypeError = ??? - private def nameMissingConstructor(fqn: FQName, tpe: UType, dists: Distributions): MorphirTypeError = ??? def checkList( argList: List[UType], paramList: List[UType], From 06c7e9f3d288f8503f40b24e8832f7bca348d99b Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Wed, 23 Aug 2023 10:02:00 -0700 Subject: [PATCH 240/323] Incremental --- .../src/org/finos/morphir/runtime/MorphirTypeError.scala | 6 +++--- .../runtime/src/org/finos/morphir/runtime/TypeChecker.scala | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala index 3e50c5ccf..eff6bcf04 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala @@ -43,12 +43,12 @@ object MorphirTypeError { case class TypeVariableMissing(name: Name) extends MorphirTypeError(s"Missing type variable $name.toTitleCase") case class DefinitionMissing(err: LookupError) extends MorphirTypeError(s"Cannot find definition: ${err.getMsg}") case class TypeMissing(err: LookupError) extends MorphirTypeError(s"Cannot find type: ${err.getMsg}") + case class TypeLacksField(tpe: UType, field: Name, msg: String) extends MorphirTypeError(s"${succinct(tpe)} lacks field ${field.toCamelCase}. $msg") case class TypeHasExtraField(tpe: UType, contract: UType, field: Name) extends MorphirTypeError( s"${succinct(tpe)} has field ${field.toCamelCase}, which is not included in ${succinct(contract)}" ) - case class ValueLacksField(value: TypedValue, contract: UType, field: Name) extends MorphirTypeError( s"${succinct(value)} lacks field ${field.toCamelCase}, which is required by ${succinct(contract)}" ) @@ -59,8 +59,8 @@ object MorphirTypeError { extends MorphirTypeError( s"tpe for field ${field.toCamelCase} is ${succinct(firstTpe)} in ${succinct(first)} but ${succinct(secondTpe)} in ${succinct(second)}" ) - case class ConstructorMissing(err: LookupError, tpe: UType) - extends MorphirTypeError(s"Cannot find definition of type ${succinct(tpe)}: ${err.getMsg}") + case class ConstructorMissing(err: LookupError, fqn : FQName) + extends MorphirTypeError(s"Cannot find constructor $fqn: ${err.getMsg}") case class ModuleMissing(modName: ModuleName) extends MorphirTypeError("Todo") case class PackageMissing(pckName: PackageName) extends MorphirTypeError("Todo") diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index a1bf84a20..49f9ff80e 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -42,10 +42,11 @@ class TypeChecker(dists: Distributions) { import TypeChecker.* //private val functionOnion = new Extractors.Types.FunctionOnion(dists) private val dealiased = new Extractors.Types.Dealiased(dists) + //TODO: Use or remove def nameThatMismatch(tpe1: UType, tpe2: UType): String = { import Extractors.Types.* (tpe1, tpe2) match { - case (NonNativeRef(fqn1, args1), NonNativeRef(fqn2, args2)) if fqn1 == fqn2 => + case (NonNativeRef(fqn1, args1@_), NonNativeRef(fqn2, args2@_)) if fqn1 == fqn2 => s"Refs to $fqn1 have different type args" case (NonNativeRef(fqn1, _), NonNativeRef(fqn2, _)) => val (pack1, mod1, loc1) = (fqn1.packagePath, fqn1.modulePath, fqn1.localName) From e675b284db8daa8bba03f4d572f1985d55c92605 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Wed, 23 Aug 2023 10:14:53 -0700 Subject: [PATCH 241/323] Incremental --- .../finos/morphir/runtime/TypeChecker.scala | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 49f9ff80e..21bb5d7b4 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -46,8 +46,8 @@ class TypeChecker(dists: Distributions) { def nameThatMismatch(tpe1: UType, tpe2: UType): String = { import Extractors.Types.* (tpe1, tpe2) match { - case (NonNativeRef(fqn1, args1@_), NonNativeRef(fqn2, args2@_)) if fqn1 == fqn2 => - s"Refs to $fqn1 have different type args" + case (NonNativeRef(fqn1, _), NonNativeRef(fqn2, _)) if fqn1 == fqn2 => + s"Refs to $fqn1 have different type args" //This method shouldn't be called otehrwise case (NonNativeRef(fqn1, _), NonNativeRef(fqn2, _)) => val (pack1, mod1, loc1) = (fqn1.packagePath, fqn1.modulePath, fqn1.localName) val (pack2, mod2, loc2) = (fqn2.packagePath, fqn2.modulePath, fqn2.localName) @@ -61,14 +61,13 @@ class TypeChecker(dists: Distributions) { def checkList( argList: List[UType], paramList: List[UType], - value: TypedValue, - contract: UType, context: Context ) = // Maybe that should be in context? if (argList.size != paramList.size) - List(new ArgNumberMismatch(argList.size, paramList.size, s"Incorrect arity between ")) + List(new ArgNumberMismatch(argList.size, paramList.size, s"${context.prefix} : Different arities: ")) else - List() + argList.zip(paramList).flatMal{case (arg, param) => conformsTo(arg, param, context)} + def dealias(tpe: UType, context: Context): Either[MorphirTypeError, UType] = { def loop(tpe: UType, original_fqn: Option[FQName], context: Context): Either[MorphirTypeError, UType] = tpe match { @@ -155,9 +154,9 @@ class TypeChecker(dists: Distributions) { )) else valueArgs.zip(declaredArgs).toList.flatMap { case (value, declared) => conformsTo(value, declared, context) } - case (dealiased(value, valueArgs), declared) => + case (dealiased(value, valueArgs@_), declared) => conformsTo(value, declared, context) // TODO: Bindings, left side only! - case (value, dealiased(declared, declaredArgs)) => + case (value, dealiased(declared, declaredArgs@_)) => conformsTo(value, declared, context) // TODO: Bindings, right side only! case (valueOther, declaredOther) if valueOther.getClass == declaredOther.getClass => List( @@ -225,7 +224,7 @@ class TypeChecker(dists: Distributions) { tpe, context ) // TODO: Useful context lost here - case Right(other) => List(new ApplyToNonFunction(function, argument)) + case Right(other) => List(new ApplyToNonFunction(function, other)) case Left(err) => List(err) } fromChildren ++ fromTpe @@ -233,7 +232,7 @@ class TypeChecker(dists: Distributions) { def handleDestructure( tpe: UType, - pattern: Pattern[UType], + pattern@_: Pattern[UType], value: TypedValue, inValue: TypedValue, context: Context @@ -255,8 +254,9 @@ class TypeChecker(dists: Distributions) { new OtherTypeError(s"Constructor $fqn does not match type name $name") ) val fromCtor = ctors.toMap.get(fqn.localName) match { - case Some(ctorArgs) => List() // helper(args.len != ctorArgs.len, new ) - + case Some(ctorArgs) => { + checkList(args, ctorArgs, context.withPrefix(s"Comparing $fqn value to looked up type ${Sucinct.Type(tpe)}")) + } case None => List(new OtherTypeError(s"Constructor type $name exists, but does not have arm for ${fqn.localName}")) } From d7eaa615830d035eded00fca32613ce2505ebcec Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Wed, 23 Aug 2023 10:33:57 -0700 Subject: [PATCH 242/323] Incremental --- .../org/finos/morphir/runtime/TypeChecker.scala | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 21bb5d7b4..1e89c3d94 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -66,7 +66,7 @@ class TypeChecker(dists: Distributions) { if (argList.size != paramList.size) List(new ArgNumberMismatch(argList.size, paramList.size, s"${context.prefix} : Different arities: ")) else - argList.zip(paramList).flatMal{case (arg, param) => conformsTo(arg, param, context)} + argList.zip(paramList).flatMap{case (arg, param) => conformsTo(arg, param, context)} def dealias(tpe: UType, context: Context): Either[MorphirTypeError, UType] = { def loop(tpe: UType, original_fqn: Option[FQName], context: Context): Either[MorphirTypeError, UType] = @@ -224,7 +224,7 @@ class TypeChecker(dists: Distributions) { tpe, context ) // TODO: Useful context lost here - case Right(other) => List(new ApplyToNonFunction(function, other)) + case Right(o_) => List(new ApplyToNonFunction(function, argument)) case Left(err) => List(err) } fromChildren ++ fromTpe @@ -232,7 +232,7 @@ class TypeChecker(dists: Distributions) { def handleDestructure( tpe: UType, - pattern@_: Pattern[UType], + pattern: Pattern[UType], value: TypedValue, inValue: TypedValue, context: Context @@ -255,7 +255,7 @@ class TypeChecker(dists: Distributions) { ) val fromCtor = ctors.toMap.get(fqn.localName) match { case Some(ctorArgs) => { - checkList(args, ctorArgs, context.withPrefix(s"Comparing $fqn value to looked up type ${Sucinct.Type(tpe)}")) + checkList(args.toList, ctorArgs.toList, context.withPrefix(s"Comparing $fqn value to looked up type ${Succinct.Type(tpe)}")) } case None => List(new OtherTypeError(s"Constructor type $name exists, but does not have arm for ${fqn.localName}")) @@ -284,8 +284,12 @@ class TypeChecker(dists: Distributions) { } def handleFieldFunction(tpe: UType, name: Name, context: Context): TypeCheckerResult = { val fromChildren = List() + val fromTpe = tpe match{ + case Type.Function(_, _, _) => List() + case other => List(new ImproperType("Field function should be function:", other)) + } // TODO: tpe should be... function from extensible record type to ??? - fromChildren + fromChildren ++ fromTpe } def handleIfThenElse( tpe: UType, From 05dac24a4f405be1a1f2e58ae518be83279d848c Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Wed, 23 Aug 2023 11:00:28 -0700 Subject: [PATCH 243/323] Incremental --- .../org/finos/morphir/runtime/TypeChecker.scala | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 1e89c3d94..b8fa523fd 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -224,7 +224,7 @@ class TypeChecker(dists: Distributions) { tpe, context ) // TODO: Useful context lost here - case Right(o_) => List(new ApplyToNonFunction(function, argument)) + case Right(_) => List(new ApplyToNonFunction(function, argument)) case Left(err) => List(err) } fromChildren ++ fromTpe @@ -286,7 +286,7 @@ class TypeChecker(dists: Distributions) { val fromChildren = List() val fromTpe = tpe match{ case Type.Function(_, _, _) => List() - case other => List(new ImproperType("Field function should be function:", other)) + case other => List(new ImproperType(other, "Field function should be function:")) } // TODO: tpe should be... function from extensible record type to ??? fromChildren ++ fromTpe @@ -434,7 +434,16 @@ class TypeChecker(dists: Distributions) { context: Context ): TypeCheckerResult = { val fromChildren = check(valueToUpdate, context) ++ fields.flatMap { case (_, value) => check(value, context) } - // TODO: Check the value dealiases to a record which has that name + val fromTpe = tpe match { + //TODO: Review this type - does the output have to be the same as the input? + case Type.Record(_, tpeFields) => { + val fieldMap = tpeFields.map(field => field.name -> field.data).toMap + conformsTo(valueToUpdate.attributes, tpe) ++ fields.flatMap(field => { + fieldMap.get + }) + } + case other => List(new ImproperType(other, "Record type expected")) + } fromChildren } def handleVariable(tpe: UType, name: Name, context: Context): TypeCheckerResult = From ae7d7bfb5ce444b1ea926720d2bf0926733bbe2f Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Wed, 23 Aug 2023 11:42:07 -0700 Subject: [PATCH 244/323] Incremental --- .../src/org/finos/morphir/runtime/TypeChecker.scala | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index b8fa523fd..878f28185 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -247,15 +247,16 @@ class TypeChecker(dists: Distributions) { val fromChildren = List() val (ret, args) = Utils.uncurryFunctionType(tpe) // TODO: Interleaved function type w/ aliases. val fromTpe = ret match { - case Type.Reference(_, name, typeArgs) => dists.lookupTypeSpecification(name) match { - case Right(T.Specification.CustomTypeSpecification(typeParams, ctors)) => + //TODO: Handle bindings + case Type.Reference(_, name, typeArgs@_) => dists.lookupTypeSpecification(name) match { + case Right(T.Specification.CustomTypeSpecification(typeParams@_, ctors)) => val missedName = helper( fqn.packagePath != name.packagePath || fqn.modulePath != name.modulePath, new OtherTypeError(s"Constructor $fqn does not match type name $name") ) val fromCtor = ctors.toMap.get(fqn.localName) match { case Some(ctorArgs) => { - checkList(args.toList, ctorArgs.toList, context.withPrefix(s"Comparing $fqn value to looked up type ${Succinct.Type(tpe)}")) + checkList(args.toList, ctorArgs.toList.map(_._2), context.withPrefix(s"Comparing $fqn value to looked up type ${Succinct.Type(tpe)}")) } case None => List(new OtherTypeError(s"Constructor type $name exists, but does not have arm for ${fqn.localName}")) @@ -439,7 +440,10 @@ class TypeChecker(dists: Distributions) { case Type.Record(_, tpeFields) => { val fieldMap = tpeFields.map(field => field.name -> field.data).toMap conformsTo(valueToUpdate.attributes, tpe) ++ fields.flatMap(field => { - fieldMap.get + fieldMap.get(field._1) match { + case None => List(TypeLacksField(tpe, field, "Tried to update record field which is not present")) + case Some(found) => conformsTo(field._2, found, context) + } }) } case other => List(new ImproperType(other, "Record type expected")) From 516c4a93a1131e7fb722c550fa6274ccdd76621a Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Wed, 23 Aug 2023 11:57:44 -0700 Subject: [PATCH 245/323] Incremental --- .../finos/morphir/runtime/Extractors.scala | 20 +++---- .../morphir/runtime/MorphirTypeError.scala | 10 ++-- .../finos/morphir/runtime/TypeChecker.scala | 57 ++++++++++--------- 3 files changed, 44 insertions(+), 43 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala b/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala index 259800f40..7f6d7510a 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala @@ -53,12 +53,12 @@ object Extractors { } trait CommonReference { val tpe: UType - //TODO: Consider exposing more at the SDK level, so that these type names may be looked up w/o the "asInstanceOf" + // TODO: Consider exposing more at the SDK level, so that these type names may be looked up w/o the "asInstanceOf" def ref = tpe.asInstanceOf[Type.Reference[Unit]] def unapply(argTpe: UType): Boolean = argTpe match { case Type.Reference(_, fqName, Chunk()) if fqName == ref.typeName => true - case _ => false + case _ => false } } object IntRef extends CommonReference { @@ -103,30 +103,30 @@ object Extractors { case _ => false } } - //Matches any reference that does not come from the morphir SDK + // Matches any reference that does not come from the morphir SDK object NonNativeRef { def unapply(tpe: UType): Option[(FQName, Chunk[UType])] = tpe match { case Type.Reference(_, name, args) - //TODO: NATIVE_CHECK + // TODO: NATIVE_CHECK if (name.packagePath != Basics.intType.asInstanceOf[Type.Reference[Unit]].typeName.packagePath) => Some((name, args)) case _ => None } } - //Matches any reference that does come from the DK + // Matches any reference that does come from the DK object NativeRef { def unapply(tpe: UType): Boolean = tpe match { case Type.Reference(_, name, _) - //TODO: NATIVE_CHECK + // TODO: NATIVE_CHECK if (name.packagePath == Basics.intType.asInstanceOf[Type.Reference[Unit]].typeName.packagePath) => true case _ => false } } // Extractor object that unwraps a single layer of aliasing, and gives any type names that were bound in the process class Dealiased(dists: Distributions) { - //TODO: DEALIASING_CLEANUP + // TODO: DEALIASING_CLEANUP def unapply(tpe: UType): Option[(UType, Map[Name, UType])] = // If it's aliased we may need to grab bindings tpe match { case NativeRef() => None @@ -160,7 +160,7 @@ object Extractors { } } object Values { - //Extractor that helps handle currying + // Extractor that helps handle currying object ApplyChain { def unapply(value: TypedValue): Option[(TypedValue, List[TypedValue])] = value match { case Value.Apply(_, ApplyChain(inner, args), arg) => Some((inner, args :+ arg)) @@ -188,7 +188,7 @@ object Extractors { def unapply(value: TypedValue): Option[(UType, FQName)] = value match { case Value.Reference(tpe, name) - //TODO: NATIVE_CHECK + // TODO: NATIVE_CHECK if (name.packagePath != Basics.intType.asInstanceOf[Type.Reference[Unit]].typeName.packagePath) => Some((tpe, name)) case _ => None @@ -199,7 +199,7 @@ object Extractors { def unapply(value: TypedValue): Option[(UType, FQName)] = value match { case Value.Reference(tpe, name) - //TODO: NATIVE_CHECK + // TODO: NATIVE_CHECK if (name.packagePath == Basics.intType.asInstanceOf[Type.Reference[Unit]].typeName.packagePath) => Some((tpe, name)) case _ => None diff --git a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala index eff6bcf04..e0e57d814 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala @@ -16,8 +16,8 @@ abstract class MorphirTypeError(msg: String) extends Exception(msg) { def getMsg: String = msg } object MorphirTypeError { - def succinct[TA, VA](value: Value[TA, VA]): String = Succinct.Value(value) - def succinct[TA](tpe: Type[TA]): String = Succinct.Type(tpe) + def succinct[TA, VA](value: Value[TA, VA]): String = Succinct.Value(value) + def succinct[TA](tpe: Type[TA]): String = Succinct.Type(tpe) def succinct[TA](spec: T.Specification[TA]): String = Succinct.TypeSpec(spec) case class TypesMismatch(tpe1: UType, tpe2: UType, msg: String) @@ -59,15 +59,13 @@ object MorphirTypeError { extends MorphirTypeError( s"tpe for field ${field.toCamelCase} is ${succinct(firstTpe)} in ${succinct(first)} but ${succinct(secondTpe)} in ${succinct(second)}" ) - case class ConstructorMissing(err: LookupError, fqn : FQName) + case class ConstructorMissing(err: LookupError, fqn: FQName) extends MorphirTypeError(s"Cannot find constructor $fqn: ${err.getMsg}") - case class ModuleMissing(modName: ModuleName) extends MorphirTypeError("Todo") - case class PackageMissing(pckName: PackageName) extends MorphirTypeError("Todo") abstract class SizeMismatch(first: Int, second: Int, msg: String) extends MorphirTypeError(s"$msg: ($first vs $second)") case class ArgNumberMismatch(first: Int, second: Int, msg: String) extends SizeMismatch(first: Int, second: Int, msg: String) - case class Unimplemented(s: String) extends MorphirTypeError(s) + case class Unimplemented(s: String) extends MorphirTypeError(s) case class OtherTypeError(msg: String) extends MorphirTypeError(msg) } diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 878f28185..23968fe86 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -38,16 +38,17 @@ object TypeChecker { def helper(condition: Boolean, error: MorphirTypeError) = if (condition) List(error) else List() } -class TypeChecker(dists: Distributions) { +//TODO: This is final because references to ValueDefinition are private, and thus letDefinition and letRecursion handlers cannot be overridden. There may be a better way to handle this. +final class TypeChecker(dists: Distributions) { import TypeChecker.* - //private val functionOnion = new Extractors.Types.FunctionOnion(dists) - private val dealiased = new Extractors.Types.Dealiased(dists) - //TODO: Use or remove + // private val functionOnion = new Extractors.Types.FunctionOnion(dists) + private val dealiased = new Extractors.Types.Dealiased(dists) + // TODO: Use or remove def nameThatMismatch(tpe1: UType, tpe2: UType): String = { import Extractors.Types.* (tpe1, tpe2) match { case (NonNativeRef(fqn1, _), NonNativeRef(fqn2, _)) if fqn1 == fqn2 => - s"Refs to $fqn1 have different type args" //This method shouldn't be called otehrwise + s"Refs to $fqn1 have different type args" // This method shouldn't be called otehrwise case (NonNativeRef(fqn1, _), NonNativeRef(fqn2, _)) => val (pack1, mod1, loc1) = (fqn1.packagePath, fqn1.modulePath, fqn1.localName) val (pack2, mod2, loc2) = (fqn2.packagePath, fqn2.modulePath, fqn2.localName) @@ -66,7 +67,7 @@ class TypeChecker(dists: Distributions) { if (argList.size != paramList.size) List(new ArgNumberMismatch(argList.size, paramList.size, s"${context.prefix} : Different arities: ")) else - argList.zip(paramList).flatMap{case (arg, param) => conformsTo(arg, param, context)} + argList.zip(paramList).flatMap { case (arg, param) => conformsTo(arg, param, context) } def dealias(tpe: UType, context: Context): Either[MorphirTypeError, UType] = { def loop(tpe: UType, original_fqn: Option[FQName], context: Context): Either[MorphirTypeError, UType] = @@ -154,9 +155,9 @@ class TypeChecker(dists: Distributions) { )) else valueArgs.zip(declaredArgs).toList.flatMap { case (value, declared) => conformsTo(value, declared, context) } - case (dealiased(value, valueArgs@_), declared) => + case (dealiased(value, valueArgs @ _), declared) => conformsTo(value, declared, context) // TODO: Bindings, left side only! - case (value, dealiased(declared, declaredArgs@_)) => + case (value, dealiased(declared, declaredArgs @ _)) => conformsTo(value, declared, context) // TODO: Bindings, right side only! case (valueOther, declaredOther) if valueOther.getClass == declaredOther.getClass => List( @@ -224,8 +225,8 @@ class TypeChecker(dists: Distributions) { tpe, context ) // TODO: Useful context lost here - case Right(_) => List(new ApplyToNonFunction(function, argument)) - case Left(err) => List(err) + case Right(_) => List(new ApplyToNonFunction(function, argument)) + case Left(err) => List(err) } fromChildren ++ fromTpe } @@ -247,17 +248,20 @@ class TypeChecker(dists: Distributions) { val fromChildren = List() val (ret, args) = Utils.uncurryFunctionType(tpe) // TODO: Interleaved function type w/ aliases. val fromTpe = ret match { - //TODO: Handle bindings - case Type.Reference(_, name, typeArgs@_) => dists.lookupTypeSpecification(name) match { - case Right(T.Specification.CustomTypeSpecification(typeParams@_, ctors)) => + // TODO: Handle bindings + case Type.Reference(_, name, typeArgs @ _) => dists.lookupTypeSpecification(name) match { + case Right(T.Specification.CustomTypeSpecification(typeParams @ _, ctors)) => val missedName = helper( fqn.packagePath != name.packagePath || fqn.modulePath != name.modulePath, new OtherTypeError(s"Constructor $fqn does not match type name $name") ) val fromCtor = ctors.toMap.get(fqn.localName) match { - case Some(ctorArgs) => { - checkList(args.toList, ctorArgs.toList.map(_._2), context.withPrefix(s"Comparing $fqn value to looked up type ${Succinct.Type(tpe)}")) - } + case Some(ctorArgs) => + checkList( + args.toList, + ctorArgs.toList.map(_._2), + context.withPrefix(s"Comparing $fqn value to looked up type ${Succinct.Type(tpe)}") + ) case None => List(new OtherTypeError(s"Constructor type $name exists, but does not have arm for ${fqn.localName}")) } @@ -285,9 +289,9 @@ class TypeChecker(dists: Distributions) { } def handleFieldFunction(tpe: UType, name: Name, context: Context): TypeCheckerResult = { val fromChildren = List() - val fromTpe = tpe match{ + val fromTpe = tpe match { case Type.Function(_, _, _) => List() - case other => List(new ImproperType(other, "Field function should be function:")) + case other => List(new ImproperType(other, "Field function should be function:")) } // TODO: tpe should be... function from extensible record type to ??? fromChildren ++ fromTpe @@ -411,7 +415,7 @@ class TypeChecker(dists: Distributions) { } def handleTuple(tpe: UType, elements: List[TypedValue], context: Context): TypeCheckerResult = { val fromTpe = tpe match { - case tupleTpe @ Type.Tuple(_, elementTypes) => + case Type.Tuple(_, elementTypes) => helper( elementTypes.length != elements.length, new OtherTypeError( @@ -424,7 +428,7 @@ class TypeChecker(dists: Distributions) { case other => List(new ImproperType(other, "Tuple expected")) } val fromChildren = elements.flatMap(check(_, context)) - fromChildren + fromChildren ++ fromTpe } def handleUnitValue(tpe: UType, context: Context): TypeCheckerResult = List() // Pass @@ -436,16 +440,15 @@ class TypeChecker(dists: Distributions) { ): TypeCheckerResult = { val fromChildren = check(valueToUpdate, context) ++ fields.flatMap { case (_, value) => check(value, context) } val fromTpe = tpe match { - //TODO: Review this type - does the output have to be the same as the input? - case Type.Record(_, tpeFields) => { + // TODO: Review this type - does the output have to be the same as the input? + case Type.Record(_, tpeFields) => val fieldMap = tpeFields.map(field => field.name -> field.data).toMap - conformsTo(valueToUpdate.attributes, tpe) ++ fields.flatMap(field => { + conformsTo(valueToUpdate.attributes, tpe) ++ fields.flatMap { field => fieldMap.get(field._1) match { - case None => List(TypeLacksField(tpe, field, "Tried to update record field which is not present")) - case Some(found) => conformsTo(field._2, found, context) + case None => List(TypeLacksField(tpe, field._1, "Tried to update record field which is not present")) + case Some(found) => conformsTo(field._2.attributes, found, context) } - }) - } + } case other => List(new ImproperType(other, "Record type expected")) } fromChildren From 029961ccb4847d527e8d2737e5e4215f92bb61d4 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Wed, 23 Aug 2023 12:15:12 -0700 Subject: [PATCH 246/323] Incremental --- morphir/runtime/src/org/finos/morphir/runtime/Succinct.scala | 2 ++ morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Succinct.scala b/morphir/runtime/src/org/finos/morphir/runtime/Succinct.scala index cf8f32c74..9df2d0473 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Succinct.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Succinct.scala @@ -9,6 +9,8 @@ import org.finos.morphir.ir.sdk.Basics import org.finos.morphir.ir.Field import org.finos.morphir.runtime.exports.* +//Utlity object (mostly for errors) to give briefer versions of Values/Types by only showing the top few levels +//Additional cases should be filled out as needed (WIP) object Succinct { object Value { import V.Value.* diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 23968fe86..f863bd9d3 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -1,6 +1,5 @@ package org.finos.morphir.runtime -import org.finos.morphir.naming.* import org.finos.morphir.naming.* import org.finos.morphir.ir.{Type as T, Value as V} import org.finos.morphir.ir.Literal.Lit From e893452765f3f165b178e628246d47ffc5e13a12 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Thu, 24 Aug 2023 05:53:46 -0700 Subject: [PATCH 247/323] Incremental --- .../runtime/src/org/finos/morphir/runtime/TypeChecker.scala | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index f863bd9d3..dd144b116 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -20,6 +20,7 @@ import MorphirTypeError.* object TypeChecker { type TypeCheckerResult = List[MorphirTypeError] + //Object to carry data for making tracking local type bindings and context information for better error messages case class Context( typeBindings: Map[Name, UType], depth: Int, @@ -40,9 +41,9 @@ object TypeChecker { //TODO: This is final because references to ValueDefinition are private, and thus letDefinition and letRecursion handlers cannot be overridden. There may be a better way to handle this. final class TypeChecker(dists: Distributions) { import TypeChecker.* - // private val functionOnion = new Extractors.Types.FunctionOnion(dists) private val dealiased = new Extractors.Types.Dealiased(dists) // TODO: Use or remove + //String utility to improve visibility of names when types don't match def nameThatMismatch(tpe1: UType, tpe2: UType): String = { import Extractors.Types.* (tpe1, tpe2) match { @@ -58,6 +59,7 @@ final class TypeChecker(dists: Distributions) { case _ => s"(${Succinct.Type(tpe1, 2)} vs ${Succinct.Type(tpe2, 2)})" } } + //Helper to check that two lists of types (such as tuple or arguments) match, both in length and contents def checkList( argList: List[UType], paramList: List[UType], @@ -68,6 +70,7 @@ final class TypeChecker(dists: Distributions) { else argList.zip(paramList).flatMap { case (arg, param) => conformsTo(arg, param, context) } + //Fully dealises a type. (Note that it dos not dealias branching types, such as if a tuple has an aliased def dealias(tpe: UType, context: Context): Either[MorphirTypeError, UType] = { def loop(tpe: UType, original_fqn: Option[FQName], context: Context): Either[MorphirTypeError, UType] = tpe match { From 2385effb8dcaa4da30e1470a8ef43fc1667e7a24 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Thu, 24 Aug 2023 05:59:22 -0700 Subject: [PATCH 248/323] Incremental --- .../finos/morphir/runtime/TypeChecker.scala | 22 +++++-------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index dd144b116..f242dd7bc 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -70,7 +70,7 @@ final class TypeChecker(dists: Distributions) { else argList.zip(paramList).flatMap { case (arg, param) => conformsTo(arg, param, context) } - //Fully dealises a type. (Note that it dos not dealias branching types, such as if a tuple has an aliased + //Fully dealises a type. (Note that it dos not dealias branching types, such as if a tuple has an aliased member def dealias(tpe: UType, context: Context): Either[MorphirTypeError, UType] = { def loop(tpe: UType, original_fqn: Option[FQName], context: Context): Either[MorphirTypeError, UType] = tpe match { @@ -102,7 +102,7 @@ final class TypeChecker(dists: Distributions) { (valueType, declaredType) match { case (_, Type.Variable(_, name)) => context.getTypeVariable(name) match { case None => List(new TypeVariableMissing(name)) - case Some(lookedUp) => conformsTo(valueType, lookedUp, context) // TODO: Type parameter wrangling + case Some(lookedUp) => conformsTo(valueType, lookedUp, context) // TODO: Bindings } case (Type.Variable(_, name), _) => context.getTypeVariable(name) match { case None => List(new TypeVariableMissing(name)) @@ -111,37 +111,27 @@ final class TypeChecker(dists: Distributions) { case (left @ LeafType(), right @ LeafType()) => if (left == right) List() else List(TypesMismatch(left, right, "Value type does not match declared type")) case (Type.Function(_, valueArg, valueRet), Type.Function(_, declaredArg, declaredRet)) => - // Note reversed order - covariance vs. contravariance. conformsTo(valueRet, declaredRet, context) ++ conformsTo(declaredArg, valueArg, context) case (value @ Type.Tuple(_, valueElements), declared @ Type.Tuple(_, declaredElements)) => - if (valueElements.length != declaredElements.length) { - List(new TypesMismatch( - value, - declared, - s"Tuple sizes differ (${valueElements.length} vs ${declaredElements.length})" - )) - } else { - valueElements.toList.zip(declaredElements).flatMap { - case (value, declared) => - conformsTo(value, declared, context) - } - } + checkList(valueElements, declaredElements, "Comparing Tuples") case (valueTpe @ Type.Record(_, valueFields), declaredTpe @ Type.Record(_, declaredFields)) => + //Map both to sets val valueFieldSet: Set[Name] = valueFields.map(_.name).toSet val declaredFieldSet: Set[Name] = declaredFields.map(_.name).toSet + //Use .diff to find if some are entirely absent from the other val missingFromValue = valueFieldSet .diff(declaredFieldSet).toList.map(missing => TypeLacksField(valueTpe, missing, s"Required by ${Succinct.Type(declaredTpe)}") ) val missingFromDeclared = declaredFieldSet .diff(valueFieldSet).toList.map(bonus => TypeHasExtraField(valueTpe, declaredTpe, bonus)) + //For everything shared, lookup types in both and ensure they match val sharedFields = valueFieldSet.intersect(declaredFieldSet) val valueFieldMap: Map[Name, UType] = valueFields.map(field => field.name -> field.data).toMap val declaredFieldMap: Map[Name, UType] = declaredFields.map(field => field.name -> field.data).toMap val conflicts = sharedFields.flatMap(field => conformsTo(valueFieldMap(field), declaredFieldMap(field), context)) missingFromValue ++ missingFromDeclared ++ conflicts - // TODO: Consider covariance/contravariance case (DictRef(valueKey, valueValue), DictRef(declaredKey, declaredValue)) => conformsTo(valueKey, declaredKey, context) ++ conformsTo(valueValue, declaredValue, context) case (ResultRef(valueErr, valueOk), ResultRef(declaredErr, declaredOk)) => From cee14a85ef69f758b6f3ab8efe507a70d427c45d Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Thu, 24 Aug 2023 06:09:34 -0700 Subject: [PATCH 249/323] Incremental --- .../org/finos/morphir/runtime/TypeChecker.scala | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index f242dd7bc..7b669afb7 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -113,7 +113,7 @@ final class TypeChecker(dists: Distributions) { case (Type.Function(_, valueArg, valueRet), Type.Function(_, declaredArg, declaredRet)) => conformsTo(valueRet, declaredRet, context) ++ conformsTo(declaredArg, valueArg, context) case (value @ Type.Tuple(_, valueElements), declared @ Type.Tuple(_, declaredElements)) => - checkList(valueElements, declaredElements, "Comparing Tuples") + checkList(valueElements.toList, declaredElements.toList, context.withPrefix("Comparing Tuples:")) case (valueTpe @ Type.Record(_, valueFields), declaredTpe @ Type.Record(_, declaredFields)) => //Map both to sets val valueFieldSet: Set[Name] = valueFields.map(_.name).toSet @@ -141,12 +141,7 @@ final class TypeChecker(dists: Distributions) { conformsTo(valueElement, declaredElement, context) case (Type.Reference(_, valueName, valueArgs), Type.Reference(_, declaredName, declaredArgs)) if valueName == declaredName => - if (valueArgs.length != declaredArgs.length) - List(new OtherTypeError( - s"Reference $valueName has different number of parameters (${valueArgs.length} vs ${declaredArgs.length}" - )) - else - valueArgs.zip(declaredArgs).toList.flatMap { case (value, declared) => conformsTo(value, declared, context) } + checkList(valueArgs, declaredArgs, context.withPrefix("Comparing arguments on reference $valueName")) case (dealiased(value, valueArgs @ _), declared) => conformsTo(value, declared, context) // TODO: Bindings, left side only! case (value, dealiased(declared, declaredArgs @ _)) => @@ -155,7 +150,7 @@ final class TypeChecker(dists: Distributions) { List( new Unimplemented(s"No matching support for ${Succinct.Type(valueOther)} vs ${Succinct.Type(declaredOther)}") ) - case (valueOther, declaredOther) => List(new TypesMismatch(valueOther, declaredOther, "Different types")) + case (valueOther, declaredOther) => List(new TypesMismatch(valueOther, declaredOther, "Different types of type")) } } @@ -252,7 +247,7 @@ final class TypeChecker(dists: Distributions) { checkList( args.toList, ctorArgs.toList.map(_._2), - context.withPrefix(s"Comparing $fqn value to looked up type ${Succinct.Type(tpe)}") + context.withPrefix(s"Comparing $fqn constructor value to looked up type ${Succinct.Type(tpe)}") ) case None => List(new OtherTypeError(s"Constructor type $name exists, but does not have arm for ${fqn.localName}")) @@ -275,7 +270,7 @@ final class TypeChecker(dists: Distributions) { case None => List(new TypeLacksField(tpe, name, "Referenced by field none")) case Some(fieldTpe) => conformsTo(fieldTpe, tpe, context) } - case other => List(new ImproperType(other, s"Reference type expected and let's make recompile")) + case other => List(new ImproperType(other, s"Reference type expected")) } fromChildren ++ fromTpe } From b581e379e5de16656a611dbb15178a4729420f87 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Thu, 24 Aug 2023 06:11:36 -0700 Subject: [PATCH 250/323] Incremental --- .../runtime/src/org/finos/morphir/runtime/TypeChecker.scala | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 7b669afb7..dbaf3f754 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -300,6 +300,10 @@ final class TypeChecker(dists: Distributions) { } def handleLambda(tpe: UType, pattern: Pattern[UType], body: TypedValue, context: Context): TypeCheckerResult = { val fromChildren = check(body, context) + val fromTpe = tpe match { + case Type.Function(_, arg, ret) => conformsTo(ret, body.attributes, context) ++ conformsTo(pattern.attributes, arg, context) + case other => List(new ImproperType(other, "Field function should be function:")) + } // TODO: Check tpe is a function // TODO: Check tpe's argument matches (strictly) with pattern // TODO: Figure out variable bindings From 3e2f6940346cf85218aaaef277991a5b7f022747 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Thu, 24 Aug 2023 06:14:48 -0700 Subject: [PATCH 251/323] Incremental --- .../src/org/finos/morphir/runtime/TypeChecker.scala | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index dbaf3f754..ab494e76d 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -304,10 +304,9 @@ final class TypeChecker(dists: Distributions) { case Type.Function(_, arg, ret) => conformsTo(ret, body.attributes, context) ++ conformsTo(pattern.attributes, arg, context) case other => List(new ImproperType(other, "Field function should be function:")) } - // TODO: Check tpe is a function // TODO: Check tpe's argument matches (strictly) with pattern // TODO: Figure out variable bindings - fromChildren + fromChildren ++ fromTpe } def handleLetDefinition( tpe: UType, @@ -320,7 +319,7 @@ final class TypeChecker(dists: Distributions) { // TODO: Manage Store // TODO: Check definition body // TODO: Check definition body w/ argument types added to store - fromChildren + fromChildren ++ conformsTo(inValue.attributes, tpe) } def handleLetRecursion( tpe: UType, @@ -331,7 +330,7 @@ final class TypeChecker(dists: Distributions) { val fromChildren = check(inValue, context) // TODO: Manage store // TODO: Check definition types and add to stores - fromChildren + fromChildren ++ conformsTo(inValue.attributes, tpe) } def handleListValue(tpe: UType, elements: List[TypedValue], context: Context): TypeCheckerResult = { // We expect declared element types to be the same, but values may differ; so we only grab the first set of errors at the type level, but fully explore all elements. @@ -360,11 +359,12 @@ final class TypeChecker(dists: Distributions) { context: Context ): TypeCheckerResult = { val fromChildren = check(value, context) + val casesMatch = cases.flatMap{case } // TODO: Check values from each case // TODO: Manage store - // TODO: Check each case's pattern can be it's value + // TODO: Check each case's pattern can be its value // TODO: Check value must be one of the patterns - fromChildren + fromChildren ++ conformsTo(toe) } def handleRecord( tpe: UType, From 2d5cef5eed03da561abc601b7f8cf9c5b6e41782 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Thu, 24 Aug 2023 06:16:22 -0700 Subject: [PATCH 252/323] Incremental --- .../src/org/finos/morphir/runtime/TypeChecker.scala | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index ab494e76d..6ab39697e 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -359,12 +359,15 @@ final class TypeChecker(dists: Distributions) { context: Context ): TypeCheckerResult = { val fromChildren = check(value, context) - val casesMatch = cases.flatMap{case } + val casesMatch = cases.flatMap{case (pattern, caseValue) => { + conformsTo(value.attributes, pattern, context.withPrefix("Checking Pattern:")) ++ + comformsTo(caseValue.attributes, tpe, context) + }} // TODO: Check values from each case // TODO: Manage store // TODO: Check each case's pattern can be its value // TODO: Check value must be one of the patterns - fromChildren ++ conformsTo(toe) + fromChildren ++ casesMatch } def handleRecord( tpe: UType, From 5c9b31654dcd85608ad3a3c44d284198dabda04d Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Thu, 24 Aug 2023 06:20:54 -0700 Subject: [PATCH 253/323] Incremental --- .../src/org/finos/morphir/runtime/TypeChecker.scala | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 6ab39697e..ef8bce58c 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -410,15 +410,7 @@ final class TypeChecker(dists: Distributions) { def handleTuple(tpe: UType, elements: List[TypedValue], context: Context): TypeCheckerResult = { val fromTpe = tpe match { case Type.Tuple(_, elementTypes) => - helper( - elementTypes.length != elements.length, - new OtherTypeError( - s"Value typed as tuple with ${elementTypes.length} elements has ${elements.length} elements." - ) - ) ++ - (elements.map(_.attributes)).zip(elementTypes).flatMap { case (actual, declared) => - conformsTo(actual, declared, context) - } + checkList(elements.map(_.attributes), elementTypes, context) case other => List(new ImproperType(other, "Tuple expected")) } val fromChildren = elements.flatMap(check(_, context)) From 26b1d58e52d2b6b7c5ee895198ba0ec894ad7c13 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Thu, 24 Aug 2023 06:26:10 -0700 Subject: [PATCH 254/323] Incremental --- .../src/org/finos/morphir/runtime/TypeChecker.scala | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index ef8bce58c..55fa0c1cc 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -141,7 +141,7 @@ final class TypeChecker(dists: Distributions) { conformsTo(valueElement, declaredElement, context) case (Type.Reference(_, valueName, valueArgs), Type.Reference(_, declaredName, declaredArgs)) if valueName == declaredName => - checkList(valueArgs, declaredArgs, context.withPrefix("Comparing arguments on reference $valueName")) + checkList(valueArgs.toList, declaredArgs.toList, context.withPrefix("Comparing arguments on reference $valueName")) case (dealiased(value, valueArgs @ _), declared) => conformsTo(value, declared, context) // TODO: Bindings, left side only! case (value, dealiased(declared, declaredArgs @ _)) => @@ -360,7 +360,7 @@ final class TypeChecker(dists: Distributions) { ): TypeCheckerResult = { val fromChildren = check(value, context) val casesMatch = cases.flatMap{case (pattern, caseValue) => { - conformsTo(value.attributes, pattern, context.withPrefix("Checking Pattern:")) ++ + conformsTo(value.attributes, pattern.attributes, context.withPrefix("Checking Pattern:")) ++ comformsTo(caseValue.attributes, tpe, context) }} // TODO: Check values from each case @@ -426,7 +426,6 @@ final class TypeChecker(dists: Distributions) { ): TypeCheckerResult = { val fromChildren = check(valueToUpdate, context) ++ fields.flatMap { case (_, value) => check(value, context) } val fromTpe = tpe match { - // TODO: Review this type - does the output have to be the same as the input? case Type.Record(_, tpeFields) => val fieldMap = tpeFields.map(field => field.name -> field.data).toMap conformsTo(valueToUpdate.attributes, tpe) ++ fields.flatMap { field => @@ -437,7 +436,7 @@ final class TypeChecker(dists: Distributions) { } case other => List(new ImproperType(other, "Record type expected")) } - fromChildren + fromChildren ++ fromTpe } def handleVariable(tpe: UType, name: Name, context: Context): TypeCheckerResult = // TODO: Keep that in the context From 98287c8a4181fb3a2f9934ede9b142bf1721335d Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Thu, 24 Aug 2023 06:26:51 -0700 Subject: [PATCH 255/323] Incremental --- .../runtime/src/org/finos/morphir/runtime/TypeChecker.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 55fa0c1cc..0e1a22e4a 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -361,7 +361,7 @@ final class TypeChecker(dists: Distributions) { val fromChildren = check(value, context) val casesMatch = cases.flatMap{case (pattern, caseValue) => { conformsTo(value.attributes, pattern.attributes, context.withPrefix("Checking Pattern:")) ++ - comformsTo(caseValue.attributes, tpe, context) + conformsTo(caseValue.attributes, tpe, context) }} // TODO: Check values from each case // TODO: Manage store @@ -410,7 +410,7 @@ final class TypeChecker(dists: Distributions) { def handleTuple(tpe: UType, elements: List[TypedValue], context: Context): TypeCheckerResult = { val fromTpe = tpe match { case Type.Tuple(_, elementTypes) => - checkList(elements.map(_.attributes), elementTypes, context) + checkList(elements.map(_.attributes), elementTypes.toList, context) case other => List(new ImproperType(other, "Tuple expected")) } val fromChildren = elements.flatMap(check(_, context)) From dda5795f7e67bfad1eb91551eadac7530e3960e8 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Thu, 24 Aug 2023 06:29:20 -0700 Subject: [PATCH 256/323] Incremental --- .../src/org/finos/morphir/runtime/TypedMorphirRuntime.scala | 1 - 1 file changed, 1 deletion(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypedMorphirRuntime.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypedMorphirRuntime.scala index 78ebf6c17..693fecd86 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypedMorphirRuntime.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypedMorphirRuntime.scala @@ -13,7 +13,6 @@ import org.finos.morphir.datamodel.* import org.finos.morphir.runtime.environment.MorphirEnv import org.finos.morphir.runtime.exports.* -//TODO: Specify "Either" on lower level trait TypedMorphirRuntime extends MorphirRuntime[scala.Unit, UType] { final def evaluate( entryPoint: Value[scala.Unit, UType], From 285558f7c2e4e8a7f612c86b35cc011f07ba49a5 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Thu, 24 Aug 2023 06:37:10 -0700 Subject: [PATCH 257/323] Incremental --- .../finos/morphir/runtime/TypeChecker.scala | 32 +++++++++++-------- .../src/org/finos/morphir/runtime/Utils.scala | 2 +- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 0e1a22e4a..ca8fe9b26 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -20,7 +20,7 @@ import MorphirTypeError.* object TypeChecker { type TypeCheckerResult = List[MorphirTypeError] - //Object to carry data for making tracking local type bindings and context information for better error messages + // Object to carry data for making tracking local type bindings and context information for better error messages case class Context( typeBindings: Map[Name, UType], depth: Int, @@ -43,7 +43,7 @@ final class TypeChecker(dists: Distributions) { import TypeChecker.* private val dealiased = new Extractors.Types.Dealiased(dists) // TODO: Use or remove - //String utility to improve visibility of names when types don't match + // String utility to improve visibility of names when types don't match def nameThatMismatch(tpe1: UType, tpe2: UType): String = { import Extractors.Types.* (tpe1, tpe2) match { @@ -59,7 +59,7 @@ final class TypeChecker(dists: Distributions) { case _ => s"(${Succinct.Type(tpe1, 2)} vs ${Succinct.Type(tpe2, 2)})" } } - //Helper to check that two lists of types (such as tuple or arguments) match, both in length and contents + // Helper to check that two lists of types (such as tuple or arguments) match, both in length and contents def checkList( argList: List[UType], paramList: List[UType], @@ -70,7 +70,7 @@ final class TypeChecker(dists: Distributions) { else argList.zip(paramList).flatMap { case (arg, param) => conformsTo(arg, param, context) } - //Fully dealises a type. (Note that it dos not dealias branching types, such as if a tuple has an aliased member + // Fully dealises a type. (Note that it dos not dealias branching types, such as if a tuple has an aliased member def dealias(tpe: UType, context: Context): Either[MorphirTypeError, UType] = { def loop(tpe: UType, original_fqn: Option[FQName], context: Context): Either[MorphirTypeError, UType] = tpe match { @@ -100,12 +100,13 @@ final class TypeChecker(dists: Distributions) { def conformsTo(valueType: UType, declaredType: UType, context: Context): List[MorphirTypeError] = { import Extractors.Types.* (valueType, declaredType) match { + //TODO: Make variables fail if missing when binding support is up to the task case (_, Type.Variable(_, name)) => context.getTypeVariable(name) match { - case None => List(new TypeVariableMissing(name)) + case None => List() //List(new TypeVariableMissing(name)) case Some(lookedUp) => conformsTo(valueType, lookedUp, context) // TODO: Bindings } case (Type.Variable(_, name), _) => context.getTypeVariable(name) match { - case None => List(new TypeVariableMissing(name)) + case None => List()//List(new TypeVariableMissing(name)) case Some(lookedUp) => conformsTo(lookedUp, declaredType, context) } case (left @ LeafType(), right @ LeafType()) => @@ -115,17 +116,17 @@ final class TypeChecker(dists: Distributions) { case (value @ Type.Tuple(_, valueElements), declared @ Type.Tuple(_, declaredElements)) => checkList(valueElements.toList, declaredElements.toList, context.withPrefix("Comparing Tuples:")) case (valueTpe @ Type.Record(_, valueFields), declaredTpe @ Type.Record(_, declaredFields)) => - //Map both to sets + // Map both to sets val valueFieldSet: Set[Name] = valueFields.map(_.name).toSet val declaredFieldSet: Set[Name] = declaredFields.map(_.name).toSet - //Use .diff to find if some are entirely absent from the other + // Use .diff to find if some are entirely absent from the other val missingFromValue = valueFieldSet .diff(declaredFieldSet).toList.map(missing => TypeLacksField(valueTpe, missing, s"Required by ${Succinct.Type(declaredTpe)}") ) val missingFromDeclared = declaredFieldSet .diff(valueFieldSet).toList.map(bonus => TypeHasExtraField(valueTpe, declaredTpe, bonus)) - //For everything shared, lookup types in both and ensure they match + // For everything shared, lookup types in both and ensure they match val sharedFields = valueFieldSet.intersect(declaredFieldSet) val valueFieldMap: Map[Name, UType] = valueFields.map(field => field.name -> field.data).toMap val declaredFieldMap: Map[Name, UType] = declaredFields.map(field => field.name -> field.data).toMap @@ -141,7 +142,11 @@ final class TypeChecker(dists: Distributions) { conformsTo(valueElement, declaredElement, context) case (Type.Reference(_, valueName, valueArgs), Type.Reference(_, declaredName, declaredArgs)) if valueName == declaredName => - checkList(valueArgs.toList, declaredArgs.toList, context.withPrefix("Comparing arguments on reference $valueName")) + checkList( + valueArgs.toList, + declaredArgs.toList, + context.withPrefix("Comparing arguments on reference $valueName") + ) case (dealiased(value, valueArgs @ _), declared) => conformsTo(value, declared, context) // TODO: Bindings, left side only! case (value, dealiased(declared, declaredArgs @ _)) => @@ -301,7 +306,8 @@ final class TypeChecker(dists: Distributions) { def handleLambda(tpe: UType, pattern: Pattern[UType], body: TypedValue, context: Context): TypeCheckerResult = { val fromChildren = check(body, context) val fromTpe = tpe match { - case Type.Function(_, arg, ret) => conformsTo(ret, body.attributes, context) ++ conformsTo(pattern.attributes, arg, context) + case Type.Function(_, arg, ret) => + conformsTo(ret, body.attributes, context) ++ conformsTo(pattern.attributes, arg, context) case other => List(new ImproperType(other, "Field function should be function:")) } // TODO: Check tpe's argument matches (strictly) with pattern @@ -359,10 +365,10 @@ final class TypeChecker(dists: Distributions) { context: Context ): TypeCheckerResult = { val fromChildren = check(value, context) - val casesMatch = cases.flatMap{case (pattern, caseValue) => { + val casesMatch = cases.flatMap { case (pattern, caseValue) => conformsTo(value.attributes, pattern.attributes, context.withPrefix("Checking Pattern:")) ++ conformsTo(caseValue.attributes, tpe, context) - }} + } // TODO: Check values from each case // TODO: Manage store // TODO: Check each case's pattern can be its value diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala index 61b8d77be..e0e5e9644 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala @@ -41,6 +41,7 @@ object Utils { // } def applyBindings(tpe: UType, bindings: Map[Name, UType]): UType = tpe match { + case l @ LeafType => l case Type.Variable(_, name) if bindings.contains(name) => bindings(name) case Type.Tuple(_, elements) => T.tupleVar(elements.map(applyBindings(_, bindings)): _*) case DictRef(keyType, valueType) => @@ -52,7 +53,6 @@ object Utils { case Type.Function(_, argType, retType) => T.function(applyBindings(argType, bindings), applyBindings(retType, bindings)) case Type.Reference(_, name, argTypes) => T.reference(name, argTypes.map(applyBindings(_, bindings))) - case other => other // leaf nodes } def typeCheckArg(arg: UType, param: UType, found: Map[Name, UType])( From eadb13e4099ac8655033693b4700d12226a646f4 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Thu, 24 Aug 2023 06:42:31 -0700 Subject: [PATCH 258/323] Incremental --- morphir/runtime/src/org/finos/morphir/runtime/Utils.scala | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala index e0e5e9644..2330c11b5 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala @@ -39,10 +39,12 @@ object Utils { // } // loop(original_tpe, bindings) // } + //Recurses over a type tree and applies known bindings (i.e., replaces variables with their bound type) def applyBindings(tpe: UType, bindings: Map[Name, UType]): UType = tpe match { - case l @ LeafType => l + case l @ LeafType() => l case Type.Variable(_, name) if bindings.contains(name) => bindings(name) + case Type.Variable(_, name) if !bindings.contains(name) => T.variable(name) //Not an error - may be unbound in this context case Type.Tuple(_, elements) => T.tupleVar(elements.map(applyBindings(_, bindings)): _*) case DictRef(keyType, valueType) => sdk.Dict.dictType(applyBindings(keyType, bindings), applyBindings(valueType, bindings)) @@ -50,9 +52,12 @@ object Utils { case MaybeRef(elemType) => sdk.Maybe.maybeType(applyBindings(elemType, bindings)) case Type.Record(_, argFields) => T.record(argFields.map(field => Field(field.name, applyBindings(field.data, bindings)))) + case Type.ExtensibleRecord(_, name, argFields) => + T.extensibleRecord(name, argFields.map(field => Field(field.name, applyBindings(field.data, bindings)))) case Type.Function(_, argType, retType) => T.function(applyBindings(argType, bindings), applyBindings(retType, bindings)) case Type.Reference(_, name, argTypes) => T.reference(name, argTypes.map(applyBindings(_, bindings))) + case other => throw new Exception("Unmatched type during application of bindings (this should be unreachable)") } def typeCheckArg(arg: UType, param: UType, found: Map[Name, UType])( From 9e3b984724e74f160fde48d09435aa3f9f870124 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Thu, 24 Aug 2023 06:43:15 -0700 Subject: [PATCH 259/323] Incremental --- morphir/runtime/src/org/finos/morphir/runtime/Utils.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala index 2330c11b5..dd9de62af 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala @@ -44,7 +44,7 @@ object Utils { tpe match { case l @ LeafType() => l case Type.Variable(_, name) if bindings.contains(name) => bindings(name) - case Type.Variable(_, name) if !bindings.contains(name) => T.variable(name) //Not an error - may be unbound in this context + case Type.Variable(_, name)=> T.variable(name) //Not an error - may be unbound in this context case Type.Tuple(_, elements) => T.tupleVar(elements.map(applyBindings(_, bindings)): _*) case DictRef(keyType, valueType) => sdk.Dict.dictType(applyBindings(keyType, bindings), applyBindings(valueType, bindings)) @@ -57,7 +57,7 @@ object Utils { case Type.Function(_, argType, retType) => T.function(applyBindings(argType, bindings), applyBindings(retType, bindings)) case Type.Reference(_, name, argTypes) => T.reference(name, argTypes.map(applyBindings(_, bindings))) - case other => throw new Exception("Unmatched type during application of bindings (this should be unreachable)") + case Type.Unit => T.unit() } def typeCheckArg(arg: UType, param: UType, found: Map[Name, UType])( From 86b6e8da9c557a2c76bab8820cfe3bf7b319d934 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Thu, 24 Aug 2023 06:54:40 -0700 Subject: [PATCH 260/323] Incremental --- .../finos/morphir/runtime/TypeChecker.scala | 6 +++--- .../src/org/finos/morphir/runtime/Utils.scala | 18 +++--------------- 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index ca8fe9b26..0f51cc184 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -100,13 +100,13 @@ final class TypeChecker(dists: Distributions) { def conformsTo(valueType: UType, declaredType: UType, context: Context): List[MorphirTypeError] = { import Extractors.Types.* (valueType, declaredType) match { - //TODO: Make variables fail if missing when binding support is up to the task + // TODO: Make variables fail if missing when binding support is up to the task case (_, Type.Variable(_, name)) => context.getTypeVariable(name) match { - case None => List() //List(new TypeVariableMissing(name)) + case None => List() // List(new TypeVariableMissing(name)) case Some(lookedUp) => conformsTo(valueType, lookedUp, context) // TODO: Bindings } case (Type.Variable(_, name), _) => context.getTypeVariable(name) match { - case None => List()//List(new TypeVariableMissing(name)) + case None => List() // List(new TypeVariableMissing(name)) case Some(lookedUp) => conformsTo(lookedUp, declaredType, context) } case (left @ LeafType(), right @ LeafType()) => diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala index dd9de62af..5027a1072 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala @@ -57,9 +57,10 @@ object Utils { case Type.Function(_, argType, retType) => T.function(applyBindings(argType, bindings), applyBindings(retType, bindings)) case Type.Reference(_, name, argTypes) => T.reference(name, argTypes.map(applyBindings(_, bindings))) - case Type.Unit => T.unit() + case Type.Unit(_) => T.unit } + //Checks an argument against a paramter, and returns and inferable generic types from the pair (or an error) def typeCheckArg(arg: UType, param: UType, found: Map[Name, UType])( implicit options: RTExecutionContext.Options ): Either[TypeError, Map[Name, UType]] = @@ -70,20 +71,7 @@ object Utils { } else { Right(found + (name -> argType)) } - case (Type.Unit(_), Type.Unit(_)) => Right(found) - case (IntRef(), IntRef()) => Right(found) // Right? - case (IntRef(), Int16Ref()) => Right(found) - case (IntRef(), Int32Ref()) => Right(found) - case (IntRef(), Int64Ref()) => Right(found) - case (Int16Ref(), Int16Ref()) => Right(found) - case (Int32Ref(), Int32Ref()) => Right(found) - case (Int64Ref(), Int64Ref()) => Right(found) - case (FloatRef(), FloatRef()) => Right(found) - case (StringRef(), StringRef()) => Right(found) - case (CharRef(), CharRef()) => Right(found) - case (BoolRef(), BoolRef()) => Right(found) - case (LocalDateRef(), LocalDateRef()) => Right(found) - case (LocalTimeRef(), LocalTimeRef()) => Right(found) + case (l @ LeafType(), r @ LeafType()) if l == r => Right(found) case (Type.Tuple(_, argElements), Type.Tuple(_, paramElements)) => if (argElements.length != paramElements.length) { Left(new TypeMismatch(s"Different tuple arity between arg $argElements and parameter $paramElements")) From 70c44aa88b4d969244d0645b4ae3f935bca1984d Mon Sep 17 00:00:00 2001 From: EdwardPeters Date: Thu, 24 Aug 2023 07:01:39 -0700 Subject: [PATCH 261/323] Changes to move to new type error completely --- .../morphir/runtime/MorphirRuntimeError.scala | 92 ++++++++++++++++--- .../morphir/runtime/MorphirTypeError.scala | 69 -------------- .../finos/morphir/runtime/TypeChecker.scala | 18 ++-- .../runtime/TypeCheckerTests.scala.scala | 2 +- 4 files changed, 89 insertions(+), 92 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntimeError.scala b/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntimeError.scala index c61b2c23f..f0996007e 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntimeError.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntimeError.scala @@ -1,5 +1,17 @@ package org.finos.morphir.runtime +import org.finos.morphir.naming._ +import org.finos.morphir.naming._ +import org.finos.morphir.ir.{Type as T, Value as V} +import org.finos.morphir.ir.Value.{Value, Pattern, TypedValue, USpecification => UValueSpec} +import org.finos.morphir.ir.Type.{Type, UType, USpecification => UTypeSpec} +import org.finos.morphir.ir.sdk +import org.finos.morphir.ir.sdk.Basics +import org.finos.morphir.ir.Field +import org.finos.morphir.runtime.exports.* +import org.finos.morphir.ir.Literal.Lit +import zio.Chunk + sealed abstract class MorphirRuntimeError(message: String) extends Exception(message) final case class DerivationError(message: String) extends MorphirRuntimeError(message) @@ -7,19 +19,6 @@ final case class DatamodelToIrError(message: String) extends MorphirRuntimeE final case class MorphirIRDecodingError(message: String) extends MorphirRuntimeError(message) sealed abstract class EvaluationError(message: String) extends MorphirRuntimeError(message) -sealed abstract class TypeError(message: String) extends MorphirRuntimeError(message) - -final case class UnsupportedType(message: String) extends TypeError(message) -final case class TooManyArgs(message: String) extends TypeError(message) -final case class NativeFunctionTypeError(message: String) extends TypeError(message) -final case class WrongRecordSize(message: String) extends TypeError(message) -final case class InferenceConflict(message: String) extends TypeError(message) -final case class NotImplementedType(message: String) extends TypeError(message) -final case class TypeMismatch(message: String) extends TypeError(message) -final case class TypeNotFound(message: String) extends TypeError(message) -final case class ManyErrors(errors: TypeError*) extends TypeError("\n" + errors.map(_.toString).mkString("\n")) -final case class TypeCheckerErrors(errors: List[MorphirTypeError]) - extends EvaluationError("\n" + errors.map(_.toString).mkString("\n")) final case class IrToDatamodelError(message: String) extends EvaluationError(message) final case class MissingField(message: String) extends EvaluationError(message) @@ -34,3 +33,70 @@ final case class ResultDoesNotMatchType(message: String) extends EvaluationE final case class FunctionReturnedToTopLevel(message: String) extends EvaluationError(message) final case class UnsupportedTypeParameter(message: String) extends EvaluationError(message) final case class NotImplemented(message: String) extends EvaluationError(message) + +//TODO: This should be a separate error class, but interface changes required to make that happen +abstract class TypeError(msg: String) extends EvaluationError(msg) { + def getMsg: String = msg +} +object TypeError { + def succinct[TA, VA](value: Value[TA, VA]): String = Succinct.Value(value) + def succinct[TA](tpe: Type[TA]): String = Succinct.Type(tpe) + def succinct[TA](spec: T.Specification[TA]): String = Succinct.TypeSpec(spec) + + final case class TypesMismatch(tpe1: UType, tpe2: UType, msg: String) + extends TypeError(s"$msg: ${succinct(tpe1)} vs ${succinct(tpe2)}") + + final case class ArgumentDoesNotMatchParameter(arg: TypedValue, param: UType) extends TypeError( + s"Argument ${succinct(arg)} of type ${succinct(arg.attributes)} does not match parameter ${succinct(param)}" + ) + + final case class ApplyToNonFunction(nonFunction: TypedValue, arg: TypedValue) extends TypeError( + s"Tried to apply ${succinct(arg)} to ${succinct(nonFunction)} of type ${succinct(nonFunction.attributes)}, which is not a function" + ) + + final case class LiteralTypeMismatch(lit: Lit, tpe: UType) + extends TypeError(s"Literal $lit is not of type ${succinct(tpe)}") + + final case class ImproperType(tpe: UType, msg: String) extends TypeError(s"$msg. Found: ${succinct(tpe)}") + final case class ImproperTypeSpec(fqn: FQName, spec: UTypeSpec, msg: String) + extends TypeError(s"$msg. $fqn points to: ${succinct(spec)}") + + final case class CannotDealias(err: LookupError, msg: String = "Cannot dealias type") + extends TypeError(s"$msg: ${err.getMsg}") + final case class TypeVariableMissing(name: Name) extends TypeError(s"Missing type variable $name.toTitleCase") + final case class DefinitionMissing(err: LookupError) + extends TypeError(s"Cannot find definition: ${err.getMsg}") + final case class TypeMissing(err: LookupError) extends TypeError(s"Cannot find type: ${err.getMsg}") + + final case class TypeLacksField(tpe: UType, field: Name, msg: String) + extends TypeError(s"${succinct(tpe)} lacks field ${field.toCamelCase}. $msg") + final case class TypeHasExtraField(tpe: UType, contract: UType, field: Name) extends TypeError( + s"${succinct(tpe)} has field ${field.toCamelCase}, which is not included in ${succinct(contract)}" + ) + final case class ValueLacksField(value: TypedValue, contract: UType, field: Name) extends TypeError( + s"${succinct(value)} lacks field ${field.toCamelCase}, which is required by ${succinct(contract)}" + ) + final case class ValueHasExtraField(value: TypedValue, contract: UType, field: Name) extends TypeError( + s"${succinct(value)} has field ${field.toCamelCase}, which is not included in ${succinct(contract)}" + ) + final case class TypeHasDifferentFieldType( + first: UType, + second: UType, + field: Name, + firstTpe: UType, + secondTpe: UType + ) extends TypeError( + s"tpe for field ${field.toCamelCase} is ${succinct(firstTpe)} in ${succinct(first)} but ${succinct(secondTpe)} in ${succinct(second)}" + ) + final case class ConstructorMissing(err: LookupError, fqn: FQName) + extends TypeError(s"Cannot find constructor $fqn: ${err.getMsg}") + + abstract class SizeMismatch(first: Int, second: Int, msg: String) + extends TypeError(s"$msg: ($first vs $second)") + final case class ArgNumberMismatch(first: Int, second: Int, msg: String) + extends SizeMismatch(first: Int, second: Int, msg: String) + final case class Unimplemented(s: String) extends TypeError(s) + final case class OtherTypeError(msg: String) extends TypeError(msg) + final case class ManyTypeErrorsErrors(errors: List[TypeError]) + extends EvaluationError("\n" + errors.map(_.toString).mkString("\n")) +} diff --git a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala index e0e57d814..0e2abc944 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala @@ -1,71 +1,2 @@ package org.finos.morphir.runtime -import org.finos.morphir.naming._ -import org.finos.morphir.naming._ -import org.finos.morphir.ir.{Type as T, Value as V} -import org.finos.morphir.ir.Value.{Value, Pattern, TypedValue, USpecification => UValueSpec} -import org.finos.morphir.ir.Type.{Type, UType, USpecification => UTypeSpec} -import org.finos.morphir.ir.sdk -import org.finos.morphir.ir.sdk.Basics -import org.finos.morphir.ir.Field -import org.finos.morphir.runtime.exports.* -import org.finos.morphir.ir.Literal.Lit -import zio.Chunk - -abstract class MorphirTypeError(msg: String) extends Exception(msg) { - def getMsg: String = msg -} -object MorphirTypeError { - def succinct[TA, VA](value: Value[TA, VA]): String = Succinct.Value(value) - def succinct[TA](tpe: Type[TA]): String = Succinct.Type(tpe) - def succinct[TA](spec: T.Specification[TA]): String = Succinct.TypeSpec(spec) - - case class TypesMismatch(tpe1: UType, tpe2: UType, msg: String) - extends MorphirTypeError(s"$msg: ${succinct(tpe1)} vs ${succinct(tpe2)}") - - case class ArgumentDoesNotMatchParameter(arg: TypedValue, param: UType) extends MorphirTypeError( - s"Argument ${succinct(arg)} of type ${succinct(arg.attributes)} does not match parameter ${succinct(param)}" - ) - - case class ApplyToNonFunction(nonFunction: TypedValue, arg: TypedValue) extends MorphirTypeError( - s"Tried to apply ${succinct(arg)} to ${succinct(nonFunction)} of type ${succinct(nonFunction.attributes)}, which is not a function" - ) - - case class LiteralTypeMismatch(lit: Lit, tpe: UType) - extends MorphirTypeError(s"Literal $lit is not of type ${succinct(tpe)}") - - case class ImproperType(tpe: UType, msg: String) extends MorphirTypeError(s"$msg. Found: ${succinct(tpe)}") - case class ImproperTypeSpec(fqn: FQName, spec: UTypeSpec, msg: String) - extends MorphirTypeError(s"$msg. $fqn points to: ${succinct(spec)}") - - case class CannotDealias(err: LookupError, msg: String = "Cannot dealias type") - extends MorphirTypeError(s"$msg: ${err.getMsg}") - case class TypeVariableMissing(name: Name) extends MorphirTypeError(s"Missing type variable $name.toTitleCase") - case class DefinitionMissing(err: LookupError) extends MorphirTypeError(s"Cannot find definition: ${err.getMsg}") - case class TypeMissing(err: LookupError) extends MorphirTypeError(s"Cannot find type: ${err.getMsg}") - - case class TypeLacksField(tpe: UType, field: Name, msg: String) - extends MorphirTypeError(s"${succinct(tpe)} lacks field ${field.toCamelCase}. $msg") - case class TypeHasExtraField(tpe: UType, contract: UType, field: Name) extends MorphirTypeError( - s"${succinct(tpe)} has field ${field.toCamelCase}, which is not included in ${succinct(contract)}" - ) - case class ValueLacksField(value: TypedValue, contract: UType, field: Name) extends MorphirTypeError( - s"${succinct(value)} lacks field ${field.toCamelCase}, which is required by ${succinct(contract)}" - ) - case class ValueHasExtraField(value: TypedValue, contract: UType, field: Name) extends MorphirTypeError( - s"${succinct(value)} has field ${field.toCamelCase}, which is not included in ${succinct(contract)}" - ) - case class TypeHasDifferentFieldType(first: UType, second: UType, field: Name, firstTpe: UType, secondTpe: UType) - extends MorphirTypeError( - s"tpe for field ${field.toCamelCase} is ${succinct(firstTpe)} in ${succinct(first)} but ${succinct(secondTpe)} in ${succinct(second)}" - ) - case class ConstructorMissing(err: LookupError, fqn: FQName) - extends MorphirTypeError(s"Cannot find constructor $fqn: ${err.getMsg}") - - abstract class SizeMismatch(first: Int, second: Int, msg: String) - extends MorphirTypeError(s"$msg: ($first vs $second)") - case class ArgNumberMismatch(first: Int, second: Int, msg: String) - extends SizeMismatch(first: Int, second: Int, msg: String) - case class Unimplemented(s: String) extends MorphirTypeError(s) - case class OtherTypeError(msg: String) extends MorphirTypeError(msg) -} diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 0f51cc184..39501589e 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -14,12 +14,12 @@ import org.finos.morphir.ir.Type.{Type, UType, USpecification as UTypeSpec} import org.finos.morphir.ir.sdk import org.finos.morphir.ir.sdk.Basics import org.finos.morphir.ir.Field -import org.finos.morphir.runtime.MorphirTypeError.CannotDealias +import org.finos.morphir.runtime.TypeError.CannotDealias import org.finos.morphir.runtime.exports.* -import MorphirTypeError.* +import TypeError.* object TypeChecker { - type TypeCheckerResult = List[MorphirTypeError] + type TypeCheckerResult = List[TypeError] // Object to carry data for making tracking local type bindings and context information for better error messages case class Context( typeBindings: Map[Name, UType], @@ -35,7 +35,7 @@ object TypeChecker { object Context { def empty = Context(Map(), 0, "") } - def helper(condition: Boolean, error: MorphirTypeError) = if (condition) List(error) else List() + def helper(condition: Boolean, error: TypeError) = if (condition) List(error) else List() } //TODO: This is final because references to ValueDefinition are private, and thus letDefinition and letRecursion handlers cannot be overridden. There may be a better way to handle this. @@ -71,8 +71,8 @@ final class TypeChecker(dists: Distributions) { argList.zip(paramList).flatMap { case (arg, param) => conformsTo(arg, param, context) } // Fully dealises a type. (Note that it dos not dealias branching types, such as if a tuple has an aliased member - def dealias(tpe: UType, context: Context): Either[MorphirTypeError, UType] = { - def loop(tpe: UType, original_fqn: Option[FQName], context: Context): Either[MorphirTypeError, UType] = + def dealias(tpe: UType, context: Context): Either[TypeError, UType] = { + def loop(tpe: UType, original_fqn: Option[FQName], context: Context): Either[TypeError, UType] = tpe match { case ref @ Extractors.Types.NativeRef() => Right(ref) // TODO: Bindings case Type.Reference(_, typeName, typeArgs) => @@ -95,9 +95,9 @@ final class TypeChecker(dists: Distributions) { loop(tpe, None, context) } - def conformsTo(valueType: UType, declaredType: UType): List[MorphirTypeError] = + def conformsTo(valueType: UType, declaredType: UType): List[TypeError] = conformsTo(valueType, declaredType, Context.empty) - def conformsTo(valueType: UType, declaredType: UType, context: Context): List[MorphirTypeError] = { + def conformsTo(valueType: UType, declaredType: UType, context: Context): List[TypeError] = { import Extractors.Types.* (valueType, declaredType) match { // TODO: Make variables fail if missing when binding support is up to the task @@ -343,7 +343,7 @@ final class TypeChecker(dists: Distributions) { val fromChildren = elements.flatMap(check(_, context)) val fromTpe = tpe match { case Extractors.Types.ListRef(elementType) => - elements.foldLeft(List(): List[MorphirTypeError]) { (acc, next) => + elements.foldLeft(List(): List[TypeError]) { (acc, next) => acc ++ conformsTo(elementType, next.attributes, context) if (acc.size != 0) acc else { diff --git a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala index d8745478f..c242bb3de 100644 --- a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala +++ b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/TypeCheckerTests.scala.scala @@ -50,7 +50,7 @@ object TypeCheckerTests extends MorphirBaseSpec { else assertTrue(errorMsgs == s"Expected $expectedErrors errors") } yield assert // TODO: Cleaner "fails" impl } - def runTypeCheck(value: TypedValue): ZIO[TypeChecker, Throwable, List[MorphirTypeError]] = + def runTypeCheck(value: TypedValue): ZIO[TypeChecker, Throwable, List[TypeError]] = ZIO.serviceWithZIO[TypeChecker] { checker => ZIO.succeed(checker.check(value)) } From 3b80d46d4319ac030f69a4110ad570790aa682c4 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Thu, 24 Aug 2023 07:05:55 -0700 Subject: [PATCH 262/323] Incremental --- .../src/org/finos/morphir/runtime/MorphirRuntimeError.scala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntimeError.scala b/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntimeError.scala index f0996007e..4195c3f94 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntimeError.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntimeError.scala @@ -95,7 +95,8 @@ object TypeError { extends TypeError(s"$msg: ($first vs $second)") final case class ArgNumberMismatch(first: Int, second: Int, msg: String) extends SizeMismatch(first: Int, second: Int, msg: String) - final case class Unimplemented(s: String) extends TypeError(s) + final casee class InferenceMismatch(msg : String) extends TypeError(msg) + final case class Unimplemented(msg: String) extends TypeError(msg) final case class OtherTypeError(msg: String) extends TypeError(msg) final case class ManyTypeErrorsErrors(errors: List[TypeError]) extends EvaluationError("\n" + errors.map(_.toString).mkString("\n")) From bba241633d65ff80dc2b0fdb2bd45f2852b09c54 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Thu, 24 Aug 2023 07:07:23 -0700 Subject: [PATCH 263/323] Incremental --- morphir/runtime/src/org/finos/morphir/runtime/Utils.scala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala index 5027a1072..f0f4f45cf 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala @@ -61,6 +61,7 @@ object Utils { } //Checks an argument against a paramter, and returns and inferable generic types from the pair (or an error) + //TODO: Move to type checker, or remove altogether def typeCheckArg(arg: UType, param: UType, found: Map[Name, UType])( implicit options: RTExecutionContext.Options ): Either[TypeError, Map[Name, UType]] = @@ -74,7 +75,7 @@ object Utils { case (l @ LeafType(), r @ LeafType()) if l == r => Right(found) case (Type.Tuple(_, argElements), Type.Tuple(_, paramElements)) => if (argElements.length != paramElements.length) { - Left(new TypeMismatch(s"Different tuple arity between arg $argElements and parameter $paramElements")) + Left(new SizeMismatch(argElements.length, paramElements.length, s"Different tuple arity between arg $argElements and parameter $paramElements")) } else { argElements.zip(paramElements).foldLeft(Right(found): Either[TypeError, Map[Name, UType]]) { case (acc, (argElement, paramElement)) => From 85a5a9566877d05f34de7607b3f064f5094e21db Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Thu, 24 Aug 2023 07:08:13 -0700 Subject: [PATCH 264/323] Incremental --- .../src/org/finos/morphir/runtime/MorphirRuntimeError.scala | 2 +- morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntimeError.scala b/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntimeError.scala index 4195c3f94..e54eae01e 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntimeError.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntimeError.scala @@ -96,7 +96,7 @@ object TypeError { final case class ArgNumberMismatch(first: Int, second: Int, msg: String) extends SizeMismatch(first: Int, second: Int, msg: String) final casee class InferenceMismatch(msg : String) extends TypeError(msg) - final case class Unimplemented(msg: String) extends TypeError(msg) + final case class UnimplementedType(msg: String) extends TypeError(msg) final case class OtherTypeError(msg: String) extends TypeError(msg) final case class ManyTypeErrorsErrors(errors: List[TypeError]) extends EvaluationError("\n" + errors.map(_.toString).mkString("\n")) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 39501589e..fe018c2a7 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -153,7 +153,7 @@ final class TypeChecker(dists: Distributions) { conformsTo(value, declared, context) // TODO: Bindings, right side only! case (valueOther, declaredOther) if valueOther.getClass == declaredOther.getClass => List( - new Unimplemented(s"No matching support for ${Succinct.Type(valueOther)} vs ${Succinct.Type(declaredOther)}") + new UnimplementedType(s"No matching support for ${Succinct.Type(valueOther)} vs ${Succinct.Type(declaredOther)}") ) case (valueOther, declaredOther) => List(new TypesMismatch(valueOther, declaredOther, "Different types of type")) } From de986216158623e7a0fe0d2736b614d19ddb1300 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Thu, 24 Aug 2023 07:14:45 -0700 Subject: [PATCH 265/323] Incremental --- .../src/org/finos/morphir/runtime/MorphirRuntimeError.scala | 2 +- .../src/org/finos/morphir/runtime/MorphirTypeError.scala | 2 -- morphir/runtime/src/org/finos/morphir/runtime/Utils.scala | 5 +++-- 3 files changed, 4 insertions(+), 5 deletions(-) delete mode 100644 morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala diff --git a/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntimeError.scala b/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntimeError.scala index e54eae01e..dc831488a 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntimeError.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntimeError.scala @@ -95,7 +95,7 @@ object TypeError { extends TypeError(s"$msg: ($first vs $second)") final case class ArgNumberMismatch(first: Int, second: Int, msg: String) extends SizeMismatch(first: Int, second: Int, msg: String) - final casee class InferenceMismatch(msg : String) extends TypeError(msg) + final case class InferenceConflict(msg : String) extends TypeError(msg) final case class UnimplementedType(msg: String) extends TypeError(msg) final case class OtherTypeError(msg: String) extends TypeError(msg) final case class ManyTypeErrorsErrors(errors: List[TypeError]) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala b/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala deleted file mode 100644 index 0e2abc944..000000000 --- a/morphir/runtime/src/org/finos/morphir/runtime/MorphirTypeError.scala +++ /dev/null @@ -1,2 +0,0 @@ -package org.finos.morphir.runtime - diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala index f0f4f45cf..a4e9b4ce6 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala @@ -16,6 +16,7 @@ import org.finos.morphir.ir.distribution.Distribution.Library import org.finos.morphir.ir.sdk import org.finos.morphir.ir.Value.{USpecification => UValueSpec, Definition => ValueDefinition} import org.finos.morphir.ir.Type.{USpecification => UTypeSpec} +import TypeError.* object Utils { import Extractors.Types.* @@ -96,7 +97,7 @@ object Utils { case (MaybeRef(argElement), MaybeRef(paramElement)) => typeCheckArg(argElement, paramElement, found) case (Type.Record(_, argFields), Type.Record(_, paramFields)) => if (argFields.length != paramFields.length) { - Left(WrongRecordSize(s"Record lengths differ between arg : $argFields and param: $paramFields")) + Left(new SizeMismatch(argFields.length, paramFields.length, s"Record lengths differ between arg : $argFields and param: $paramFields")) } else { argFields.zip(paramFields).foldLeft(Right(found): Either[TypeError, Map[Name, UType]]) { case (acc, (argField, paramField)) => @@ -119,7 +120,7 @@ object Utils { case (otherArg, otherParam) => options.enableTyper match { case EnableTyper.Enabled => - Left(NotImplementedType(s"Cannot match $otherArg with $otherParam")) + Left(UnimplementedType(s"Cannot match $otherArg with $otherParam")) case EnableTyper.Warn => println(s"[WARNING] Cannot match $otherArg with $otherParam") Right(found) From b8742f201736497a7ef9e38d9b6565ac56f5f6bf Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Thu, 24 Aug 2023 07:20:51 -0700 Subject: [PATCH 266/323] Incremental --- .../src/org/finos/morphir/runtime/MorphirRuntimeError.scala | 4 ++-- .../org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntimeError.scala b/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntimeError.scala index dc831488a..8ccb004da 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntimeError.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntimeError.scala @@ -91,13 +91,13 @@ object TypeError { final case class ConstructorMissing(err: LookupError, fqn: FQName) extends TypeError(s"Cannot find constructor $fqn: ${err.getMsg}") - abstract class SizeMismatch(first: Int, second: Int, msg: String) + class SizeMismatch(first: Int, second: Int, msg: String) extends TypeError(s"$msg: ($first vs $second)") final case class ArgNumberMismatch(first: Int, second: Int, msg: String) extends SizeMismatch(first: Int, second: Int, msg: String) final case class InferenceConflict(msg : String) extends TypeError(msg) final case class UnimplementedType(msg: String) extends TypeError(msg) final case class OtherTypeError(msg: String) extends TypeError(msg) - final case class ManyTypeErrorsErrors(errors: List[TypeError]) + final case class ManyTypeErrors(errors: List[TypeError]) extends EvaluationError("\n" + errors.map(_.toString).mkString("\n")) } diff --git a/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala b/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala index 1f8c5c961..5416fcdea 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala @@ -62,7 +62,7 @@ private[runtime] case class QuickMorphirRuntime(dists: Distributions, store: Sto case EnableTyper.Enabled => val errors = new TypeChecker(dists).check(value) if (errors.length == 0) RTAction.succeed[RTExecutionContext, Unit](()) - else RTAction.fail(TypeCheckerErrors(errors)) + else RTAction.fail(TypeError.ManyTypeErrors(errors)) } } yield result From 1f5241444fc271d4e7fd5b3df8628a7ec2a8da31 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Thu, 24 Aug 2023 07:28:22 -0700 Subject: [PATCH 267/323] Incremental --- .../morphir/runtime/MorphirRuntimeError.scala | 71 ++++++++++++------- .../runtime/services/kernel/Kernel.scala | 6 +- 2 files changed, 48 insertions(+), 29 deletions(-) diff --git a/morphir/src/org/finos/morphir/runtime/MorphirRuntimeError.scala b/morphir/src/org/finos/morphir/runtime/MorphirRuntimeError.scala index 974cedddb..decbca4a5 100644 --- a/morphir/src/org/finos/morphir/runtime/MorphirRuntimeError.scala +++ b/morphir/src/org/finos/morphir/runtime/MorphirRuntimeError.scala @@ -1,28 +1,47 @@ package org.finos.morphir.runtime -sealed abstract class MorphirRuntimeError(message: String) extends Exception(message) - -final case class DerivationError(message: String) extends MorphirRuntimeError(message) -final case class DatamodelToIrError(message: String) extends MorphirRuntimeError(message) -final case class MorphirIRDecodingError(message: String) extends MorphirRuntimeError(message) - -sealed abstract class EvaluationError(message: String) extends MorphirRuntimeError(message) -sealed abstract class TypeError(message: String) extends MorphirRuntimeError(message) -sealed abstract class VariableAccessError(message: String) extends EvaluationError(message) - -final case class UnsupportedType(message: String) extends TypeError(message) -final case class TooManyArgs(message: String) extends TypeError(message) -final case class IrToDatamodelError(message: String) extends EvaluationError(message) -final case class MissingField(message: String) extends EvaluationError(message) -final case class UnexpectedType(message: String) extends EvaluationError(message) -final case class UnmatchedPattern(message: String) extends EvaluationError(message) -final case class FunctionWithoutParameters(message: String) extends EvaluationError(message) -final case class VariableNotFound(message: String) extends VariableAccessError(message) -final case class DefinitionNotFound(message: String) extends EvaluationError(message) -final case class SpecificationNotFound(message: String) extends EvaluationError(message) -final case class ConstructorNotFound(message: String) extends EvaluationError(message) -//final case class TypeNotFound(message: String) extends EvaluationError(message) -final case class ResultDoesNotMatchType(message: String) extends EvaluationError(message) -final case class FunctionReturnedToTopLevel(message: String) extends EvaluationError(message) -final case class UnsupportedTypeParameter(message: String) extends EvaluationError(message) -final case class NotImplemented(message: String) extends EvaluationError(message) +sealed abstract class RTError(message: String) extends Exception(message) +object RTError { + final case class DerivationError(message: String) extends RTError(message) + + final case class DatamodelToIrError(message: String) extends RTError(message) + + final case class MorphirIRDecodingError(message: String) extends RTError(message) + + sealed abstract class EvaluationError(message: String) extends RTError(message) + + sealed abstract class TypeError(message: String) extends RTError(message) + + sealed abstract class VariableAccessError(message: String) extends EvaluationError(message) + + final case class UnsupportedType(message: String) extends TypeError(message) + + final case class TooManyArgs(message: String) extends TypeError(message) + + final case class IrToDatamodelError(message: String) extends EvaluationError(message) + + final case class MissingField(message: String) extends EvaluationError(message) + + final case class UnexpectedType(message: String) extends EvaluationError(message) + + final case class UnmatchedPattern(message: String) extends EvaluationError(message) + + final case class FunctionWithoutParameters(message: String) extends EvaluationError(message) + + final case class VariableNotFound(message: String) extends VariableAccessError(message) + + final case class DefinitionNotFound(message: String) extends EvaluationError(message) + + final case class SpecificationNotFound(message: String) extends EvaluationError(message) + + final case class ConstructorNotFound(message: String) extends EvaluationError(message) + + //final case class TypeNotFound(message: String) extends EvaluationError(message) + final case class ResultDoesNotMatchType(message: String) extends EvaluationError(message) + + final case class FunctionReturnedToTopLevel(message: String) extends EvaluationError(message) + + final case class UnsupportedTypeParameter(message: String) extends EvaluationError(message) + + final case class NotImplemented(message: String) extends EvaluationError(message) +} diff --git a/morphir/src/org/finos/morphir/runtime/services/kernel/Kernel.scala b/morphir/src/org/finos/morphir/runtime/services/kernel/Kernel.scala index 53d76f089..9af2d84be 100644 --- a/morphir/src/org/finos/morphir/runtime/services/kernel/Kernel.scala +++ b/morphir/src/org/finos/morphir/runtime/services/kernel/Kernel.scala @@ -7,19 +7,19 @@ import zio.prelude.fx.ZPure trait Kernel { type VariableRef = Any // TODO: Replace with appropriate type - def accessVariable(name: Name): RTAction[Any, VariableAccessError, VariableRef] + def accessVariable(name: Name): RTAction[Any, VariableNotFound, VariableRef] } object Kernel { val live: Kernel = KernelLive() - def accessVariable(name: Name): RTAction[Kernel, VariableAccessError, Any] = + def accessVariable(name: Name): RTAction[Kernel, VariableNotFound, Any] = RTAction.serviceWith(_.accessVariable(name)) } final case class KernelLive() extends Kernel { - def accessVariable(name: Name): RTAction[Any, VariableAccessError, VariableRef] = ??? + def accessVariable(name: Name): RTAction[Any, VariableNotFound, VariableRef] = ??? } From edaf5cc5ce270ad5c662400c2e4b8b665af57f26 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Thu, 24 Aug 2023 07:38:03 -0700 Subject: [PATCH 268/323] Incremental --- .../src/org/finos/morphir/runtime/MorphirRuntimeError.scala | 1 + morphir/runtime/src/org/finos/morphir/runtime/Utils.scala | 4 ++-- .../org/finos/morphir/runtime/services/kernel/Kernel.scala | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntimeError.scala b/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntimeError.scala index 8ccb004da..115bcd94b 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntimeError.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntimeError.scala @@ -31,6 +31,7 @@ final case class SpecificationNotFound(message: String) extends EvaluationE final case class ConstructorNotFound(message: String) extends EvaluationError(message) final case class ResultDoesNotMatchType(message: String) extends EvaluationError(message) final case class FunctionReturnedToTopLevel(message: String) extends EvaluationError(message) +final case class UnsupportedType(message: String) extends EvaluationError(message) final case class UnsupportedTypeParameter(message: String) extends EvaluationError(message) final case class NotImplemented(message: String) extends EvaluationError(message) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala index a4e9b4ce6..20b15e6ee 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala @@ -110,7 +110,7 @@ object Utils { paramBindings <- typeCheckArg(argReturn, paramReturn, argBindings) } yield paramBindings case (Type.ExtensibleRecord(_, _, _), Type.ExtensibleRecord(_, _, _)) => - Left(UnsupportedType(s"Extensible record type not supported (yet)")) + Left(new UnimplementedType(s"Extensible record type not supported (yet)")) case (Type.Reference(_, argTypeName, argTypeArgs), Type.Reference(_, paramTypeName, paramTypeArgs)) if (argTypeName == paramTypeName) => argTypeArgs.zip(paramTypeArgs).foldLeft(Right(found): Either[TypeError, Map[Name, UType]]) { @@ -120,7 +120,7 @@ object Utils { case (otherArg, otherParam) => options.enableTyper match { case EnableTyper.Enabled => - Left(UnimplementedType(s"Cannot match $otherArg with $otherParam")) + Left(new UnimplementedType(s"Cannot match $otherArg with $otherParam")) case EnableTyper.Warn => println(s"[WARNING] Cannot match $otherArg with $otherParam") Right(found) diff --git a/morphir/src/org/finos/morphir/runtime/services/kernel/Kernel.scala b/morphir/src/org/finos/morphir/runtime/services/kernel/Kernel.scala index 9af2d84be..c461640a8 100644 --- a/morphir/src/org/finos/morphir/runtime/services/kernel/Kernel.scala +++ b/morphir/src/org/finos/morphir/runtime/services/kernel/Kernel.scala @@ -4,6 +4,7 @@ import org.finos.morphir.naming.* import org.finos.morphir.runtime.* import org.finos.morphir.runtime.exports.* import zio.prelude.fx.ZPure +import RTError.* trait Kernel { type VariableRef = Any // TODO: Replace with appropriate type From a8a0787cd53f65c6766d5051d372dc77dd9cf8e0 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Thu, 24 Aug 2023 07:53:43 -0700 Subject: [PATCH 269/323] Incremental --- morphir/runtime/src/org/finos/morphir/runtime/Utils.scala | 2 +- .../finos/morphir/runtime/quick/QuickMorphirRuntime.scala | 8 +------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala index 20b15e6ee..d6b4ce783 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala @@ -154,7 +154,7 @@ object Utils { case (dealiaser(inner, aliasBindings), args) => findTypeBindings(inner, args, dists, knownBindings ++ aliasBindings) case (nonFunction, head :: _) => - RTAction.fail(TooManyArgs(s"Tried to apply argument $head to non-function $nonFunction")) + RTAction.fail(new ImproperType(nonFunction, s"Tried to apply argument ${Succinct.Value(head)} to non-function")) } } def isNative(fqn: FQName): Boolean = { diff --git a/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala b/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala index 5416fcdea..860dc3e8f 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala @@ -32,13 +32,7 @@ private[runtime] case class QuickMorphirRuntime(dists: Distributions, store: Sto } yield res def evaluate(value: Value[scala.Unit, UType]): RTAction[MorphirEnv, EvaluationError, Data] = - // val errors = new TypeChecker(dists).check(value) for { -// ctx <- ZPure.get[RTExecutionContext] -// -// _ <- if (errors.length == 0) RTAction.succeed(()) else { -// RTAction.fail(TypeCheckerErrors(errors)) -// } _ <- typeCheck(value) res <- EvaluatorQuick.evalAction(value, store, dists) } yield res @@ -78,7 +72,7 @@ private[runtime] case class QuickMorphirRuntime(dists: Distributions, store: Sto for { tpe <- findTypeBindings(tpe, params.toList, dists, Map())(ctx.options) } yield V.apply(tpe, entryPoint, params.head, params.tail: _*) - case other => RTAction.fail(UnsupportedType(s"Entry point must be a Reference, instead found $other")) + case other => RTAction.fail(new TypeError.OtherTypeError(s"Entry point must be a Reference, instead found ${Succinct.Value(other)}")) } } } yield out From 5652bccce24579a29f4813102ea04a877d1e355e Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Thu, 24 Aug 2023 07:55:25 -0700 Subject: [PATCH 270/323] Formatting --- .../morphir/runtime/MorphirRuntimeError.scala | 8 +++--- .../finos/morphir/runtime/TypeChecker.scala | 4 ++- .../src/org/finos/morphir/runtime/Utils.scala | 26 ++++++++++++------- .../runtime/quick/QuickMorphirRuntime.scala | 4 ++- .../morphir/runtime/MorphirRuntimeError.scala | 2 +- 5 files changed, 28 insertions(+), 16 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntimeError.scala b/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntimeError.scala index 115bcd94b..b7d57cb5c 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntimeError.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntimeError.scala @@ -31,7 +31,7 @@ final case class SpecificationNotFound(message: String) extends EvaluationE final case class ConstructorNotFound(message: String) extends EvaluationError(message) final case class ResultDoesNotMatchType(message: String) extends EvaluationError(message) final case class FunctionReturnedToTopLevel(message: String) extends EvaluationError(message) -final case class UnsupportedType(message: String) extends EvaluationError(message) +final case class UnsupportedType(message: String) extends EvaluationError(message) final case class UnsupportedTypeParameter(message: String) extends EvaluationError(message) final case class NotImplemented(message: String) extends EvaluationError(message) @@ -96,9 +96,9 @@ object TypeError { extends TypeError(s"$msg: ($first vs $second)") final case class ArgNumberMismatch(first: Int, second: Int, msg: String) extends SizeMismatch(first: Int, second: Int, msg: String) - final case class InferenceConflict(msg : String) extends TypeError(msg) - final case class UnimplementedType(msg: String) extends TypeError(msg) - final case class OtherTypeError(msg: String) extends TypeError(msg) + final case class InferenceConflict(msg: String) extends TypeError(msg) + final case class UnimplementedType(msg: String) extends TypeError(msg) + final case class OtherTypeError(msg: String) extends TypeError(msg) final case class ManyTypeErrors(errors: List[TypeError]) extends EvaluationError("\n" + errors.map(_.toString).mkString("\n")) } diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index fe018c2a7..b7040c47e 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -153,7 +153,9 @@ final class TypeChecker(dists: Distributions) { conformsTo(value, declared, context) // TODO: Bindings, right side only! case (valueOther, declaredOther) if valueOther.getClass == declaredOther.getClass => List( - new UnimplementedType(s"No matching support for ${Succinct.Type(valueOther)} vs ${Succinct.Type(declaredOther)}") + new UnimplementedType( + s"No matching support for ${Succinct.Type(valueOther)} vs ${Succinct.Type(declaredOther)}" + ) ) case (valueOther, declaredOther) => List(new TypesMismatch(valueOther, declaredOther, "Different types of type")) } diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala index d6b4ce783..8ba93e7f2 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala @@ -40,13 +40,13 @@ object Utils { // } // loop(original_tpe, bindings) // } - //Recurses over a type tree and applies known bindings (i.e., replaces variables with their bound type) + // Recurses over a type tree and applies known bindings (i.e., replaces variables with their bound type) def applyBindings(tpe: UType, bindings: Map[Name, UType]): UType = tpe match { - case l @ LeafType() => l + case l @ LeafType() => l case Type.Variable(_, name) if bindings.contains(name) => bindings(name) - case Type.Variable(_, name)=> T.variable(name) //Not an error - may be unbound in this context - case Type.Tuple(_, elements) => T.tupleVar(elements.map(applyBindings(_, bindings)): _*) + case Type.Variable(_, name) => T.variable(name) // Not an error - may be unbound in this context + case Type.Tuple(_, elements) => T.tupleVar(elements.map(applyBindings(_, bindings)): _*) case DictRef(keyType, valueType) => sdk.Dict.dictType(applyBindings(keyType, bindings), applyBindings(valueType, bindings)) case ListRef(elemType) => sdk.List.listType(applyBindings(elemType, bindings)) @@ -58,11 +58,11 @@ object Utils { case Type.Function(_, argType, retType) => T.function(applyBindings(argType, bindings), applyBindings(retType, bindings)) case Type.Reference(_, name, argTypes) => T.reference(name, argTypes.map(applyBindings(_, bindings))) - case Type.Unit(_) => T.unit + case Type.Unit(_) => T.unit } - //Checks an argument against a paramter, and returns and inferable generic types from the pair (or an error) - //TODO: Move to type checker, or remove altogether + // Checks an argument against a paramter, and returns and inferable generic types from the pair (or an error) + // TODO: Move to type checker, or remove altogether def typeCheckArg(arg: UType, param: UType, found: Map[Name, UType])( implicit options: RTExecutionContext.Options ): Either[TypeError, Map[Name, UType]] = @@ -76,7 +76,11 @@ object Utils { case (l @ LeafType(), r @ LeafType()) if l == r => Right(found) case (Type.Tuple(_, argElements), Type.Tuple(_, paramElements)) => if (argElements.length != paramElements.length) { - Left(new SizeMismatch(argElements.length, paramElements.length, s"Different tuple arity between arg $argElements and parameter $paramElements")) + Left(new SizeMismatch( + argElements.length, + paramElements.length, + s"Different tuple arity between arg $argElements and parameter $paramElements" + )) } else { argElements.zip(paramElements).foldLeft(Right(found): Either[TypeError, Map[Name, UType]]) { case (acc, (argElement, paramElement)) => @@ -97,7 +101,11 @@ object Utils { case (MaybeRef(argElement), MaybeRef(paramElement)) => typeCheckArg(argElement, paramElement, found) case (Type.Record(_, argFields), Type.Record(_, paramFields)) => if (argFields.length != paramFields.length) { - Left(new SizeMismatch(argFields.length, paramFields.length, s"Record lengths differ between arg : $argFields and param: $paramFields")) + Left(new SizeMismatch( + argFields.length, + paramFields.length, + s"Record lengths differ between arg : $argFields and param: $paramFields" + )) } else { argFields.zip(paramFields).foldLeft(Right(found): Either[TypeError, Map[Name, UType]]) { case (acc, (argField, paramField)) => diff --git a/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala b/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala index 860dc3e8f..f7fe75881 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala @@ -72,7 +72,9 @@ private[runtime] case class QuickMorphirRuntime(dists: Distributions, store: Sto for { tpe <- findTypeBindings(tpe, params.toList, dists, Map())(ctx.options) } yield V.apply(tpe, entryPoint, params.head, params.tail: _*) - case other => RTAction.fail(new TypeError.OtherTypeError(s"Entry point must be a Reference, instead found ${Succinct.Value(other)}")) + case other => RTAction.fail( + new TypeError.OtherTypeError(s"Entry point must be a Reference, instead found ${Succinct.Value(other)}") + ) } } } yield out diff --git a/morphir/src/org/finos/morphir/runtime/MorphirRuntimeError.scala b/morphir/src/org/finos/morphir/runtime/MorphirRuntimeError.scala index decbca4a5..070a7ea06 100644 --- a/morphir/src/org/finos/morphir/runtime/MorphirRuntimeError.scala +++ b/morphir/src/org/finos/morphir/runtime/MorphirRuntimeError.scala @@ -36,7 +36,7 @@ object RTError { final case class ConstructorNotFound(message: String) extends EvaluationError(message) - //final case class TypeNotFound(message: String) extends EvaluationError(message) + // final case class TypeNotFound(message: String) extends EvaluationError(message) final case class ResultDoesNotMatchType(message: String) extends EvaluationError(message) final case class FunctionReturnedToTopLevel(message: String) extends EvaluationError(message) From fc52396148103f347d399bd009c95ed93ded8d87 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Thu, 24 Aug 2023 08:23:19 -0700 Subject: [PATCH 271/323] Formatting --- .../runtime/src/org/finos/morphir/runtime/TypeChecker.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index b7040c47e..b232d9e03 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -113,7 +113,7 @@ final class TypeChecker(dists: Distributions) { if (left == right) List() else List(TypesMismatch(left, right, "Value type does not match declared type")) case (Type.Function(_, valueArg, valueRet), Type.Function(_, declaredArg, declaredRet)) => conformsTo(valueRet, declaredRet, context) ++ conformsTo(declaredArg, valueArg, context) - case (value @ Type.Tuple(_, valueElements), declared @ Type.Tuple(_, declaredElements)) => + case (Type.Tuple(_, valueElements), Type.Tuple(_, declaredElements)) => checkList(valueElements.toList, declaredElements.toList, context.withPrefix("Comparing Tuples:")) case (valueTpe @ Type.Record(_, valueFields), declaredTpe @ Type.Record(_, declaredFields)) => // Map both to sets @@ -145,7 +145,7 @@ final class TypeChecker(dists: Distributions) { checkList( valueArgs.toList, declaredArgs.toList, - context.withPrefix("Comparing arguments on reference $valueName") + context.withPrefix(s"Comparing arguments on reference $valueName") ) case (dealiased(value, valueArgs @ _), declared) => conformsTo(value, declared, context) // TODO: Bindings, left side only! From a9b806471d6daf900fe1fddc157ceaaf397ca468 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Thu, 24 Aug 2023 12:45:18 -0700 Subject: [PATCH 272/323] Formatting --- .../runtime/src/org/finos/morphir/runtime/Extractors.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala b/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala index 7f6d7510a..132c75f58 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala @@ -109,7 +109,7 @@ object Extractors { tpe match { case Type.Reference(_, name, args) // TODO: NATIVE_CHECK - if (name.packagePath != Basics.intType.asInstanceOf[Type.Reference[Unit]].typeName.packagePath) => + if (!Utils.isNative(name)) => Some((name, args)) case _ => None } @@ -120,7 +120,7 @@ object Extractors { tpe match { case Type.Reference(_, name, _) // TODO: NATIVE_CHECK - if (name.packagePath == Basics.intType.asInstanceOf[Type.Reference[Unit]].typeName.packagePath) => true + if (Utils.isNative(name)) => true case _ => false } } From bb1d636a0e34324c6e5925becd6248d05a3507d5 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Thu, 24 Aug 2023 13:02:42 -0700 Subject: [PATCH 273/323] Incremental --- .../src/org/finos/morphir/runtime/Extractors.scala | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala b/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala index 132c75f58..31ea1dd77 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala @@ -108,7 +108,6 @@ object Extractors { def unapply(tpe: UType): Option[(FQName, Chunk[UType])] = tpe match { case Type.Reference(_, name, args) - // TODO: NATIVE_CHECK if (!Utils.isNative(name)) => Some((name, args)) case _ => None @@ -119,15 +118,13 @@ object Extractors { def unapply(tpe: UType): Boolean = tpe match { case Type.Reference(_, name, _) - // TODO: NATIVE_CHECK if (Utils.isNative(name)) => true case _ => false } } - // Extractor object that unwraps a single layer of aliasing, and gives any type names that were bound in the process + // Extractor object that unwraps a single layer of aliasing, applying any bindings that were discovered in the process class Dealiased(dists: Distributions) { - // TODO: DEALIASING_CLEANUP - def unapply(tpe: UType): Option[(UType, Map[Name, UType])] = // If it's aliased we may need to grab bindings + def unapply(tpe: UType): Option[UType] = // If it's aliased we may need to grab bindings tpe match { case NativeRef() => None case Type.Reference(_, typeName, typeArgs) => @@ -135,16 +132,16 @@ object Extractors { lookedUp match { case Right(T.Specification.TypeAliasSpecification(typeParams, expr)) => val newBindings = typeParams.zip(typeArgs).toMap - Some((expr, newBindings)) + Some(Utils.applyBindings(expr, newBindings)) case _ => None // Missing name, but failing extractors cause problems } case _ => None } } - class FunctionOnion(dists: Distributions) { + //Extractor object that uncurries a function type, dealiasing along the way to reeturn a result value and flat list of arguments + class CurriedOnion(dists: Distributions) { val dealiaser = new Dealiased(dists) - def unapply(tpe: UType): Option[(UType, List[UType])] = { val myself = this tpe match { From b12fcee4811231381c6ad793b6a60440e55d0610 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Thu, 24 Aug 2023 14:02:35 -0700 Subject: [PATCH 274/323] Incremental --- .../src/org/finos/morphir/runtime/Extractors.scala | 3 +-- .../src/org/finos/morphir/runtime/TypeChecker.scala | 8 ++++---- morphir/runtime/src/org/finos/morphir/runtime/Utils.scala | 4 ++-- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala b/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala index 31ea1dd77..c3f7933d8 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala @@ -147,9 +147,8 @@ object Extractors { tpe match { case Type.Function(_, arg, myself(inner, args)) => Some((inner, args :+ arg)) - case dealiaser(myself(inner, args), _) => + case dealiaser(myself(inner, args)) => Some((inner, args)) - // TODO: BINDINGS case other => Some((other, List())) } diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index b232d9e03..f383bf241 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -147,10 +147,10 @@ final class TypeChecker(dists: Distributions) { declaredArgs.toList, context.withPrefix(s"Comparing arguments on reference $valueName") ) - case (dealiased(value, valueArgs @ _), declared) => - conformsTo(value, declared, context) // TODO: Bindings, left side only! - case (value, dealiased(declared, declaredArgs @ _)) => - conformsTo(value, declared, context) // TODO: Bindings, right side only! + case (dealiased(value), declared) => + conformsTo(value, declared, context) + case (value, dealiased(declared)) => + conformsTo(value, declared, context) case (valueOther, declaredOther) if valueOther.getClass == declaredOther.getClass => List( new UnimplementedType( diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala index 8ba93e7f2..6fc46fd0d 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala @@ -159,8 +159,8 @@ object Utils { appliedType <- findTypeBindings(returnType, tail, dists, bindings) } yield appliedType case (tpe, Nil) => RTAction.succeed(applyBindings(tpe, knownBindings)) - case (dealiaser(inner, aliasBindings), args) => - findTypeBindings(inner, args, dists, knownBindings ++ aliasBindings) + case (dealiaser(inner), args) => + findTypeBindings(inner, args, dists, knownBindings) case (nonFunction, head :: _) => RTAction.fail(new ImproperType(nonFunction, s"Tried to apply argument ${Succinct.Value(head)} to non-function")) } From f9ee2df0d034efbede5bea01e27b06da3237329f Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Thu, 24 Aug 2023 14:20:01 -0700 Subject: [PATCH 275/323] Incremental --- morphir/runtime/src/org/finos/morphir/runtime/Utils.scala | 5 ----- 1 file changed, 5 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala index 6fc46fd0d..d9582dd55 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala @@ -150,12 +150,7 @@ object Utils { (curried, args) match { case (Type.Function(_, parameterType, returnType), head :: tail) => for { - - // errors <- RTAction.succeed(new ArgTypeChecker(dists).reallyTypeCheckArg(head, parameterType, "")) bindings <- RTAction.fromEither(typeCheckArg(head.attributes, parameterType, knownBindings)) - // _ <- RTAction.fail( new ManyErrors(errors: _*)) - //// errors = new TypeChecker().reallyTypeCheckArg(head, parameterType, "") - //// _ <- RTAction.fail(new ManyErrors(errors:_*)) appliedType <- findTypeBindings(returnType, tail, dists, bindings) } yield appliedType case (tpe, Nil) => RTAction.succeed(applyBindings(tpe, knownBindings)) From a017853ecefbb6a4ef09279f626ebeda6616bdac Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Thu, 24 Aug 2023 14:27:51 -0700 Subject: [PATCH 276/323] Formatting --- .../finos/morphir/runtime/Extractors.scala | 2 +- .../finos/morphir/runtime/TypeChecker.scala | 16 +++++++------- .../src/org/finos/morphir/runtime/Utils.scala | 21 +------------------ 3 files changed, 11 insertions(+), 28 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala b/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala index c3f7933d8..4a7680222 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala @@ -139,7 +139,7 @@ object Extractors { } } - //Extractor object that uncurries a function type, dealiasing along the way to reeturn a result value and flat list of arguments + // Extractor object that uncurries a function type, dealiasing along the way to reeturn a result value and flat list of arguments class CurriedOnion(dists: Distributions) { val dealiaser = new Dealiased(dists) def unapply(tpe: UType): Option[(UType, List[UType])] = { diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index f383bf241..bedc407de 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -74,14 +74,16 @@ final class TypeChecker(dists: Distributions) { def dealias(tpe: UType, context: Context): Either[TypeError, UType] = { def loop(tpe: UType, original_fqn: Option[FQName], context: Context): Either[TypeError, UType] = tpe match { - case ref @ Extractors.Types.NativeRef() => Right(ref) // TODO: Bindings + case ref @ Extractors.Types.NativeRef() => Right(ref) case Type.Reference(_, typeName, typeArgs) => val lookedUp = dists.lookupTypeSpecification(typeName.packagePath, typeName.modulePath, typeName.localName) lookedUp match { case Right(T.Specification.TypeAliasSpecification(typeParams, expr)) => - val newBindings = typeParams.zip(typeArgs).toMap - loop(expr, original_fqn.orElse(Some(typeName)), context.withTypeBindings(newBindings)) - case Right(_) => Right(tpe) // TODO: Bindings + val newBindings = typeParams.zip(typeArgs).toMap + val withBindingsApplied = Utils.applyBindings(expr, newBindings) + loop(withBindingsApplied, original_fqn.orElse(Some(typeName)), context) + case Right(_) => + Right(tpe) case Left(lookupErr) => original_fqn match { case Some(original) => @@ -90,7 +92,7 @@ final class TypeChecker(dists: Distributions) { Left(new CannotDealias(lookupErr)) } } - case other => Right(other) // TODO: Bindings + case other => Right(other) } loop(tpe, None, context) } @@ -102,8 +104,8 @@ final class TypeChecker(dists: Distributions) { (valueType, declaredType) match { // TODO: Make variables fail if missing when binding support is up to the task case (_, Type.Variable(_, name)) => context.getTypeVariable(name) match { - case None => List() // List(new TypeVariableMissing(name)) - case Some(lookedUp) => conformsTo(valueType, lookedUp, context) // TODO: Bindings + case None => List() // List(new TypeVariableMissing(name)) + case Some(lookedUp) => conformsTo(valueType, lookedUp, context) } case (Type.Variable(_, name), _) => context.getTypeVariable(name) match { case None => List() // List(new TypeVariableMissing(name)) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala index d9582dd55..acd7ad7c5 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala @@ -21,25 +21,6 @@ import TypeError.* object Utils { import Extractors.Types.* -// def dealias(original_tpe: UType, dists: Distributions, bindings: Map[Name, UType]): UType = { -// def loop(tpe: UType, bindings: Map[Name, UType]): UType = -// tpe match { -// case NativeRef() => applyBindings(tpe, bindings) // nothing further to look up -// case Type.Reference(_, typeName, typeArgs) => -// val lookedUp = dists.lookupTypeSpecification(typeName.packagePath, typeName.modulePath, typeName.localName) -// lookedUp match { -// case Some(T.Specification.TypeAliasSpecification(typeParams, expr)) => -// val resolvedArgs = typeArgs.map(dealias(_, dists, bindings)) // I think? -// val newBindings = typeParams.zip(resolvedArgs).toMap -// loop(expr, bindings ++ newBindings) -// case Some(_) => applyBindings(tpe, bindings) // Can't dealias further -// case None => -// throw new TypeNotFound(s"Unable to find $tpe while dealiasing $original_tpe") // TODO: Thread properly -// } -// case other => applyBindings(other, bindings) // Not an alias -// } -// loop(original_tpe, bindings) -// } // Recurses over a type tree and applies known bindings (i.e., replaces variables with their bound type) def applyBindings(tpe: UType, bindings: Map[Name, UType]): UType = tpe match { @@ -150,7 +131,7 @@ object Utils { (curried, args) match { case (Type.Function(_, parameterType, returnType), head :: tail) => for { - bindings <- RTAction.fromEither(typeCheckArg(head.attributes, parameterType, knownBindings)) + bindings <- RTAction.fromEither(typeCheckArg(head.attributes, parameterType, knownBindings)) appliedType <- findTypeBindings(returnType, tail, dists, bindings) } yield appliedType case (tpe, Nil) => RTAction.succeed(applyBindings(tpe, knownBindings)) From 2effef8bc30c467a017eefaa01b41879e80881f5 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Thu, 24 Aug 2023 14:35:33 -0700 Subject: [PATCH 277/323] Incremental --- .../src/org/finos/morphir/runtime/TypeChecker.scala | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index bedc407de..31df59dc4 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -244,9 +244,9 @@ final class TypeChecker(dists: Distributions) { val fromChildren = List() val (ret, args) = Utils.uncurryFunctionType(tpe) // TODO: Interleaved function type w/ aliases. val fromTpe = ret match { - // TODO: Handle bindings - case Type.Reference(_, name, typeArgs @ _) => dists.lookupTypeSpecification(name) match { - case Right(T.Specification.CustomTypeSpecification(typeParams @ _, ctors)) => + case Type.Reference(_, name, typeArgs) => dists.lookupTypeSpecification(name) match { + case Right(T.Specification.CustomTypeSpecification(typeParams, ctors)) => + val newBindings = typeParams.toList.zip(typeArgs.toList).toMap val missedName = helper( fqn.packagePath != name.packagePath || fqn.modulePath != name.modulePath, new OtherTypeError(s"Constructor $fqn does not match type name $name") @@ -255,21 +255,20 @@ final class TypeChecker(dists: Distributions) { case Some(ctorArgs) => checkList( args.toList, - ctorArgs.toList.map(_._2), + ctorArgs.toList.map(_._2).map(Utils.applyBindings(_, newBindings)), context.withPrefix(s"Comparing $fqn constructor value to looked up type ${Succinct.Type(tpe)}") ) case None => List(new OtherTypeError(s"Constructor type $name exists, but does not have arm for ${fqn.localName}")) } missedName ++ fromCtor - // TODO: Bindings case Right(other) => List(new ImproperTypeSpec(name, other, s"Type union expected")) case Left(err) => List(new TypeMissing(err)) } case other => List(new ImproperType(other, s"Reference to type union expected")) } - fromChildren + fromChildren ++ fromTpe } def handleFieldValue(tpe: UType, recordValue: TypedValue, name: Name, context: Context): TypeCheckerResult = { val fromChildren = check(recordValue, context) From 549aeea2aeee128acceafeec3ca1a2a7d539875b Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Thu, 24 Aug 2023 14:36:13 -0700 Subject: [PATCH 278/323] Incremental --- .../src/org/finos/morphir/runtime/MorphirRuntimeError.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntimeError.scala b/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntimeError.scala index b7d57cb5c..8ba37b1f5 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntimeError.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntimeError.scala @@ -67,7 +67,7 @@ object TypeError { final case class TypeVariableMissing(name: Name) extends TypeError(s"Missing type variable $name.toTitleCase") final case class DefinitionMissing(err: LookupError) extends TypeError(s"Cannot find definition: ${err.getMsg}") - final case class TypeMissing(err: LookupError) extends TypeError(s"Cannot find type: ${err.getMsg}") + final case class TypeMissing(fqn : FQName, err: LookupError) extends TypeError(s"Cannot find $fqn: ${err.getMsg}") final case class TypeLacksField(tpe: UType, field: Name, msg: String) extends TypeError(s"${succinct(tpe)} lacks field ${field.toCamelCase}. $msg") From ec12dcd5d6c06a8cd4437233713c03145da9edc2 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Thu, 24 Aug 2023 14:39:46 -0700 Subject: [PATCH 279/323] Incremental --- .../src/org/finos/morphir/runtime/TypeChecker.scala | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 31df59dc4..00eb0aad4 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -3,13 +3,7 @@ package org.finos.morphir.runtime import org.finos.morphir.naming.* import org.finos.morphir.ir.{Type as T, Value as V} import org.finos.morphir.ir.Literal.Lit -import org.finos.morphir.ir.Value.{ - Pattern, - TypedValue, - Value, - TypedDefinition as TypedValueDef, - USpecification as UValueSpec -} +import org.finos.morphir.ir.Value.{Pattern, TypedValue, Value, TypedDefinition as TypedValueDef, USpecification as UValueSpec} import org.finos.morphir.ir.Type.{Type, UType, USpecification as UTypeSpec} import org.finos.morphir.ir.sdk import org.finos.morphir.ir.sdk.Basics @@ -17,6 +11,7 @@ import org.finos.morphir.ir.Field import org.finos.morphir.runtime.TypeError.CannotDealias import org.finos.morphir.runtime.exports.* import TypeError.* +import org.finos.morphir.runtime.Extractors.Values.NativeRef object TypeChecker { type TypeCheckerResult = List[TypeError] @@ -244,7 +239,7 @@ final class TypeChecker(dists: Distributions) { val fromChildren = List() val (ret, args) = Utils.uncurryFunctionType(tpe) // TODO: Interleaved function type w/ aliases. val fromTpe = ret match { - case Type.Reference(_, name, typeArgs) => dists.lookupTypeSpecification(name) match { + case NonNativeRef(name, typeArgs) => dists.lookupTypeSpecification(name) match { case Right(T.Specification.CustomTypeSpecification(typeParams, ctors)) => val newBindings = typeParams.toList.zip(typeArgs.toList).toMap val missedName = helper( @@ -266,6 +261,7 @@ final class TypeChecker(dists: Distributions) { List(new ImproperTypeSpec(name, other, s"Type union expected")) case Left(err) => List(new TypeMissing(err)) } + case NativeRef => List() case other => List(new ImproperType(other, s"Reference to type union expected")) } fromChildren ++ fromTpe From 56496a50e35aea39c22d6abf7d88888b3ac6051c Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Thu, 24 Aug 2023 14:50:43 -0700 Subject: [PATCH 280/323] Formatting --- .../org/finos/morphir/runtime/Extractors.scala | 11 ++++++----- .../morphir/runtime/MorphirRuntimeError.scala | 2 +- .../finos/morphir/runtime/TypeChecker.scala | 18 ++++++++++++------ 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala b/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala index 4a7680222..1339a2c43 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala @@ -115,18 +115,19 @@ object Extractors { } // Matches any reference that does come from the DK object NativeRef { - def unapply(tpe: UType): Boolean = + def unapply(tpe: UType): Option[(FQName, Chunk[UType])] = tpe match { - case Type.Reference(_, name, _) - if (Utils.isNative(name)) => true - case _ => false + case Type.Reference(_, name, args) + if (Utils.isNative(name)) => + Some((name, args)) + case _ => None } } // Extractor object that unwraps a single layer of aliasing, applying any bindings that were discovered in the process class Dealiased(dists: Distributions) { def unapply(tpe: UType): Option[UType] = // If it's aliased we may need to grab bindings tpe match { - case NativeRef() => None + case NativeRef(_, _) => None case Type.Reference(_, typeName, typeArgs) => val lookedUp = dists.lookupTypeSpecification(typeName.packagePath, typeName.modulePath, typeName.localName) lookedUp match { diff --git a/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntimeError.scala b/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntimeError.scala index 8ba37b1f5..c9a666381 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntimeError.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntimeError.scala @@ -67,7 +67,7 @@ object TypeError { final case class TypeVariableMissing(name: Name) extends TypeError(s"Missing type variable $name.toTitleCase") final case class DefinitionMissing(err: LookupError) extends TypeError(s"Cannot find definition: ${err.getMsg}") - final case class TypeMissing(fqn : FQName, err: LookupError) extends TypeError(s"Cannot find $fqn: ${err.getMsg}") + final case class TypeMissing(fqn: FQName, err: LookupError) extends TypeError(s"Cannot find $fqn: ${err.getMsg}") final case class TypeLacksField(tpe: UType, field: Name, msg: String) extends TypeError(s"${succinct(tpe)} lacks field ${field.toCamelCase}. $msg") diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala index 00eb0aad4..3af279539 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypeChecker.scala @@ -3,7 +3,13 @@ package org.finos.morphir.runtime import org.finos.morphir.naming.* import org.finos.morphir.ir.{Type as T, Value as V} import org.finos.morphir.ir.Literal.Lit -import org.finos.morphir.ir.Value.{Pattern, TypedValue, Value, TypedDefinition as TypedValueDef, USpecification as UValueSpec} +import org.finos.morphir.ir.Value.{ + Pattern, + TypedValue, + Value, + TypedDefinition as TypedValueDef, + USpecification as UValueSpec +} import org.finos.morphir.ir.Type.{Type, UType, USpecification as UTypeSpec} import org.finos.morphir.ir.sdk import org.finos.morphir.ir.sdk.Basics @@ -11,7 +17,6 @@ import org.finos.morphir.ir.Field import org.finos.morphir.runtime.TypeError.CannotDealias import org.finos.morphir.runtime.exports.* import TypeError.* -import org.finos.morphir.runtime.Extractors.Values.NativeRef object TypeChecker { type TypeCheckerResult = List[TypeError] @@ -69,7 +74,7 @@ final class TypeChecker(dists: Distributions) { def dealias(tpe: UType, context: Context): Either[TypeError, UType] = { def loop(tpe: UType, original_fqn: Option[FQName], context: Context): Either[TypeError, UType] = tpe match { - case ref @ Extractors.Types.NativeRef() => Right(ref) + case ref @ Extractors.Types.NativeRef(_, _) => Right(ref) case Type.Reference(_, typeName, typeArgs) => val lookedUp = dists.lookupTypeSpecification(typeName.packagePath, typeName.modulePath, typeName.localName) lookedUp match { @@ -236,6 +241,7 @@ final class TypeChecker(dists: Distributions) { fromTpe ++ fromChildren } def handleConstructor(tpe: UType, fqn: FQName, context: Context): TypeCheckerResult = { + import Extractors.Types.* val fromChildren = List() val (ret, args) = Utils.uncurryFunctionType(tpe) // TODO: Interleaved function type w/ aliases. val fromTpe = ret match { @@ -259,10 +265,10 @@ final class TypeChecker(dists: Distributions) { missedName ++ fromCtor case Right(other) => List(new ImproperTypeSpec(name, other, s"Type union expected")) - case Left(err) => List(new TypeMissing(err)) + case Left(err) => List(new TypeMissing(name, err)) } - case NativeRef => List() - case other => List(new ImproperType(other, s"Reference to type union expected")) + case NativeRef(_, _) => List() // TODO: check native constructor calls + case other => List(new ImproperType(other, s"Reference to type union expected")) } fromChildren ++ fromTpe } From 1cfac3d07c6c7505ebed59c5f1565cce6bf22a0f Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Thu, 24 Aug 2023 15:16:25 -0700 Subject: [PATCH 281/323] Incremental --- .../runtime/src/org/finos/morphir/runtime/Extractors.scala | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala b/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala index 1339a2c43..8639dce07 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala @@ -185,8 +185,7 @@ object Extractors { def unapply(value: TypedValue): Option[(UType, FQName)] = value match { case Value.Reference(tpe, name) - // TODO: NATIVE_CHECK - if (name.packagePath != Basics.intType.asInstanceOf[Type.Reference[Unit]].typeName.packagePath) => + if (!Utils.isNative(name)) => Some((tpe, name)) case _ => None } @@ -196,8 +195,7 @@ object Extractors { def unapply(value: TypedValue): Option[(UType, FQName)] = value match { case Value.Reference(tpe, name) - // TODO: NATIVE_CHECK - if (name.packagePath == Basics.intType.asInstanceOf[Type.Reference[Unit]].typeName.packagePath) => + if (Utils.isNative(name)) => Some((tpe, name)) case _ => None } From 5343a1d05630763598c7f2c3cfd6c255ce5d60b2 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Thu, 24 Aug 2023 15:19:47 -0700 Subject: [PATCH 282/323] Incremental --- .../org/finos/morphir/runtime/services/kernel/Kernel.scala | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/morphir/src/org/finos/morphir/runtime/services/kernel/Kernel.scala b/morphir/src/org/finos/morphir/runtime/services/kernel/Kernel.scala index c461640a8..52af409cb 100644 --- a/morphir/src/org/finos/morphir/runtime/services/kernel/Kernel.scala +++ b/morphir/src/org/finos/morphir/runtime/services/kernel/Kernel.scala @@ -8,19 +8,19 @@ import RTError.* trait Kernel { type VariableRef = Any // TODO: Replace with appropriate type - def accessVariable(name: Name): RTAction[Any, VariableNotFound, VariableRef] + def accessVariable(name: Name): RTAction[Any, VariableAccessError, VariableRef] } object Kernel { val live: Kernel = KernelLive() - def accessVariable(name: Name): RTAction[Kernel, VariableNotFound, Any] = + def accessVariable(name: Name): RTAction[Kernel, VariableAccessError, Any] = RTAction.serviceWith(_.accessVariable(name)) } final case class KernelLive() extends Kernel { - def accessVariable(name: Name): RTAction[Any, VariableNotFound, VariableRef] = ??? + def accessVariable(name: Name): RTAction[Any, VariableAccessError, VariableRef] = ??? } From 33c936e4f691f59f6957ec1836ede3e7d648dd53 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Thu, 24 Aug 2023 17:05:19 -0700 Subject: [PATCH 283/323] Incremental --- .../src/org/finos/morphir/runtime/Utils.scala | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala index ab30bfeeb..820b2640e 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala @@ -2,8 +2,8 @@ package org.finos.morphir.runtime import org.finos.morphir.naming._ import org.finos.morphir.ir.{Type as T, Value as V} -import org.finos.morphir.ir.Value.{Value, Pattern, TypedValue} -import org.finos.morphir.ir.Type.{Type, UType} +import org.finos.morphir.ir.Value.{Value, Pattern, TypedValue, USpecification => UValueSpec} +import org.finos.morphir.ir.Type.{Type, UType, USpecification => UTypeSpec} import org.finos.morphir.ir.sdk import org.finos.morphir.ir.sdk.Basics import org.finos.morphir.ir.Field @@ -118,7 +118,7 @@ object Utils { } } - def specificationToType[TA](spec: V.Specification[TA]): Type[TA] = + def specificationToType(spec: UValueSpec): UType = curryTypeFunction(spec.output, spec.inputs) def findTypeBindings( @@ -153,10 +153,12 @@ object Utils { (ret, args :+ arg) case other => (other, Chunk()) } - def curryTypeFunction[TA](inner: Type[TA], params: Chunk[(Name, Type[TA])]): Type[TA] = + //So we get foo Int -> String -> (Int, String) + // We make a Int -> Int, String + def curryTypeFunction(inner: UType, params: Chunk[(Name, UType)]): UType = params match { case Chunk() => inner case chunk => - curryTypeFunction(Type.Function(inner.attributes, chunk.head._2, inner), chunk.tail) // TODO: Backwards? + T.function(chunk.head._2, curryTypeFunction(inner, chunk.tail)) } } From c6f29b1ffae190a1236c11ce9ea7952e984b15eb Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Thu, 24 Aug 2023 17:06:08 -0700 Subject: [PATCH 284/323] Incremental --- .../evaluator-tests/morphir-hashes.json | 2 +- .../evaluator-tests/morphir-ir.json | 1096 +++++++++++++++++ 2 files changed, 1097 insertions(+), 1 deletion(-) diff --git a/examples/morphir-elm-projects/evaluator-tests/morphir-hashes.json b/examples/morphir-elm-projects/evaluator-tests/morphir-hashes.json index d723f0bbb..36fe9629a 100644 --- a/examples/morphir-elm-projects/evaluator-tests/morphir-hashes.json +++ b/examples/morphir-elm-projects/evaluator-tests/morphir-hashes.json @@ -22,6 +22,6 @@ "src/Morphir/Examples/App/SimpleTests.elm": "f7794a1165f7fe3e5df89b84d0bdbcd8", "src/Morphir/Examples/App/SkdBasicTests.elm": "930eb32abe511d003720cfaffcc114b0", "src/Morphir/Examples/App/TupleTests.elm": "2c80092fe40ef7666906ee42214376ac", - "src/Morphir/Examples/App/TypeCheckerTests.elm": "11f2f667ce69629d1412791c49a765de", + "src/Morphir/Examples/App/TypeCheckerTests.elm": "2e746579b44c3b7e169d0acea7a965ad", "src/Morphir/Examples/App/UserDefinedReferenceTests.elm": "9bf29afa60bad03b200d08ac8f099b99" } \ No newline at end of file diff --git a/examples/morphir-elm-projects/evaluator-tests/morphir-ir.json b/examples/morphir-elm-projects/evaluator-tests/morphir-ir.json index 24fe25777..a69e75f67 100644 --- a/examples/morphir-elm-projects/evaluator-tests/morphir-ir.json +++ b/examples/morphir-elm-projects/evaluator-tests/morphir-ir.json @@ -187269,6 +187269,1102 @@ } } } + ], + [ + [ + "with", + "int" + ], + { + "access": "Public", + "value": { + "doc": "", + "value": { + "inputTypes": [ + [ + [ + "l" + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ] + ] + ] + ], + "outputType": [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + "body": [ + "PatternMatch", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Variable", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ] + ], + [ + "l" + ] + ], + [ + [ + [ + "HeadTailPattern", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ] + ], + [ + "AsPattern", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "WildcardPattern", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ], + [ + "head" + ] + ], + [ + "WildcardPattern", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ] + ] + ] + ], + [ + "Variable", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "head" + ] + ] + ], + [ + [ + "WildcardPattern", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ] + ] + ], + [ + "Apply", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Reference", + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ], + [ + [ + [ + "morphir" + ], + [ + "examples" + ], + [ + "app" + ] + ], + [ + [ + "type", + "checker", + "tests" + ] + ], + [ + "with", + "param" + ] + ] + ], + [ + "Variable", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ] + ], + [ + "l" + ] + ] + ] + ] + ] + ] + } + } + } + ], + [ + [ + "with", + "param" + ], + { + "access": "Public", + "value": { + "doc": "", + "value": { + "inputTypes": [ + [ + [ + "l" + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Variable", + {}, + [ + "a" + ] + ] + ] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Variable", + {}, + [ + "a" + ] + ] + ] + ] + ] + ], + "outputType": [ + "Variable", + {}, + [ + "a" + ] + ], + "body": [ + "PatternMatch", + [ + "Variable", + {}, + [ + "a" + ] + ], + [ + "Variable", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Variable", + {}, + [ + "a" + ] + ] + ] + ], + [ + "l" + ] + ], + [ + [ + [ + "HeadTailPattern", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Variable", + {}, + [ + "a" + ] + ] + ] + ], + [ + "AsPattern", + [ + "Variable", + {}, + [ + "a" + ] + ], + [ + "WildcardPattern", + [ + "Variable", + {}, + [ + "a" + ] + ] + ], + [ + "head" + ] + ], + [ + "WildcardPattern", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Variable", + {}, + [ + "a" + ] + ] + ] + ] + ] + ], + [ + "Variable", + [ + "Variable", + {}, + [ + "a" + ] + ], + [ + "head" + ] + ] + ], + [ + [ + "WildcardPattern", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Variable", + {}, + [ + "a" + ] + ] + ] + ] + ], + [ + "Apply", + [ + "Variable", + {}, + [ + "a" + ] + ], + [ + "Reference", + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Variable", + {}, + [ + "a" + ] + ] + ] + ], + [ + "Variable", + {}, + [ + "a" + ] + ] + ], + [ + [ + [ + "morphir" + ], + [ + "examples" + ], + [ + "app" + ] + ], + [ + [ + "type", + "checker", + "tests" + ] + ], + [ + "with", + "param" + ] + ] + ], + [ + "Variable", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Variable", + {}, + [ + "a" + ] + ] + ] + ], + [ + "l" + ] + ] + ] + ] + ] + ] + } + } + } ] ], "doc": null From 2175d2ee579a1755ee240168b4d54980846c618c Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Thu, 24 Aug 2023 17:07:33 -0700 Subject: [PATCH 285/323] Incremental --- .../src/Morphir/Examples/App/TypeCheckerTests.elm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/examples/morphir-elm-projects/evaluator-tests/src/Morphir/Examples/App/TypeCheckerTests.elm b/examples/morphir-elm-projects/evaluator-tests/src/Morphir/Examples/App/TypeCheckerTests.elm index b9e035d71..867c80f4b 100644 --- a/examples/morphir-elm-projects/evaluator-tests/src/Morphir/Examples/App/TypeCheckerTests.elm +++ b/examples/morphir-elm-projects/evaluator-tests/src/Morphir/Examples/App/TypeCheckerTests.elm @@ -15,3 +15,6 @@ withInt : (List Int) -> Int withInt l = case l of head :: _ -> head _ -> withParam l + +twoArgEntry : Int -> String -> (Int, String) +twoArgEntry i s = (i, s) From a69cc4ed3cd7aea1f9d3ba0af18e1fa8672cfdad Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Thu, 24 Aug 2023 17:08:29 -0700 Subject: [PATCH 286/323] Incremental --- .../evaluator-tests/morphir-hashes.json | 2 +- .../evaluator-tests/morphir-ir.json | 306 ++++++++++++++++++ 2 files changed, 307 insertions(+), 1 deletion(-) diff --git a/examples/morphir-elm-projects/evaluator-tests/morphir-hashes.json b/examples/morphir-elm-projects/evaluator-tests/morphir-hashes.json index 36fe9629a..ea5114fd9 100644 --- a/examples/morphir-elm-projects/evaluator-tests/morphir-hashes.json +++ b/examples/morphir-elm-projects/evaluator-tests/morphir-hashes.json @@ -22,6 +22,6 @@ "src/Morphir/Examples/App/SimpleTests.elm": "f7794a1165f7fe3e5df89b84d0bdbcd8", "src/Morphir/Examples/App/SkdBasicTests.elm": "930eb32abe511d003720cfaffcc114b0", "src/Morphir/Examples/App/TupleTests.elm": "2c80092fe40ef7666906ee42214376ac", - "src/Morphir/Examples/App/TypeCheckerTests.elm": "2e746579b44c3b7e169d0acea7a965ad", + "src/Morphir/Examples/App/TypeCheckerTests.elm": "6da55ef4bc0d30651b1119c3b84206d2", "src/Morphir/Examples/App/UserDefinedReferenceTests.elm": "9bf29afa60bad03b200d08ac8f099b99" } \ No newline at end of file diff --git a/examples/morphir-elm-projects/evaluator-tests/morphir-ir.json b/examples/morphir-elm-projects/evaluator-tests/morphir-ir.json index a69e75f67..6b9d11495 100644 --- a/examples/morphir-elm-projects/evaluator-tests/morphir-ir.json +++ b/examples/morphir-elm-projects/evaluator-tests/morphir-ir.json @@ -187270,6 +187270,312 @@ } } ], + [ + [ + "two", + "arg", + "entry" + ], + { + "access": "Public", + "value": { + "doc": "", + "value": { + "inputTypes": [ + [ + [ + "i" + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ], + [ + [ + "s" + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ] + ] + ], + "outputType": [ + "Tuple", + {}, + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ] + ] + ], + "body": [ + "Tuple", + [ + "Tuple", + {}, + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ] + ] + ], + [ + [ + "Variable", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "i" + ] + ], + [ + "Variable", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ], + [ + "s" + ] + ] + ] + ] + } + } + } + ], [ [ "with", From e637ec523687d3e92f1a514f61b74c9ea05a804a Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Thu, 24 Aug 2023 17:11:14 -0700 Subject: [PATCH 287/323] Incremental --- .../jvm/src/org/finos/morphir/runtime/EvaluatorMDMTests.scala | 3 +++ 1 file changed, 3 insertions(+) diff --git a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/EvaluatorMDMTests.scala b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/EvaluatorMDMTests.scala index b9da7daf8..c9d11bbba 100644 --- a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/EvaluatorMDMTests.scala +++ b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/EvaluatorMDMTests.scala @@ -512,6 +512,9 @@ object EvaluatorMDMTests extends MorphirBaseSpec { typeArgUnionShape(Concept.Int32, Concept.String) )) @@ ignore @@ tag("Failing because of non-matching order of union cases") ), + suite("Type-based tests")( + testEvaluation("Applies arguments in correct order")("typeCheckerTests", twoArgEntry, Data.Int(3), Data.String("Green"))(Data.Tuple(Data.Int(3), Data.String("Green"))) + ) suite("Dictionary Tests")( testEvaluation("Returns a dictionary")("dictionaryTests", "returnDictionaryTest")(Data.Map( (Data.Int(1), Data.String("Red")), From 33c7c395fc129192db74c5ef7da01ec4cdba5b56 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Thu, 24 Aug 2023 17:16:14 -0700 Subject: [PATCH 288/323] Incremental --- .../morphir/runtime/EvaluatorMDMTests.scala | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/EvaluatorMDMTests.scala b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/EvaluatorMDMTests.scala index c9d11bbba..c195b24a8 100644 --- a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/EvaluatorMDMTests.scala +++ b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/EvaluatorMDMTests.scala @@ -48,9 +48,9 @@ object EvaluatorMDMTests extends MorphirBaseSpec { def checkEvaluation( moduleName: String, functionName: String, - value: Any + values: List[Any] )(expected: => Data): ZIO[MorphirRuntimeTyped, Throwable, TestResult] = - runTest(moduleName, functionName, value).map { actual => + runTest(moduleName, functionName, values).map { actual => assertTrue(actual == expected) } @@ -61,21 +61,28 @@ object EvaluatorMDMTests extends MorphirBaseSpec { def testEval(label: String)(moduleName: String, functionName: String, value: Any)(expected: => Data) = test(label) { - checkEvaluation(moduleName, functionName, value)(expected) + checkEvaluation(moduleName, functionName, List(value))(expected) + } + + + def testEval(label: String)(moduleName: String, functionName: String, values: List[Any])(expected: => Data) = + test(label) { + checkEvaluation(moduleName, functionName, values)(expected) } def runTest(moduleName: String, functionName: String): ZIO[MorphirRuntimeTyped, Throwable, Data] = - runTest(moduleName, functionName, ()) + runTest(moduleName, functionName, List[()]) + def runTest( moduleName: String, functionName: String, - value: Any + values: List[Any] ): ZIO[MorphirRuntimeTyped, Throwable, Data] = ZIO.serviceWithZIO[MorphirRuntimeTyped] { runtime => val fullName = s"Morphir.Examples.App:$moduleName:$functionName" - val data = deriveData(value) + val data = values.map(deriveData(_)) - runtime.evaluate(FQName.fromString(fullName), data) + runtime.evaluate(FQName.fromString(fullName), data:_*) .provideEnvironment(MorphirEnv.live) .toZIOWith(RTExecutionContext.default) } @@ -513,7 +520,7 @@ object EvaluatorMDMTests extends MorphirBaseSpec { )) @@ ignore @@ tag("Failing because of non-matching order of union cases") ), suite("Type-based tests")( - testEvaluation("Applies arguments in correct order")("typeCheckerTests", twoArgEntry, Data.Int(3), Data.String("Green"))(Data.Tuple(Data.Int(3), Data.String("Green"))) + testEvaluation("Applies arguments in correct order")("typeCheckerTests", "twoArgEntry", Data.Int(3), Data.String("Green"))(Data.Tuple(Data.Int(3), Data.String("Green"))) ) suite("Dictionary Tests")( testEvaluation("Returns a dictionary")("dictionaryTests", "returnDictionaryTest")(Data.Map( From c8aff21a97fc371360b53eca3686a067d985dfb4 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Thu, 24 Aug 2023 17:17:06 -0700 Subject: [PATCH 289/323] Incremental --- .../src/org/finos/morphir/runtime/MorphirRuntime.scala | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntime.scala b/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntime.scala index b74495d5e..91e1bf580 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntime.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntime.scala @@ -10,10 +10,10 @@ import org.finos.morphir.runtime.environment.MorphirEnv import org.finos.morphir.runtime.exports.RTAction import org.finos.morphir.runtime.quick.QuickMorphirRuntime trait MorphirRuntime[TA, VA] { - def evaluate(entryPoint: Value[TA, VA], params: Value[TA, VA]): RTAction[MorphirEnv, MorphirRuntimeError, Data] - def evaluate(entryPoint: Value[TA, VA], params: Data): RTAction[MorphirEnv, MorphirRuntimeError, Data] - def evaluate(entryPoint: FQName, params: Data): RTAction[MorphirEnv, MorphirRuntimeError, Data] - def evaluate(entryPoint: FQName, params: Value[TA, VA]): RTAction[MorphirEnv, MorphirRuntimeError, Data] + def evaluate(entryPoint: Value[TA, VA], params: Value[TA, VA]*): RTAction[MorphirEnv, MorphirRuntimeError, Data] + def evaluate(entryPoint: Value[TA, VA], params: Data*): RTAction[MorphirEnv, MorphirRuntimeError, Data] + def evaluate(entryPoint: FQName, params: Data*): RTAction[MorphirEnv, MorphirRuntimeError, Data] + def evaluate(entryPoint: FQName, params: Value[TA, VA]*): RTAction[MorphirEnv, MorphirRuntimeError, Data] def applyParams(entryPoint: Value[TA, VA], params: Value[TA, VA]*): RTAction[MorphirEnv, TypeError, Value[TA, VA]] def evaluate(value: Value[TA, VA]): RTAction[MorphirEnv, EvaluationError, Data] From 3bf8779d8a08ea5b874fd716a515419b9f635b18 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Thu, 24 Aug 2023 17:25:26 -0700 Subject: [PATCH 290/323] Incremental --- .../src/org/finos/morphir/runtime/MorphirRuntime.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntime.scala b/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntime.scala index 91e1bf580..6d0a9c86c 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntime.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntime.scala @@ -12,8 +12,8 @@ import org.finos.morphir.runtime.quick.QuickMorphirRuntime trait MorphirRuntime[TA, VA] { def evaluate(entryPoint: Value[TA, VA], params: Value[TA, VA]*): RTAction[MorphirEnv, MorphirRuntimeError, Data] def evaluate(entryPoint: Value[TA, VA], params: Data*): RTAction[MorphirEnv, MorphirRuntimeError, Data] - def evaluate(entryPoint: FQName, params: Data*): RTAction[MorphirEnv, MorphirRuntimeError, Data] - def evaluate(entryPoint: FQName, params: Value[TA, VA]*): RTAction[MorphirEnv, MorphirRuntimeError, Data] + def evaluate(entryPoint: FQName, params: Data): RTAction[MorphirEnv, MorphirRuntimeError, Data] + def evaluate(entryPoint: FQName, params: Value[TA, VA]): RTAction[MorphirEnv, MorphirRuntimeError, Data] def applyParams(entryPoint: Value[TA, VA], params: Value[TA, VA]*): RTAction[MorphirEnv, TypeError, Value[TA, VA]] def evaluate(value: Value[TA, VA]): RTAction[MorphirEnv, EvaluationError, Data] From 7d76588358c2ef40e12222084d9eb3a297a4f605 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Thu, 24 Aug 2023 17:26:37 -0700 Subject: [PATCH 291/323] Incremental --- .../runtime/src/org/finos/morphir/runtime/MorphirRuntime.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntime.scala b/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntime.scala index 6d0a9c86c..a38bf7cdb 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntime.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntime.scala @@ -10,7 +10,7 @@ import org.finos.morphir.runtime.environment.MorphirEnv import org.finos.morphir.runtime.exports.RTAction import org.finos.morphir.runtime.quick.QuickMorphirRuntime trait MorphirRuntime[TA, VA] { - def evaluate(entryPoint: Value[TA, VA], params: Value[TA, VA]*): RTAction[MorphirEnv, MorphirRuntimeError, Data] + def evaluate(entryPoint: Value[TA, VA], param: Value[TA, VA], params: Value[TA, VA]*): RTAction[MorphirEnv, MorphirRuntimeError, Data] def evaluate(entryPoint: Value[TA, VA], params: Data*): RTAction[MorphirEnv, MorphirRuntimeError, Data] def evaluate(entryPoint: FQName, params: Data): RTAction[MorphirEnv, MorphirRuntimeError, Data] def evaluate(entryPoint: FQName, params: Value[TA, VA]): RTAction[MorphirEnv, MorphirRuntimeError, Data] From 85456aafcbc51afee2fe994ceb28c6b04570254c Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Thu, 24 Aug 2023 17:27:02 -0700 Subject: [PATCH 292/323] Incremental --- .../src/org/finos/morphir/runtime/MorphirRuntime.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntime.scala b/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntime.scala index a38bf7cdb..7a82ae0cb 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntime.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntime.scala @@ -11,8 +11,8 @@ import org.finos.morphir.runtime.exports.RTAction import org.finos.morphir.runtime.quick.QuickMorphirRuntime trait MorphirRuntime[TA, VA] { def evaluate(entryPoint: Value[TA, VA], param: Value[TA, VA], params: Value[TA, VA]*): RTAction[MorphirEnv, MorphirRuntimeError, Data] - def evaluate(entryPoint: Value[TA, VA], params: Data*): RTAction[MorphirEnv, MorphirRuntimeError, Data] - def evaluate(entryPoint: FQName, params: Data): RTAction[MorphirEnv, MorphirRuntimeError, Data] + def evaluate(entryPoint: Value[TA, VA], param :Data, params: Data*): RTAction[MorphirEnv, MorphirRuntimeError, Data] + def evaluate(entryPoint: FQName, param : Data, params: Data*): RTAction[MorphirEnv, MorphirRuntimeError, Data] def evaluate(entryPoint: FQName, params: Value[TA, VA]): RTAction[MorphirEnv, MorphirRuntimeError, Data] def applyParams(entryPoint: Value[TA, VA], params: Value[TA, VA]*): RTAction[MorphirEnv, TypeError, Value[TA, VA]] From f51738d965515b976609da025df6b555d1034a22 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Thu, 24 Aug 2023 17:27:42 -0700 Subject: [PATCH 293/323] Incremental --- .../runtime/src/org/finos/morphir/runtime/MorphirRuntime.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntime.scala b/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntime.scala index 7a82ae0cb..804daa4db 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntime.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntime.scala @@ -13,7 +13,7 @@ trait MorphirRuntime[TA, VA] { def evaluate(entryPoint: Value[TA, VA], param: Value[TA, VA], params: Value[TA, VA]*): RTAction[MorphirEnv, MorphirRuntimeError, Data] def evaluate(entryPoint: Value[TA, VA], param :Data, params: Data*): RTAction[MorphirEnv, MorphirRuntimeError, Data] def evaluate(entryPoint: FQName, param : Data, params: Data*): RTAction[MorphirEnv, MorphirRuntimeError, Data] - def evaluate(entryPoint: FQName, params: Value[TA, VA]): RTAction[MorphirEnv, MorphirRuntimeError, Data] + def evaluate(entryPoint: FQName, param : Value[TA, VA], params: Value[TA, VA]): RTAction[MorphirEnv, MorphirRuntimeError, Data] def applyParams(entryPoint: Value[TA, VA], params: Value[TA, VA]*): RTAction[MorphirEnv, TypeError, Value[TA, VA]] def evaluate(value: Value[TA, VA]): RTAction[MorphirEnv, EvaluationError, Data] From 9feb4fa312bdb4e6e63148baef0457e5b02e5b78 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Thu, 24 Aug 2023 17:29:09 -0700 Subject: [PATCH 294/323] Incremental --- .../src/org/finos/morphir/runtime/TypedMorphirRuntime.scala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypedMorphirRuntime.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypedMorphirRuntime.scala index 693fecd86..3fdb77b13 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypedMorphirRuntime.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypedMorphirRuntime.scala @@ -16,7 +16,8 @@ import org.finos.morphir.runtime.exports.* trait TypedMorphirRuntime extends MorphirRuntime[scala.Unit, UType] { final def evaluate( entryPoint: Value[scala.Unit, UType], - params: Value[scala.Unit, UType] + param: Value[scala.Unit, UType], + params: Value[scala.Unit, UType]* ): RTAction[MorphirEnv, MorphirRuntimeError, Data] = for { applied <- applyParams(entryPoint, params) From 5cc2f7498fc0152b4fb54ef6b19253b0b2ab5843 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Thu, 24 Aug 2023 17:30:58 -0700 Subject: [PATCH 295/323] Incremental --- .../src/org/finos/morphir/runtime/TypedMorphirRuntime.scala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypedMorphirRuntime.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypedMorphirRuntime.scala index 3fdb77b13..a341b6b4b 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypedMorphirRuntime.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypedMorphirRuntime.scala @@ -20,13 +20,14 @@ trait TypedMorphirRuntime extends MorphirRuntime[scala.Unit, UType] { params: Value[scala.Unit, UType]* ): RTAction[MorphirEnv, MorphirRuntimeError, Data] = for { - applied <- applyParams(entryPoint, params) + applied <- applyParams(entryPoint, (param :: params):_*) evaluated <- evaluate(applied) } yield evaluated def evaluate(entryPoint: Value[scala.Unit, UType], params: Data): RTAction[MorphirEnv, MorphirRuntimeError, Data] = { val toValue = ToMorphirValue.summon[Data].typed val inputIR = toValue(params) + val inputIRs = params.map(toValue(_)) evaluate(entryPoint, inputIR) } From b55c66a1fea16461d0e7ec6ae911753f33e2bbd7 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Thu, 24 Aug 2023 17:31:47 -0700 Subject: [PATCH 296/323] Incremental --- .../src/org/finos/morphir/runtime/TypedMorphirRuntime.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypedMorphirRuntime.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypedMorphirRuntime.scala index a341b6b4b..4cfccb8e6 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypedMorphirRuntime.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypedMorphirRuntime.scala @@ -28,7 +28,7 @@ trait TypedMorphirRuntime extends MorphirRuntime[scala.Unit, UType] { val toValue = ToMorphirValue.summon[Data].typed val inputIR = toValue(params) val inputIRs = params.map(toValue(_)) - evaluate(entryPoint, inputIR) + evaluate(entryPoint, inputIR, inputIRs) } def evaluate(entryPoint: FQName, params: Data): RTAction[MorphirEnv, MorphirRuntimeError, Data] = { From d8d1ef4890d6d109d33cc973ad3379c23f4c7412 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Thu, 24 Aug 2023 17:32:17 -0700 Subject: [PATCH 297/323] Incremental --- .../src/org/finos/morphir/runtime/TypedMorphirRuntime.scala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypedMorphirRuntime.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypedMorphirRuntime.scala index 4cfccb8e6..8c81191f7 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypedMorphirRuntime.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypedMorphirRuntime.scala @@ -34,6 +34,7 @@ trait TypedMorphirRuntime extends MorphirRuntime[scala.Unit, UType] { def evaluate(entryPoint: FQName, params: Data): RTAction[MorphirEnv, MorphirRuntimeError, Data] = { val toValue = ToMorphirValue.summon[Data].typed val inputIR = toValue(params) - evaluate(entryPoint, inputIR) + val inputIRs = params.map(toValue(_)) + evaluate(entryPoint, inputIR, inputIRs) } } From a932323fb4e943074207719e531cd33db9576e51 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Thu, 24 Aug 2023 17:34:33 -0700 Subject: [PATCH 298/323] Incremental --- .../src/org/finos/morphir/runtime/TypedMorphirRuntime.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypedMorphirRuntime.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypedMorphirRuntime.scala index 8c81191f7..c07e14369 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypedMorphirRuntime.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypedMorphirRuntime.scala @@ -20,11 +20,11 @@ trait TypedMorphirRuntime extends MorphirRuntime[scala.Unit, UType] { params: Value[scala.Unit, UType]* ): RTAction[MorphirEnv, MorphirRuntimeError, Data] = for { - applied <- applyParams(entryPoint, (param :: params):_*) + applied <- applyParams(entryPoint, param, params:_*) evaluated <- evaluate(applied) } yield evaluated - def evaluate(entryPoint: Value[scala.Unit, UType], params: Data): RTAction[MorphirEnv, MorphirRuntimeError, Data] = { + def evaluate(entryPoint: Value[scala.Unit, UType], param: Data, params: Data*): RTAction[MorphirEnv, MorphirRuntimeError, Data] = { val toValue = ToMorphirValue.summon[Data].typed val inputIR = toValue(params) val inputIRs = params.map(toValue(_)) From 44e48e1bc2c2d758a3371df08e26feb40c13d85c Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Thu, 24 Aug 2023 17:37:47 -0700 Subject: [PATCH 299/323] Incremental --- .../runtime/src/org/finos/morphir/runtime/MorphirRuntime.scala | 2 ++ 1 file changed, 2 insertions(+) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntime.scala b/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntime.scala index 804daa4db..8194dc807 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntime.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntime.scala @@ -16,6 +16,8 @@ trait MorphirRuntime[TA, VA] { def evaluate(entryPoint: FQName, param : Value[TA, VA], params: Value[TA, VA]): RTAction[MorphirEnv, MorphirRuntimeError, Data] def applyParams(entryPoint: Value[TA, VA], params: Value[TA, VA]*): RTAction[MorphirEnv, TypeError, Value[TA, VA]] + def applyParams(entryPoint: Value[TA, VA], param : Value[TA, VA],params: Value[TA, VA]*): RTAction[MorphirEnv, TypeError, Value[TA, VA]] + def evaluate(value: Value[TA, VA]): RTAction[MorphirEnv, EvaluationError, Data] } From fdfb53163fe62a109f2c6df0736c5f7a58bc860b Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Thu, 24 Aug 2023 17:38:41 -0700 Subject: [PATCH 300/323] Incremental --- .../src/org/finos/morphir/runtime/TypedMorphirRuntime.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypedMorphirRuntime.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypedMorphirRuntime.scala index c07e14369..4d72a38c3 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypedMorphirRuntime.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypedMorphirRuntime.scala @@ -31,7 +31,7 @@ trait TypedMorphirRuntime extends MorphirRuntime[scala.Unit, UType] { evaluate(entryPoint, inputIR, inputIRs) } - def evaluate(entryPoint: FQName, params: Data): RTAction[MorphirEnv, MorphirRuntimeError, Data] = { + def evaluate(entryPoint: FQName, param : Data, params: Data*): RTAction[MorphirEnv, MorphirRuntimeError, Data] = { val toValue = ToMorphirValue.summon[Data].typed val inputIR = toValue(params) val inputIRs = params.map(toValue(_)) From e82fb87884fd3d97634da721394e4b5bafdd9dcb Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Thu, 24 Aug 2023 17:40:17 -0700 Subject: [PATCH 301/323] Incremental --- .../org/finos/morphir/runtime/TypedMorphirRuntime.scala | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypedMorphirRuntime.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypedMorphirRuntime.scala index 4d72a38c3..c7cabfe0f 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypedMorphirRuntime.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypedMorphirRuntime.scala @@ -26,15 +26,15 @@ trait TypedMorphirRuntime extends MorphirRuntime[scala.Unit, UType] { def evaluate(entryPoint: Value[scala.Unit, UType], param: Data, params: Data*): RTAction[MorphirEnv, MorphirRuntimeError, Data] = { val toValue = ToMorphirValue.summon[Data].typed - val inputIR = toValue(params) + val inputIR = toValue(param) val inputIRs = params.map(toValue(_)) - evaluate(entryPoint, inputIR, inputIRs) + evaluate(entryPoint, inputIR, inputIRs:_*) } def evaluate(entryPoint: FQName, param : Data, params: Data*): RTAction[MorphirEnv, MorphirRuntimeError, Data] = { val toValue = ToMorphirValue.summon[Data].typed - val inputIR = toValue(params) + val inputIR = toValue(param) val inputIRs = params.map(toValue(_)) - evaluate(entryPoint, inputIR, inputIRs) + evaluate(entryPoint, inputIR, inputIRs:_*) } } From 9a7fc159e85732610861a1d089e9cdc26b996d03 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Thu, 24 Aug 2023 17:43:46 -0700 Subject: [PATCH 302/323] Incremental --- .../src/org/finos/morphir/runtime/MorphirRuntime.scala | 2 +- .../org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntime.scala b/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntime.scala index 8194dc807..93bb1ab35 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntime.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntime.scala @@ -13,7 +13,7 @@ trait MorphirRuntime[TA, VA] { def evaluate(entryPoint: Value[TA, VA], param: Value[TA, VA], params: Value[TA, VA]*): RTAction[MorphirEnv, MorphirRuntimeError, Data] def evaluate(entryPoint: Value[TA, VA], param :Data, params: Data*): RTAction[MorphirEnv, MorphirRuntimeError, Data] def evaluate(entryPoint: FQName, param : Data, params: Data*): RTAction[MorphirEnv, MorphirRuntimeError, Data] - def evaluate(entryPoint: FQName, param : Value[TA, VA], params: Value[TA, VA]): RTAction[MorphirEnv, MorphirRuntimeError, Data] + def evaluate(entryPoint: FQName, param : Value[TA, VA], params: Value[TA, VA]*): RTAction[MorphirEnv, MorphirRuntimeError, Data] def applyParams(entryPoint: Value[TA, VA], params: Value[TA, VA]*): RTAction[MorphirEnv, TypeError, Value[TA, VA]] def applyParams(entryPoint: Value[TA, VA], param : Value[TA, VA],params: Value[TA, VA]*): RTAction[MorphirEnv, TypeError, Value[TA, VA]] diff --git a/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala b/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala index f7fe75881..91d5369ea 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala @@ -25,10 +25,10 @@ private[runtime] case class QuickMorphirRuntime(dists: Distributions, store: Sto extends TypedMorphirRuntime { // private val store: Store[scala.Unit, UType] = Store.empty // - def evaluate(entryPoint: FQName, params: Value[scala.Unit, UType]): RTAction[MorphirEnv, MorphirRuntimeError, Data] = + def evaluate(entryPoint: FQName, param: Value[scala.Unit, UType], params: Value[scala.Unit, UType]*): RTAction[MorphirEnv, MorphirRuntimeError, Data] = for { tpe <- fetchType(entryPoint) - res <- evaluate(Value.Reference.Typed(tpe, entryPoint), params) + res <- evaluate(Value.Reference.Typed(tpe, entryPoint), param, params:_*) } yield res def evaluate(value: Value[scala.Unit, UType]): RTAction[MorphirEnv, EvaluationError, Data] = From 5ac8df11cd56b3d009deb2f515ac8d3089a4962e Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Thu, 24 Aug 2023 17:44:13 -0700 Subject: [PATCH 303/323] Incremental --- .../org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala | 1 + 1 file changed, 1 insertion(+) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala b/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala index 91d5369ea..e778c7e2e 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala @@ -62,6 +62,7 @@ private[runtime] case class QuickMorphirRuntime(dists: Distributions, store: Sto def applyParams( entryPoint: Value[scala.Unit, UType], + param: Value[scala.Unit, UType], params: Value[scala.Unit, UType]* ): RTAction[Any, TypeError, Value[scala.Unit, UType]] = for { From e26f5f3ed2b1f5fe32d30a029a15c32dd3b4b065 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Thu, 24 Aug 2023 17:46:27 -0700 Subject: [PATCH 304/323] Incremental --- .../runtime/src/org/finos/morphir/runtime/MorphirRuntime.scala | 2 +- .../org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntime.scala b/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntime.scala index 93bb1ab35..afc15f0c9 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntime.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntime.scala @@ -14,7 +14,7 @@ trait MorphirRuntime[TA, VA] { def evaluate(entryPoint: Value[TA, VA], param :Data, params: Data*): RTAction[MorphirEnv, MorphirRuntimeError, Data] def evaluate(entryPoint: FQName, param : Data, params: Data*): RTAction[MorphirEnv, MorphirRuntimeError, Data] def evaluate(entryPoint: FQName, param : Value[TA, VA], params: Value[TA, VA]*): RTAction[MorphirEnv, MorphirRuntimeError, Data] - def applyParams(entryPoint: Value[TA, VA], params: Value[TA, VA]*): RTAction[MorphirEnv, TypeError, Value[TA, VA]] + //def applyParams(entryPoint: Value[TA, VA], params: Value[TA, VA]*): RTAction[MorphirEnv, TypeError, Value[TA, VA]] def applyParams(entryPoint: Value[TA, VA], param : Value[TA, VA],params: Value[TA, VA]*): RTAction[MorphirEnv, TypeError, Value[TA, VA]] diff --git a/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala b/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala index e778c7e2e..91d5369ea 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala @@ -62,7 +62,6 @@ private[runtime] case class QuickMorphirRuntime(dists: Distributions, store: Sto def applyParams( entryPoint: Value[scala.Unit, UType], - param: Value[scala.Unit, UType], params: Value[scala.Unit, UType]* ): RTAction[Any, TypeError, Value[scala.Unit, UType]] = for { From a14abc2197bd121e4a96220c5863bab73d791de1 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Thu, 24 Aug 2023 17:47:56 -0700 Subject: [PATCH 305/323] Incremental --- .../org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala | 1 + 1 file changed, 1 insertion(+) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala b/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala index 91d5369ea..e778c7e2e 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala @@ -62,6 +62,7 @@ private[runtime] case class QuickMorphirRuntime(dists: Distributions, store: Sto def applyParams( entryPoint: Value[scala.Unit, UType], + param: Value[scala.Unit, UType], params: Value[scala.Unit, UType]* ): RTAction[Any, TypeError, Value[scala.Unit, UType]] = for { From 305fe2467c60643c1981bb92887e5d818152529c Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Thu, 24 Aug 2023 17:54:30 -0700 Subject: [PATCH 306/323] Incremental --- .../src/org/finos/morphir/runtime/EvaluatorMDMTests.scala | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/EvaluatorMDMTests.scala b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/EvaluatorMDMTests.scala index c195b24a8..7f63de466 100644 --- a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/EvaluatorMDMTests.scala +++ b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/EvaluatorMDMTests.scala @@ -71,7 +71,7 @@ object EvaluatorMDMTests extends MorphirBaseSpec { } def runTest(moduleName: String, functionName: String): ZIO[MorphirRuntimeTyped, Throwable, Data] = - runTest(moduleName, functionName, List[()]) + runTest(moduleName, functionName, List(())) def runTest( moduleName: String, @@ -82,7 +82,7 @@ object EvaluatorMDMTests extends MorphirBaseSpec { val fullName = s"Morphir.Examples.App:$moduleName:$functionName" val data = values.map(deriveData(_)) - runtime.evaluate(FQName.fromString(fullName), data:_*) + runtime.evaluate(FQName.fromString(fullName), data.head, data.tail:_*) .provideEnvironment(MorphirEnv.live) .toZIOWith(RTExecutionContext.default) } @@ -520,8 +520,8 @@ object EvaluatorMDMTests extends MorphirBaseSpec { )) @@ ignore @@ tag("Failing because of non-matching order of union cases") ), suite("Type-based tests")( - testEvaluation("Applies arguments in correct order")("typeCheckerTests", "twoArgEntry", Data.Int(3), Data.String("Green"))(Data.Tuple(Data.Int(3), Data.String("Green"))) - ) + testEval("Applies arguments in correct order")("typeCheckerTests", "twoArgEntry", List(Data.Int(3), Data.String("Green")))(Data.Tuple(Data.Int(3), Data.String("Green"))) + ), suite("Dictionary Tests")( testEvaluation("Returns a dictionary")("dictionaryTests", "returnDictionaryTest")(Data.Map( (Data.Int(1), Data.String("Red")), From bd6f93205dfcf51fc7e91708eb727c493b640252 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Thu, 24 Aug 2023 18:04:22 -0700 Subject: [PATCH 307/323] Incremental --- .../runtime/src/org/finos/morphir/runtime/MorphirRuntime.scala | 2 +- .../src/org/finos/morphir/runtime/TypedMorphirRuntime.scala | 2 +- .../org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala | 1 - .../jvm/src/org/finos/morphir/runtime/EvaluatorMDMTests.scala | 2 +- 4 files changed, 3 insertions(+), 4 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntime.scala b/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntime.scala index afc15f0c9..ec889f194 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntime.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntime.scala @@ -16,7 +16,7 @@ trait MorphirRuntime[TA, VA] { def evaluate(entryPoint: FQName, param : Value[TA, VA], params: Value[TA, VA]*): RTAction[MorphirEnv, MorphirRuntimeError, Data] //def applyParams(entryPoint: Value[TA, VA], params: Value[TA, VA]*): RTAction[MorphirEnv, TypeError, Value[TA, VA]] - def applyParams(entryPoint: Value[TA, VA], param : Value[TA, VA],params: Value[TA, VA]*): RTAction[MorphirEnv, TypeError, Value[TA, VA]] + def applyParams(entryPoint: Value[TA, VA], params: Value[TA, VA]*): RTAction[MorphirEnv, TypeError, Value[TA, VA]] def evaluate(value: Value[TA, VA]): RTAction[MorphirEnv, EvaluationError, Data] diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypedMorphirRuntime.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypedMorphirRuntime.scala index c7cabfe0f..9a73fe87c 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypedMorphirRuntime.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypedMorphirRuntime.scala @@ -20,7 +20,7 @@ trait TypedMorphirRuntime extends MorphirRuntime[scala.Unit, UType] { params: Value[scala.Unit, UType]* ): RTAction[MorphirEnv, MorphirRuntimeError, Data] = for { - applied <- applyParams(entryPoint, param, params:_*) + applied <- applyParams(entryPoint, (param +: params):_*) evaluated <- evaluate(applied) } yield evaluated diff --git a/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala b/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala index e778c7e2e..91d5369ea 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala @@ -62,7 +62,6 @@ private[runtime] case class QuickMorphirRuntime(dists: Distributions, store: Sto def applyParams( entryPoint: Value[scala.Unit, UType], - param: Value[scala.Unit, UType], params: Value[scala.Unit, UType]* ): RTAction[Any, TypeError, Value[scala.Unit, UType]] = for { diff --git a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/EvaluatorMDMTests.scala b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/EvaluatorMDMTests.scala index 7f63de466..10b79b5ea 100644 --- a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/EvaluatorMDMTests.scala +++ b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/EvaluatorMDMTests.scala @@ -65,7 +65,7 @@ object EvaluatorMDMTests extends MorphirBaseSpec { } - def testEval(label: String)(moduleName: String, functionName: String, values: List[Any])(expected: => Data) = + def testEvalMultiple(label: String)(moduleName: String, functionName: String, values: List[Any])(expected: => Data) = test(label) { checkEvaluation(moduleName, functionName, values)(expected) } From 3774d925e8933b691daa4c837886854b77d05204 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Thu, 24 Aug 2023 18:27:05 -0700 Subject: [PATCH 308/323] Incremental --- .../jvm/src/org/finos/morphir/runtime/EvaluatorMDMTests.scala | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/EvaluatorMDMTests.scala b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/EvaluatorMDMTests.scala index 10b79b5ea..97abaa3ca 100644 --- a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/EvaluatorMDMTests.scala +++ b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/EvaluatorMDMTests.scala @@ -29,6 +29,10 @@ object EvaluatorMDMTests extends MorphirBaseSpec { case s: String => Deriver.toData(s) case ld: java.time.LocalDate => Deriver.toData(ld) case lt: java.time.LocalTime => Deriver.toData(lt) + case list : List[_] => { + val mapped = list.map(deriveData(_)) + Data.List(mapped.head, mapped.tail:_*) + } case Right(i: Int) => Data.Result.Ok(Data.Int(i), resultBoolIntShape) case Left(b: Boolean) => Data.Result.Err(Data.Boolean(b), resultBoolIntShape) case (i: Int, s: String) => Data.Tuple(Deriver.toData(i), Deriver.toData(s)) From 8e74b5c26a18943ea5f92b5b4e6377d0471daef6 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Thu, 24 Aug 2023 18:29:29 -0700 Subject: [PATCH 309/323] Incremental --- .../jvm/src/org/finos/morphir/runtime/EvaluatorMDMTests.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/EvaluatorMDMTests.scala b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/EvaluatorMDMTests.scala index 97abaa3ca..e8fea3cf9 100644 --- a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/EvaluatorMDMTests.scala +++ b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/EvaluatorMDMTests.scala @@ -524,7 +524,7 @@ object EvaluatorMDMTests extends MorphirBaseSpec { )) @@ ignore @@ tag("Failing because of non-matching order of union cases") ), suite("Type-based tests")( - testEval("Applies arguments in correct order")("typeCheckerTests", "twoArgEntry", List(Data.Int(3), Data.String("Green")))(Data.Tuple(Data.Int(3), Data.String("Green"))) + testEvalMultiple("Applies arguments in correct order")("typeCheckerTests", "twoArgEntry", List(Data.Int(3), Data.String("Green")))(Data.Tuple(Data.Int(3), Data.String("Green"))) ), suite("Dictionary Tests")( testEvaluation("Returns a dictionary")("dictionaryTests", "returnDictionaryTest")(Data.Map( From 1b703a0ef4639fcdcee93df0a1a84057ff66ae0b Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Thu, 24 Aug 2023 18:42:07 -0700 Subject: [PATCH 310/323] Incremental --- morphir/runtime/src/org/finos/morphir/runtime/Utils.scala | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala index 820b2640e..fdf66920b 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala @@ -156,9 +156,14 @@ object Utils { //So we get foo Int -> String -> (Int, String) // We make a Int -> Int, String def curryTypeFunction(inner: UType, params: Chunk[(Name, UType)]): UType = - params match { + //Should be 1 -> (2 -> (3 -> Inner))) + //Inner 1, 2 3 + //1-> + val res = params match { case Chunk() => inner case chunk => T.function(chunk.head._2, curryTypeFunction(inner, chunk.tail)) } + println(s"FOUND: ${Succinct.Type(res, 4)}") + res } From f861413440b7e84564f38ca9a8f7291c3b66379c Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Thu, 24 Aug 2023 18:46:58 -0700 Subject: [PATCH 311/323] Incremental --- morphir/runtime/src/org/finos/morphir/runtime/Succinct.scala | 1 + 1 file changed, 1 insertion(+) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Succinct.scala b/morphir/runtime/src/org/finos/morphir/runtime/Succinct.scala index 9df2d0473..e7681f8c3 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Succinct.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Succinct.scala @@ -26,6 +26,7 @@ object Succinct { def apply[TA](tpe: Type[TA], depth: Int): String = tpe match { case Reference(_, fqName, args) => s"$fqName ${args.map(apply(_, depth - 1)).mkString(" ")}" + case Function(_, arg, ret) => s"(${apply(arg, depth -1)} -> ${apply(ret, depth-1)}})" case other => other.getClass.getSimpleName } From 85b9d6c4f49af6fe643c3f95e917a3e1f4fd3027 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Thu, 24 Aug 2023 18:54:28 -0700 Subject: [PATCH 312/323] Incremental --- morphir/runtime/src/org/finos/morphir/runtime/Succinct.scala | 1 + 1 file changed, 1 insertion(+) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Succinct.scala b/morphir/runtime/src/org/finos/morphir/runtime/Succinct.scala index e7681f8c3..8a451c16b 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Succinct.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Succinct.scala @@ -26,6 +26,7 @@ object Succinct { def apply[TA](tpe: Type[TA], depth: Int): String = tpe match { case Reference(_, fqName, args) => s"$fqName ${args.map(apply(_, depth - 1)).mkString(" ")}" + case Tuple(_, elements) => s"(${elements.map(apply(_, depth - 1)).mkString(", ")})" case Function(_, arg, ret) => s"(${apply(arg, depth -1)} -> ${apply(ret, depth-1)}})" case other => other.getClass.getSimpleName } From 729600354400d964d6e19678f9466704883b441d Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Thu, 24 Aug 2023 20:30:04 -0700 Subject: [PATCH 313/323] Incremental --- morphir/runtime/src/org/finos/morphir/runtime/Utils.scala | 6 ------ .../finos/morphir/runtime/quick/QuickMorphirRuntime.scala | 8 +++++--- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala index fdf66920b..856542a95 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala @@ -153,17 +153,11 @@ object Utils { (ret, args :+ arg) case other => (other, Chunk()) } - //So we get foo Int -> String -> (Int, String) - // We make a Int -> Int, String def curryTypeFunction(inner: UType, params: Chunk[(Name, UType)]): UType = - //Should be 1 -> (2 -> (3 -> Inner))) - //Inner 1, 2 3 - //1-> val res = params match { case Chunk() => inner case chunk => T.function(chunk.head._2, curryTypeFunction(inner, chunk.tail)) } - println(s"FOUND: ${Succinct.Type(res, 4)}") res } diff --git a/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala b/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala index 91d5369ea..ccd79268a 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala @@ -2,7 +2,7 @@ package org.finos.morphir.runtime.quick import org.finos.morphir.naming.* import org.finos.morphir.ir.Type.UType -import org.finos.morphir.ir.Value.Value +import org.finos.morphir.ir.Value.{Value, Pattern, TypedValue} import org.finos.morphir.ir.Value as V import org.finos.morphir.datamodel.Data import org.finos.morphir.ir.distribution.Distribution @@ -68,10 +68,12 @@ private[runtime] case class QuickMorphirRuntime(dists: Distributions, store: Sto ctx <- ZPure.get[RTExecutionContext] out <- { entryPoint match { - case Value.Reference.Typed(tpe, _) => + case Value.Reference.Typed(tpe, fqn) => for { tpe <- findTypeBindings(tpe, params.toList, dists, Map())(ctx.options) - } yield V.apply(tpe, entryPoint, params.head, params.tail: _*) + } yield { + V.applyInferType(tpe, V.reference(fqn), params:_*) + } case other => RTAction.fail( new TypeError.OtherTypeError(s"Entry point must be a Reference, instead found ${Succinct.Value(other)}") ) From 8f8671b4ebd032e1f850ae9723563af348cc9782 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Thu, 24 Aug 2023 20:31:47 -0700 Subject: [PATCH 314/323] Formatting --- .../morphir/runtime/MorphirRuntime.scala | 18 ++++++++++----- .../org/finos/morphir/runtime/Succinct.scala | 4 ++-- .../morphir/runtime/TypedMorphirRuntime.scala | 22 +++++++++++-------- .../runtime/quick/QuickMorphirRuntime.scala | 12 +++++----- .../morphir/runtime/EvaluatorMDMTests.scala | 20 +++++++++-------- 5 files changed, 46 insertions(+), 30 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntime.scala b/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntime.scala index ec889f194..a09c6bbfa 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntime.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntime.scala @@ -10,11 +10,19 @@ import org.finos.morphir.runtime.environment.MorphirEnv import org.finos.morphir.runtime.exports.RTAction import org.finos.morphir.runtime.quick.QuickMorphirRuntime trait MorphirRuntime[TA, VA] { - def evaluate(entryPoint: Value[TA, VA], param: Value[TA, VA], params: Value[TA, VA]*): RTAction[MorphirEnv, MorphirRuntimeError, Data] - def evaluate(entryPoint: Value[TA, VA], param :Data, params: Data*): RTAction[MorphirEnv, MorphirRuntimeError, Data] - def evaluate(entryPoint: FQName, param : Data, params: Data*): RTAction[MorphirEnv, MorphirRuntimeError, Data] - def evaluate(entryPoint: FQName, param : Value[TA, VA], params: Value[TA, VA]*): RTAction[MorphirEnv, MorphirRuntimeError, Data] - //def applyParams(entryPoint: Value[TA, VA], params: Value[TA, VA]*): RTAction[MorphirEnv, TypeError, Value[TA, VA]] + def evaluate( + entryPoint: Value[TA, VA], + param: Value[TA, VA], + params: Value[TA, VA]* + ): RTAction[MorphirEnv, MorphirRuntimeError, Data] + def evaluate(entryPoint: Value[TA, VA], param: Data, params: Data*): RTAction[MorphirEnv, MorphirRuntimeError, Data] + def evaluate(entryPoint: FQName, param: Data, params: Data*): RTAction[MorphirEnv, MorphirRuntimeError, Data] + def evaluate( + entryPoint: FQName, + param: Value[TA, VA], + params: Value[TA, VA]* + ): RTAction[MorphirEnv, MorphirRuntimeError, Data] + // def applyParams(entryPoint: Value[TA, VA], params: Value[TA, VA]*): RTAction[MorphirEnv, TypeError, Value[TA, VA]] def applyParams(entryPoint: Value[TA, VA], params: Value[TA, VA]*): RTAction[MorphirEnv, TypeError, Value[TA, VA]] diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Succinct.scala b/morphir/runtime/src/org/finos/morphir/runtime/Succinct.scala index 8a451c16b..729b65808 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Succinct.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Succinct.scala @@ -26,8 +26,8 @@ object Succinct { def apply[TA](tpe: Type[TA], depth: Int): String = tpe match { case Reference(_, fqName, args) => s"$fqName ${args.map(apply(_, depth - 1)).mkString(" ")}" - case Tuple(_, elements) => s"(${elements.map(apply(_, depth - 1)).mkString(", ")})" - case Function(_, arg, ret) => s"(${apply(arg, depth -1)} -> ${apply(ret, depth-1)}})" + case Tuple(_, elements) => s"(${elements.map(apply(_, depth - 1)).mkString(", ")})" + case Function(_, arg, ret) => s"(${apply(arg, depth - 1)} -> ${apply(ret, depth - 1)}})" case other => other.getClass.getSimpleName } diff --git a/morphir/runtime/src/org/finos/morphir/runtime/TypedMorphirRuntime.scala b/morphir/runtime/src/org/finos/morphir/runtime/TypedMorphirRuntime.scala index 9a73fe87c..8dff5c08f 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/TypedMorphirRuntime.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/TypedMorphirRuntime.scala @@ -20,21 +20,25 @@ trait TypedMorphirRuntime extends MorphirRuntime[scala.Unit, UType] { params: Value[scala.Unit, UType]* ): RTAction[MorphirEnv, MorphirRuntimeError, Data] = for { - applied <- applyParams(entryPoint, (param +: params):_*) + applied <- applyParams(entryPoint, (param +: params): _*) evaluated <- evaluate(applied) } yield evaluated - def evaluate(entryPoint: Value[scala.Unit, UType], param: Data, params: Data*): RTAction[MorphirEnv, MorphirRuntimeError, Data] = { - val toValue = ToMorphirValue.summon[Data].typed - val inputIR = toValue(param) + def evaluate( + entryPoint: Value[scala.Unit, UType], + param: Data, + params: Data* + ): RTAction[MorphirEnv, MorphirRuntimeError, Data] = { + val toValue = ToMorphirValue.summon[Data].typed + val inputIR = toValue(param) val inputIRs = params.map(toValue(_)) - evaluate(entryPoint, inputIR, inputIRs:_*) + evaluate(entryPoint, inputIR, inputIRs: _*) } - def evaluate(entryPoint: FQName, param : Data, params: Data*): RTAction[MorphirEnv, MorphirRuntimeError, Data] = { - val toValue = ToMorphirValue.summon[Data].typed - val inputIR = toValue(param) + def evaluate(entryPoint: FQName, param: Data, params: Data*): RTAction[MorphirEnv, MorphirRuntimeError, Data] = { + val toValue = ToMorphirValue.summon[Data].typed + val inputIR = toValue(param) val inputIRs = params.map(toValue(_)) - evaluate(entryPoint, inputIR, inputIRs:_*) + evaluate(entryPoint, inputIR, inputIRs: _*) } } diff --git a/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala b/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala index ccd79268a..655e7f1bc 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala @@ -25,10 +25,14 @@ private[runtime] case class QuickMorphirRuntime(dists: Distributions, store: Sto extends TypedMorphirRuntime { // private val store: Store[scala.Unit, UType] = Store.empty // - def evaluate(entryPoint: FQName, param: Value[scala.Unit, UType], params: Value[scala.Unit, UType]*): RTAction[MorphirEnv, MorphirRuntimeError, Data] = + def evaluate( + entryPoint: FQName, + param: Value[scala.Unit, UType], + params: Value[scala.Unit, UType]* + ): RTAction[MorphirEnv, MorphirRuntimeError, Data] = for { tpe <- fetchType(entryPoint) - res <- evaluate(Value.Reference.Typed(tpe, entryPoint), param, params:_*) + res <- evaluate(Value.Reference.Typed(tpe, entryPoint), param, params: _*) } yield res def evaluate(value: Value[scala.Unit, UType]): RTAction[MorphirEnv, EvaluationError, Data] = @@ -71,9 +75,7 @@ private[runtime] case class QuickMorphirRuntime(dists: Distributions, store: Sto case Value.Reference.Typed(tpe, fqn) => for { tpe <- findTypeBindings(tpe, params.toList, dists, Map())(ctx.options) - } yield { - V.applyInferType(tpe, V.reference(fqn), params:_*) - } + } yield V.applyInferType(tpe, V.reference(fqn), params: _*) case other => RTAction.fail( new TypeError.OtherTypeError(s"Entry point must be a Reference, instead found ${Succinct.Value(other)}") ) diff --git a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/EvaluatorMDMTests.scala b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/EvaluatorMDMTests.scala index e8fea3cf9..1d10369e9 100644 --- a/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/EvaluatorMDMTests.scala +++ b/morphir/runtime/test/jvm/src/org/finos/morphir/runtime/EvaluatorMDMTests.scala @@ -29,13 +29,12 @@ object EvaluatorMDMTests extends MorphirBaseSpec { case s: String => Deriver.toData(s) case ld: java.time.LocalDate => Deriver.toData(ld) case lt: java.time.LocalTime => Deriver.toData(lt) - case list : List[_] => { + case list: List[_] => val mapped = list.map(deriveData(_)) - Data.List(mapped.head, mapped.tail:_*) - } - case Right(i: Int) => Data.Result.Ok(Data.Int(i), resultBoolIntShape) - case Left(b: Boolean) => Data.Result.Err(Data.Boolean(b), resultBoolIntShape) - case (i: Int, s: String) => Data.Tuple(Deriver.toData(i), Deriver.toData(s)) + Data.List(mapped.head, mapped.tail: _*) + case Right(i: Int) => Data.Result.Ok(Data.Int(i), resultBoolIntShape) + case Left(b: Boolean) => Data.Result.Err(Data.Boolean(b), resultBoolIntShape) + case (i: Int, s: String) => Data.Tuple(Deriver.toData(i), Deriver.toData(s)) // If the data is already derived, just use it! case data: Data => data case other => throw new Exception(s"Couldn't derive $other") @@ -68,7 +67,6 @@ object EvaluatorMDMTests extends MorphirBaseSpec { checkEvaluation(moduleName, functionName, List(value))(expected) } - def testEvalMultiple(label: String)(moduleName: String, functionName: String, values: List[Any])(expected: => Data) = test(label) { checkEvaluation(moduleName, functionName, values)(expected) @@ -86,7 +84,7 @@ object EvaluatorMDMTests extends MorphirBaseSpec { val fullName = s"Morphir.Examples.App:$moduleName:$functionName" val data = values.map(deriveData(_)) - runtime.evaluate(FQName.fromString(fullName), data.head, data.tail:_*) + runtime.evaluate(FQName.fromString(fullName), data.head, data.tail: _*) .provideEnvironment(MorphirEnv.live) .toZIOWith(RTExecutionContext.default) } @@ -524,7 +522,11 @@ object EvaluatorMDMTests extends MorphirBaseSpec { )) @@ ignore @@ tag("Failing because of non-matching order of union cases") ), suite("Type-based tests")( - testEvalMultiple("Applies arguments in correct order")("typeCheckerTests", "twoArgEntry", List(Data.Int(3), Data.String("Green")))(Data.Tuple(Data.Int(3), Data.String("Green"))) + testEvalMultiple("Applies arguments in correct order")( + "typeCheckerTests", + "twoArgEntry", + List(Data.Int(3), Data.String("Green")) + )(Data.Tuple(Data.Int(3), Data.String("Green"))) ), suite("Dictionary Tests")( testEvaluation("Returns a dictionary")("dictionaryTests", "returnDictionaryTest")(Data.Map( From 2b1640da5b621f1f237cc269b2def084f1f80d35 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Thu, 24 Aug 2023 20:33:16 -0700 Subject: [PATCH 315/323] Incremental --- morphir/runtime/src/org/finos/morphir/runtime/Utils.scala | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala index 856542a95..2f19d4874 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Utils.scala @@ -154,10 +154,9 @@ object Utils { case other => (other, Chunk()) } def curryTypeFunction(inner: UType, params: Chunk[(Name, UType)]): UType = - val res = params match { + params match { case Chunk() => inner case chunk => T.function(chunk.head._2, curryTypeFunction(inner, chunk.tail)) } - res } From d167121981b522e63a77c13043a674f5c6d07757 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Thu, 24 Aug 2023 20:40:19 -0700 Subject: [PATCH 316/323] Formatting --- .../runtime/src/org/finos/morphir/runtime/MorphirRuntime.scala | 1 - 1 file changed, 1 deletion(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntime.scala b/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntime.scala index a09c6bbfa..4ca8baec9 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntime.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntime.scala @@ -22,7 +22,6 @@ trait MorphirRuntime[TA, VA] { param: Value[TA, VA], params: Value[TA, VA]* ): RTAction[MorphirEnv, MorphirRuntimeError, Data] - // def applyParams(entryPoint: Value[TA, VA], params: Value[TA, VA]*): RTAction[MorphirEnv, TypeError, Value[TA, VA]] def applyParams(entryPoint: Value[TA, VA], params: Value[TA, VA]*): RTAction[MorphirEnv, TypeError, Value[TA, VA]] From e9b0bcc6c96cb0f4e2f6537bff0d213d0151a79b Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Fri, 25 Aug 2023 07:43:31 -0700 Subject: [PATCH 317/323] Switch error type to MorphirRuntimeError --- .../src/org/finos/morphir/runtime/MorphirRuntime.scala | 2 +- .../src/org/finos/morphir/runtime/MorphirRuntimeError.scala | 2 +- .../org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntime.scala b/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntime.scala index 4ca8baec9..9e4d3f236 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntime.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntime.scala @@ -25,7 +25,7 @@ trait MorphirRuntime[TA, VA] { def applyParams(entryPoint: Value[TA, VA], params: Value[TA, VA]*): RTAction[MorphirEnv, TypeError, Value[TA, VA]] - def evaluate(value: Value[TA, VA]): RTAction[MorphirEnv, EvaluationError, Data] + def evaluate(value: Value[TA, VA]): RTAction[MorphirEnv, MorphirRuntimeError, Data] } diff --git a/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntimeError.scala b/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntimeError.scala index c9a666381..f506e0ce8 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntimeError.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntimeError.scala @@ -36,7 +36,7 @@ final case class UnsupportedTypeParameter(message: String) extends EvaluationE final case class NotImplemented(message: String) extends EvaluationError(message) //TODO: This should be a separate error class, but interface changes required to make that happen -abstract class TypeError(msg: String) extends EvaluationError(msg) { +abstract class TypeError(msg: String) extends MorphirRuntimeError(msg) { def getMsg: String = msg } object TypeError { diff --git a/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala b/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala index 655e7f1bc..4b2f24d6d 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/quick/QuickMorphirRuntime.scala @@ -35,7 +35,7 @@ private[runtime] case class QuickMorphirRuntime(dists: Distributions, store: Sto res <- evaluate(Value.Reference.Typed(tpe, entryPoint), param, params: _*) } yield res - def evaluate(value: Value[scala.Unit, UType]): RTAction[MorphirEnv, EvaluationError, Data] = + def evaluate(value: Value[scala.Unit, UType]): RTAction[MorphirEnv, MorphirRuntimeError, Data] = for { _ <- typeCheck(value) res <- EvaluatorQuick.evalAction(value, store, dists) @@ -49,7 +49,7 @@ private[runtime] case class QuickMorphirRuntime(dists: Distributions, store: Sto } } - def typeCheck(value: Value[scala.Unit, UType]): RTAction[MorphirEnv, EvaluationError, Unit] = for { + def typeCheck(value: Value[scala.Unit, UType]): RTAction[MorphirEnv, TypeError, Unit] = for { ctx <- ZPure.get[RTExecutionContext] result <- ctx.options.enableTyper match { case EnableTyper.Disabled => RTAction.succeed[RTExecutionContext, Unit](()) From 02d2ab203db834d149a3de10d284d2fcb196bbdb Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Fri, 25 Aug 2023 07:55:13 -0700 Subject: [PATCH 318/323] Switch error type to MorphirRuntimeError --- .../src/org/finos/morphir/runtime/MorphirRuntimeError.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntimeError.scala b/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntimeError.scala index f506e0ce8..04b239fe2 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntimeError.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntimeError.scala @@ -100,5 +100,5 @@ object TypeError { final case class UnimplementedType(msg: String) extends TypeError(msg) final case class OtherTypeError(msg: String) extends TypeError(msg) final case class ManyTypeErrors(errors: List[TypeError]) - extends EvaluationError("\n" + errors.map(_.toString).mkString("\n")) + extends TypeError("\n" + errors.map(_.toString).mkString("\n")) } From 5ff3e67fe8d7f08ecad3456346215279f06b9cb0 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Fri, 25 Aug 2023 11:20:35 -0700 Subject: [PATCH 319/323] Incremental --- .../src/org/finos/morphir/runtime/Extractors.scala | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala b/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala index 8639dce07..d92b9ed66 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/Extractors.scala @@ -26,6 +26,15 @@ object Extractors { case _ => None } } + + object SetRef { + def unapply(tpe: UType): Option[UType] = + tpe match { + case Type.Reference(_, FQString("Morphir.SDK:Set:set"), Chunk(elementType)) => + Some(elementType) + case _ => None + } + } object MaybeRef { def unapply(tpe: UType): Option[UType] = tpe match { From c392655d68a8da8724f36b50a0fae2b00efdad95 Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Fri, 25 Aug 2023 11:23:25 -0700 Subject: [PATCH 320/323] Formatting --- morphir/runtime/src/org/finos/morphir/runtime/quick/Result.scala | 1 - 1 file changed, 1 deletion(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/quick/Result.scala b/morphir/runtime/src/org/finos/morphir/runtime/quick/Result.scala index 1ac1581be..7d4508d2d 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/quick/Result.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/quick/Result.scala @@ -57,7 +57,6 @@ object Result { } } - case class SetResult[TA, VA](elements: mutable.LinkedHashSet[Result[TA, VA]]) extends Result[TA, VA] case class Record[TA, VA](elements: Map[Name, Result[TA, VA]]) extends Result[TA, VA] { From a26ff8d268aa1313507e556cd21268b4ddcce3df Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Fri, 25 Aug 2023 12:23:54 -0700 Subject: [PATCH 321/323] Incremental --- .../runtime/src/org/finos/morphir/runtime/quick/Result.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/quick/Result.scala b/morphir/runtime/src/org/finos/morphir/runtime/quick/Result.scala index 7d4508d2d..b080b9643 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/quick/Result.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/quick/Result.scala @@ -73,7 +73,7 @@ object Result { } } - case class MapResult[TA, VA](elements: Map[Result[TA, VA], Result[TA, VA]]) extends Result[TA, VA] { + case class MapResult[TA, VA](elements: mutable.LinkedHashMap[Result[TA, VA], Result[TA, VA]]) extends Result[TA, VA]{ override def succinct(depth: Int) = if (depth == 0) "Dict(..)" else { s"Dict(${elements.map { case (key, value) => s"${key.succinct(depth - 1)} -> ${value.succinct(depth - 1)}" }.mkString(", ")})" From 78976b2ff3a17efa7f1c146c13b1d0e4248e5a27 Mon Sep 17 00:00:00 2001 From: EdwardPeters Date: Fri, 25 Aug 2023 12:30:59 -0700 Subject: [PATCH 322/323] Updated morphir IR --- .../evaluator-tests/morphir-hashes.json | 3 +- .../evaluator-tests/morphir-ir.json | 73783 +++++++++++----- 2 files changed, 50383 insertions(+), 23403 deletions(-) diff --git a/examples/morphir-elm-projects/evaluator-tests/morphir-hashes.json b/examples/morphir-elm-projects/evaluator-tests/morphir-hashes.json index ea5114fd9..d4f58c569 100644 --- a/examples/morphir-elm-projects/evaluator-tests/morphir-hashes.json +++ b/examples/morphir-elm-projects/evaluator-tests/morphir-hashes.json @@ -2,7 +2,7 @@ "src/Morphir/Examples/App/ConstructorTests.elm": "56fdf0bd81a5d4b51e8e94cf16d01c05", "src/Morphir/Examples/App/CurrentTest.elm": "7217989153ede6e82dfe1edb324e8aa5", "src/Morphir/Examples/App/DestructureTests.elm": "130b60a9f5c1f62b9e1394b2b1b74339", - "src/Morphir/Examples/App/DictionaryTests.elm": "8405796239dd9d7f7794fb119dd54124", + "src/Morphir/Examples/App/DictionaryTests.elm": "df2a17d866f6e6ee78672ecbb8ca219c", "src/Morphir/Examples/App/EllieStuff.elm": "f9259184f634d714dabcd8ec90f07e7a", "src/Morphir/Examples/App/EnumTest.elm": "1bdb50499357960926f3ffe7984a83c0", "src/Morphir/Examples/App/ExampleModule.elm": "e90c60dd8d4756d55d91efd7923a8cca", @@ -19,6 +19,7 @@ "src/Morphir/Examples/App/OptionTests.elm": "7be9a6971b4cd70e2f622664ebaf8a16", "src/Morphir/Examples/App/PatternMatchTests.elm": "2d597bd3d8d6353fe4fc5f4d9b739fca", "src/Morphir/Examples/App/RecordTests.elm": "bf6e25596923414d93d9bc532f35293e", + "src/Morphir/Examples/App/SetTests.elm": "72a2dcc13ebc592e3f63c9733e064443", "src/Morphir/Examples/App/SimpleTests.elm": "f7794a1165f7fe3e5df89b84d0bdbcd8", "src/Morphir/Examples/App/SkdBasicTests.elm": "930eb32abe511d003720cfaffcc114b0", "src/Morphir/Examples/App/TupleTests.elm": "2c80092fe40ef7666906ee42214376ac", diff --git a/examples/morphir-elm-projects/evaluator-tests/morphir-ir.json b/examples/morphir-elm-projects/evaluator-tests/morphir-ir.json index 651c63464..cb8aada53 100644 --- a/examples/morphir-elm-projects/evaluator-tests/morphir-ir.json +++ b/examples/morphir-elm-projects/evaluator-tests/morphir-ir.json @@ -2332,11 +2332,46 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" - ], + "t", + "0" + ] + ], + [ + "Tuple", + {}, + [ + [ + "Variable", + {}, + [ + "t", + "0" + ] + ], + [ + "Variable", + {}, + [ + "t", + "0" + ] + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -2363,68 +2398,91 @@ [] ], [ - "Variable", - {}, - [ - "t", - "0" - ] - ] - ] - ], - "outputType": [ - "Tuple", - {}, - [ - [ - "Variable", - {}, - [ - "t", - "2" - ] - ], - [ - "Variable", + "Tuple", {}, [ - "t", - "1" - ] - ] - ] - ], - "body": [ - "Tuple", - [ - "Tuple", - {}, - [ - [ - "Reference", - {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "basics" + ] + ], + [ + "int" ] ], + [] + ], + [ + "Reference", + {}, [ [ - "basics" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" ] ], + [] + ] + ] + ] + ], + [ + "AsPattern", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], [ - "int" + "s", + "d", + "k" ] ], - [] + [ + [ + "basics" + ] + ], + [ + "int" + ] ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -2450,69 +2508,131 @@ ], [] ] + ], + [ + "x" ] ], [ + "Tuple", [ - "Variable", + "Tuple", + {}, [ - "Reference", - {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "basics" + ] + ], + [ + "int" ] ], + [] + ], + [ + "Reference", + {}, [ [ - "basics" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" ] ], - [ - "int" - ] - ], - [] - ], - [ - "x" + [] + ] ] ], [ - "Variable", [ - "Reference", - {}, + "Variable", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "basics" + ] + ], + [ + "int" ] ], + [] + ], + [ + "x" + ] + ], + [ + "Variable", + [ + "Reference", + {}, [ [ - "basics" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" ] ], - [ - "int" - ] + [] ], - [] - ], - [ - "x" + [ + "x" + ] ] ] ] @@ -2984,7 +3104,7 @@ {}, [ "t", - "6" + "4" ] ] ], @@ -3976,12 +4096,66 @@ "destructure" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Reference", + {}, [ - "to", - "destructure" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -4032,59 +4206,6 @@ ], [] ] - ] - ], - "outputType": [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "int" - ] - ], - [] - ], - "body": [ - "Destructure", - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "int" - ] - ], - [] ], [ "AsPattern", @@ -4142,11 +4263,12 @@ ] ], [ - "x" + "to", + "destructure" ] ], [ - "Variable", + "Destructure", [ "Reference", {}, @@ -4173,39 +4295,126 @@ [] ], [ - "to", - "destructure" - ] - ], - [ - "Variable", - [ - "Reference", - {}, + "AsPattern", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "basics" + ] + ], + [ + "int" ] ], + [] + ], + [ + "WildcardPattern", [ + "Reference", + {}, [ - "basics" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ], + [ + "x" + ] + ], + [ + "Variable", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" ] ], - [ - "int" - ] + [] ], - [] + [ + "to", + "destructure" + ] ], [ - "x" + "Variable", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "x" + ] ] ] ] @@ -4548,122 +4757,35 @@ "destructure" ], { - "inputTypes": [ - [ - [ - "to", - "destructure" - ], - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "int" - ] - ], - [] - ], - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "int" - ] - ], - [] - ] - ] - ], + "inputTypes": [], "outputType": [ - "Tuple", + "Function", {}, [ + "Reference", + {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] + "morphir" ], [ - "int" + "s", + "d", + "k" ] ], - [] - ], - [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "int" + "basics" ] ], - [] - ] - ] - ], - "body": [ - "Destructure", + [ + "int" + ] + ], + [] + ], [ "Tuple", {}, @@ -4719,9 +4841,13 @@ [] ] ] - ], + ] + ], + "body": [ + "Lambda", [ - "AsPattern", + "Function", + {}, [ "Reference", {}, @@ -4748,34 +4874,34 @@ [] ], [ - "AsPattern", + "Tuple", + {}, [ - "Reference", - {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "int" ] ], - [ - "int" - ] + [] ], - [] - ], - [ - "WildcardPattern", [ "Reference", {}, @@ -4801,17 +4927,11 @@ ], [] ] - ], - [ - "x" ] - ], - [ - "y" ] ], [ - "Variable", + "AsPattern", [ "Reference", {}, @@ -4837,13 +4957,41 @@ ], [] ], + [ + "WildcardPattern", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ], [ "to", "destructure" ] ], [ - "Tuple", + "Destructure", [ "Tuple", {}, @@ -4901,8 +5049,34 @@ ] ], [ + "AsPattern", [ - "Variable", + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "AsPattern", [ "Reference", {}, @@ -4928,39 +5102,194 @@ ], [] ], + [ + "WildcardPattern", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ], [ "x" ] ], [ - "Variable", + "y" + ] + ], + [ + "Variable", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "to", + "destructure" + ] + ], + [ + "Tuple", + [ + "Tuple", + {}, [ - "Reference", - {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "basics" + ] + ], + [ + "int" ] ], + [] + ], + [ + "Reference", + {}, [ [ - "basics" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" ] ], + [] + ] + ] + ], + [ + [ + "Variable", + [ + "Reference", + {}, [ - "int" - ] + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ], - [] + [ + "x" + ] ], [ - "x" + "Variable", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "x" + ] ] ] ] @@ -5366,130 +5695,39 @@ "destructure" ], { - "inputTypes": [ - [ - [ - "to", - "destructure" - ], - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "examples" - ], - [ - "app" - ] - ], - [ - [ - "destructure", - "tests" - ] - ], - [ - "single", - "branch", - "constructor" - ] - ], - [] - ], - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "examples" - ], - [ - "app" - ] - ], - [ - [ - "destructure", - "tests" - ] - ], - [ - "single", - "branch", - "constructor" - ] - ], - [] - ] - ] - ], + "inputTypes": [], "outputType": [ - "Tuple", + "Function", {}, [ + "Reference", + {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "basics" - ] + "examples" ], [ - "int" + "app" ] ], - [] - ], - [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "string" - ] - ], - [ - "string" + "destructure", + "tests" ] ], - [] - ] - ] - ], - "body": [ - "Destructure", + [ + "single", + "branch", + "constructor" + ] + ], + [] + ], [ "Tuple", {}, @@ -5545,9 +5783,13 @@ [] ] ] - ], + ] + ], + "body": [ + "Lambda", [ - "ConstructorPattern", + "Function", + {}, [ "Reference", {}, @@ -5578,30 +5820,9 @@ [] ], [ + "Tuple", + {}, [ - [ - "morphir" - ], - [ - "examples" - ], - [ - "app" - ] - ], - [ - [ - "destructure", - "tests" - ] - ], - [ - "just" - ] - ], - [ - [ - "AsPattern", [ "Reference", {}, @@ -5627,40 +5848,6 @@ ], [] ], - [ - "WildcardPattern", - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "int" - ] - ], - [] - ] - ], - [ - "x" - ] - ], - [ - "AsPattern", [ "Reference", {}, @@ -5685,43 +5872,12 @@ ] ], [] - ], - [ - "WildcardPattern", - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "string" - ] - ], - [ - "string" - ] - ], - [] - ] - ], - [ - "y" ] ] ] ], [ - "Variable", + "AsPattern", [ "Reference", {}, @@ -5751,13 +5907,45 @@ ], [] ], + [ + "WildcardPattern", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "examples" + ], + [ + "app" + ] + ], + [ + [ + "destructure", + "tests" + ] + ], + [ + "single", + "branch", + "constructor" + ] + ], + [] + ] + ], [ "to", "destructure" ] ], [ - "Tuple", + "Destructure", [ "Tuple", {}, @@ -5815,66 +6003,335 @@ ] ], [ + "ConstructorPattern", [ - "Variable", + "Reference", + {}, [ - "Reference", - {}, [ + [ + "morphir" + ], + [ + "examples" + ], + [ + "app" + ] + ], + [ + [ + "destructure", + "tests" + ] + ], + [ + "single", + "branch", + "constructor" + ] + ], + [] + ], + [ + [ + [ + "morphir" + ], + [ + "examples" + ], + [ + "app" + ] + ], + [ + [ + "destructure", + "tests" + ] + ], + [ + "just" + ] + ], + [ + [ + "AsPattern", + [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "basics" + ] + ], + [ + "int" ] ], + [] + ], + [ + "WildcardPattern", [ + "Reference", + {}, [ - "basics" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ], + [ + "x" + ] + ], + [ + "AsPattern", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" ] ], + [] + ], + [ + "WildcardPattern", [ - "int" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] ] ], - [] - ], - [ - "x" + [ + "y" + ] ] + ] + ], + [ + "Variable", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "examples" + ], + [ + "app" + ] + ], + [ + [ + "destructure", + "tests" + ] + ], + [ + "single", + "branch", + "constructor" + ] + ], + [] ], [ - "Variable", + "to", + "destructure" + ] + ], + [ + "Tuple", + [ + "Tuple", + {}, [ - "Reference", - {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "basics" + ] + ], + [ + "int" ] ], + [] + ], + [ + "Reference", + {}, [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], [ "string" ] ], + [] + ] + ] + ], + [ + [ + "Variable", + [ + "Reference", + {}, [ - "string" - ] + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ], - [] + [ + "x" + ] ], [ - "y" + "Variable", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ], + [ + "y" + ] ] ] ] @@ -7069,63 +7526,92 @@ "destructure" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Reference", + {}, [ - "to", - "destructure" - ], - [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "list" - ] - ], + "s", + "d", + "k" + ] + ], + [ [ "list" ] ], [ + "list" + ] + ], + [ + [ + "Reference", + {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "basics" - ] - ], + "s", + "d", + "k" + ] + ], + [ [ - "int" + "basics" ] ], - [] + [ + "int" + ] + ], + [] + ] + ] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" ] + ], + [ + "string" ] ], + [] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -7176,63 +7662,35 @@ [] ] ] - ] - ] - ], - "outputType": [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "string" - ] ], [ - "string" - ] - ], - [] - ], - "body": [ - "Destructure", - [ - "Reference", - {}, - [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "string" + ] + ], [ "string" ] ], - [ - "string" - ] - ], - [] + [] + ] ], [ - "EmptyListPattern", + "AsPattern", [ "Reference", {}, @@ -7283,58 +7741,58 @@ [] ] ] - ] - ], - [ - "Variable", + ], [ - "Reference", - {}, + "WildcardPattern", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "list" + ] + ], [ "list" ] ], [ - "list" - ] - ], - [ - [ - "Reference", - {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "int" ] ], - [ - "int" - ] - ], - [] + [] + ] ] ] ], @@ -7344,7 +7802,7 @@ ] ], [ - "Literal", + "Destructure", [ "Reference", {}, @@ -7371,8 +7829,148 @@ [] ], [ - "StringLiteral", - "Correct" + "EmptyListPattern", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ] + ] + ], + [ + "Variable", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ] + ], + [ + "to", + "destructure" + ] + ], + [ + "Literal", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ], + [ + "StringLiteral", + "Correct" + ] ] ] ] @@ -7671,63 +8269,92 @@ "destructure" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Reference", + {}, [ - "to", - "destructure" - ], - [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "list" - ] - ], + "s", + "d", + "k" + ] + ], + [ [ "list" ] ], [ + "list" + ] + ], + [ + [ + "Reference", + {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "basics" - ] - ], + "s", + "d", + "k" + ] + ], + [ [ - "int" + "basics" ] ], - [] + [ + "int" + ] + ], + [] + ] + ] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" ] + ], + [ + "int" ] ], + [] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -7778,63 +8405,35 @@ [] ] ] - ] - ] - ], - "outputType": [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] ], [ - "int" - ] - ], - [] - ], - "body": [ - "Destructure", - [ - "Reference", - {}, - [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "int" ] ], - [ - "int" - ] - ], - [] + [] + ] ], [ - "HeadTailPattern", + "AsPattern", [ "Reference", {}, @@ -7887,7 +8486,7 @@ ] ], [ - "AsPattern", + "WildcardPattern", [ "Reference", {}, @@ -7904,49 +8503,76 @@ ], [ [ - "basics" + "list" ] ], [ - "int" + "list" ] ], - [] - ], - [ - "WildcardPattern", [ - "Reference", - {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "int" ] ], - [ - "int" - ] + [] + ] + ] + ] + ], + [ + "to", + "destructure" + ] + ], + [ + "Destructure", + [ + "Reference", + {}, + [ + [ + [ + "morphir" ], - [] + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" ] ], - [ - "x" - ] + [] ], [ - "WildcardPattern", + "HeadTailPattern", [ "Reference", {}, @@ -7997,35 +8623,68 @@ [] ] ] - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, + ], [ + "AsPattern", [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] ], - [ - "s", - "d", - "k" - ] + [] ], [ + "WildcardPattern", [ - "list" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ] ], [ - "list" + "x" ] ], [ + "WildcardPattern", [ "Reference", {}, @@ -8042,51 +8701,131 @@ ], [ [ - "basics" + "list" ] ], [ - "int" + "list" ] ], - [] + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ] ] ] ], [ - "to", - "destructure" - ] - ], - [ - "Variable", - [ - "Reference", - {}, + "Variable", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "list" + ] + ], + [ + "list" ] ], [ [ - "basics" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ] - ], - [ - "int" ] ], - [] + [ + "to", + "destructure" + ] ], [ - "x" + "Variable", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "x" + ] ] ] ] @@ -8417,91 +9156,35 @@ "destructure" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Reference", + {}, [ - "to", - "destructure" - ], - [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] + "morphir" ], [ - "int" + "s", + "d", + "k" ] ], - [] - ], - [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "int" + "basics" ] ], - [] - ] - ] - ], - "outputType": [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ [ - "basics" + "int" ] ], - [ - "int" - ] + [] ], - [] - ], - "body": [ - "Destructure", [ "Reference", {}, @@ -8526,9 +9209,13 @@ ] ], [] - ], + ] + ], + "body": [ + "Lambda", [ - "LiteralPattern", + "Function", + {}, [ "Reference", {}, @@ -8554,13 +9241,6 @@ ], [] ], - [ - "WholeNumberLiteral", - 5 - ] - ], - [ - "Variable", [ "Reference", {}, @@ -8585,14 +9265,10 @@ ] ], [] - ], - [ - "to", - "destructure" ] ], [ - "Literal", + "AsPattern", [ "Reference", {}, @@ -8619,44 +9295,40 @@ [] ], [ - "WholeNumberLiteral", - 4 - ] - ] - ] - }, - [ - "Apply", - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ + "WildcardPattern", [ - "basics" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ] ], [ - "int" + "to", + "destructure" ] ], - [] - ], - [ - "Variable", [ - "Function", - {}, + "Destructure", [ "Reference", {}, @@ -8683,54 +9355,210 @@ [] ], [ - "Reference", - {}, + "LiteralPattern", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "int" ] ], - [ - "int" - ] + [] ], - [] - ] - ], - [ - "destructure" - ] - ], - [ - "Literal", - [ - "Reference", - {}, + [ + "WholeNumberLiteral", + 5 + ] + ], [ + "Variable", [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] ], - [ - "s", - "d", - "k" - ] + [] ], [ - [ - "basics" + "to", + "destructure" + ] + ], + [ + "Literal", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "WholeNumberLiteral", + 4 + ] + ] + ] + ] + }, + [ + "Apply", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Variable", + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ], + [ + "destructure" + ] + ], + [ + "Literal", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" ] ], [ @@ -8962,184 +9790,66 @@ "destructure" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Tuple", + {}, [ - "to", - "destructure" - ], - [ - "Tuple", - {}, [ + "Reference", + {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] + "morphir" ], [ - "int" + "s", + "d", + "k" ] ], - [] - ], - [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "int" + "basics" ] ], - [] - ] - ] - ], - [ - "Tuple", - {}, + [ + "int" + ] + ], + [] + ], [ + "Reference", + {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] + "morphir" ], [ - "int" + "s", + "d", + "k" ] ], - [] - ], - [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "int" + "basics" ] ], - [] - ] - ] - ] - ] - ], - "outputType": [ - "Tuple", - {}, - [ - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "int" - ] - ], - [] - ], - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ [ - "basics" + "int" ] ], - [ - "int" - ] - ], - [] + [] + ] ] - ] - ], - "body": [ - "Destructure", + ], [ "Tuple", {}, @@ -9195,9 +9905,13 @@ [] ] ] - ], + ] + ], + "body": [ + "Lambda", [ - "TuplePattern", + "Function", + {}, [ "Tuple", {}, @@ -9255,8 +9969,9 @@ ] ], [ + "Tuple", + {}, [ - "AsPattern", [ "Reference", {}, @@ -9283,39 +9998,39 @@ [] ], [ - "WildcardPattern", + "Reference", + {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "basics" - ] - ], + "s", + "d", + "k" + ] + ], + [ [ - "int" + "basics" ] ], - [] - ] - ], - [ - "x" + [ + "int" + ] + ], + [] ] - ], + ] + ] + ], + [ + "AsPattern", + [ + "Tuple", + {}, [ - "AsPattern", [ "Reference", {}, @@ -9342,7 +10057,63 @@ [] ], [ - "WildcardPattern", + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ] + ], + [ + "WildcardPattern", + [ + "Tuple", + {}, + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], [ "Reference", {}, @@ -9368,15 +10139,16 @@ ], [] ] - ], - [ - "y" ] ] + ], + [ + "to", + "destructure" ] ], [ - "Variable", + "Destructure", [ "Tuple", {}, @@ -9434,129 +10206,367 @@ ] ], [ - "to", - "destructure" - ] - ], - [ - "Tuple", - [ - "Tuple", - {}, + "TuplePattern", [ + "Tuple", + {}, [ - "Reference", - {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "basics" + ] + ], + [ + "int" ] ], + [] + ], + [ + "Reference", + {}, [ [ - "basics" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" ] ], + [] + ] + ] + ], + [ + [ + "AsPattern", + [ + "Reference", + {}, [ - "int" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "WildcardPattern", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ] ], - [] + [ + "x" + ] ], [ - "Reference", - {}, + "AsPattern", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "int" ] ], + [] + ], + [ + "WildcardPattern", [ - "int" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ] ], - [] + [ + "y" + ] ] ] ], [ + "Variable", [ - "Variable", + "Tuple", + {}, [ - "Reference", - {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "basics" + ] + ], + [ + "int" ] ], + [] + ], + [ + "Reference", + {}, [ [ - "basics" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" ] ], - [ - "int" - ] - ], - [] - ], - [ - "y" + [] + ] ] ], [ - "Variable", + "to", + "destructure" + ] + ], + [ + "Tuple", + [ + "Tuple", + {}, [ - "Reference", - {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "basics" + ] + ], + [ + "int" ] ], + [] + ], + [ + "Reference", + {}, [ [ - "basics" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" ] ], + [] + ] + ] + ], + [ + [ + "Variable", + [ + "Reference", + {}, [ - "int" - ] + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ], - [] + [ + "y" + ] ], [ - "x" + "Variable", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "x" + ] ] ] ] @@ -10255,240 +11265,66 @@ "destructure" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Tuple", + {}, [ - "to", - "destructure" - ], - [ - "Tuple", - {}, - [ - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "int" - ] - ], - [] - ], - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "string" - ] - ], - [ - "string" - ] - ], - [] - ] - ] - ], - [ - "Tuple", - {}, [ + "Reference", + {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] + "morphir" ], [ - "int" + "s", + "d", + "k" ] ], - [] - ], - [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "string" - ] - ], - [ - "string" + "basics" ] ], - [] - ] - ] - ] - ] - ], - "outputType": [ - "Tuple", - {}, - [ - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "string" - ] - ], - [ - "string" - ] - ], - [] - ], - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ [ - "basics" + "int" ] ], - [ - "int" - ] + [] ], - [] - ], - [ - "Tuple", - {}, [ + "Reference", + {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] + "morphir" ], [ - "int" + "s", + "d", + "k" ] ], - [] - ], - [ - "Reference", - {}, [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "string" - ] - ], [ "string" ] ], - [] - ] + [ + "string" + ] + ], + [] ] ] - ] - ], - "body": [ - "Destructure", + ], [ "Tuple", {}, @@ -10600,9 +11436,13 @@ ] ] ] - ], - [ - "AsPattern", + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Tuple", {}, @@ -10660,93 +11500,63 @@ ] ], [ - "TuplePattern", + "Tuple", + {}, [ - "Tuple", - {}, [ + "Reference", + {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] + "morphir" ], [ - "int" + "s", + "d", + "k" ] ], - [] - ], - [ - "Reference", - {}, [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "string" - ] - ], [ "string" ] ], - [] - ] - ] - ], - [ + [ + "string" + ] + ], + [] + ], [ - "AsPattern", + "Reference", + {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "basics" - ] - ], + "s", + "d", + "k" + ] + ], + [ [ - "int" + "basics" ] ], - [] + [ + "int" + ] ], + [] + ], + [ + "Tuple", + {}, [ - "WildcardPattern", [ "Reference", {}, @@ -10771,41 +11581,7 @@ ] ], [] - ] - ], - [ - "x" - ] - ], - [ - "AsPattern", - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "string" - ] - ], - [ - "string" - ] ], - [] - ], - [ - "WildcardPattern", [ "Reference", {}, @@ -10831,19 +11607,13 @@ ], [] ] - ], - [ - "y" ] ] ] - ], - [ - "z" ] ], [ - "Variable", + "AsPattern", [ "Tuple", {}, @@ -10900,13 +11670,72 @@ ] ] ], + [ + "WildcardPattern", + [ + "Tuple", + {}, + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ] + ] + ] + ], [ "to", "destructure" ] ], [ - "Tuple", + "Destructure", [ "Tuple", {}, @@ -11020,74 +11849,124 @@ ] ], [ + "AsPattern", [ - "Variable", + "Tuple", + {}, [ - "Reference", - {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "basics" + ] + ], + [ + "int" ] ], + [] + ], + [ + "Reference", + {}, [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], [ "string" ] ], - [ - "string" - ] - ], - [] - ], - [ - "y" + [] + ] ] ], [ - "Variable", + "TuplePattern", [ - "Reference", + "Tuple", {}, [ [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] ], - [ - "s", - "d", - "k" - ] + [] ], [ + "Reference", + {}, [ - "basics" - ] - ], - [ - "int" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] ] - ], - [] + ] ], [ - "x" - ] - ], - [ - "Variable", - [ - "Tuple", - {}, [ + "AsPattern", [ "Reference", {}, @@ -11113,6 +11992,40 @@ ], [] ], + [ + "WildcardPattern", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ], + [ + "x" + ] + ], + [ + "AsPattern", [ "Reference", {}, @@ -11137,11 +12050,346 @@ ] ], [] + ], + [ + "WildcardPattern", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ] + ], + [ + "y" + ] + ] + ] + ], + [ + "z" + ] + ], + [ + "Variable", + [ + "Tuple", + {}, + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ] + ] + ], + [ + "to", + "destructure" + ] + ], + [ + "Tuple", + [ + "Tuple", + {}, + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Tuple", + {}, + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ] ] ] + ] + ], + [ + [ + "Variable", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ], + [ + "y" + ] ], [ - "z" + "Variable", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "x" + ] + ], + [ + "Variable", + [ + "Tuple", + {}, + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ] + ] + ], + [ + "z" + ] ] ] ] @@ -11690,49 +12938,14 @@ "destructure" ], { - "inputTypes": [ - [ - [ - "to", - "destructure" - ], - [ - "Unit", - {} - ], - [ - "Unit", - {} - ] - ] - ], + "inputTypes": [], "outputType": [ - "Reference", + "Function", {}, [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "int" - ] + "Unit", + {} ], - [] - ], - "body": [ - "Destructure", [ "Reference", {}, @@ -11757,27 +12970,63 @@ ] ], [] - ], + ] + ], + "body": [ + "Lambda", [ - "UnitPattern", + "Function", + {}, [ "Unit", {} + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ] ], [ - "Variable", + "AsPattern", [ "Unit", {} ], + [ + "WildcardPattern", + [ + "Unit", + {} + ] + ], [ "to", "destructure" ] ], [ - "Literal", + "Destructure", [ "Reference", {}, @@ -11804,8 +13053,54 @@ [] ], [ - "WholeNumberLiteral", - 4 + "UnitPattern", + [ + "Unit", + {} + ] + ], + [ + "Variable", + [ + "Unit", + {} + ], + [ + "to", + "destructure" + ] + ], + [ + "Literal", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "WholeNumberLiteral", + 4 + ] ] ] ] @@ -14676,7 +15971,7 @@ "record" ], { - "access": "Private", + "access": "Public", "value": { "doc": "", "value": [ @@ -17090,7 +18385,7 @@ "function" ], { - "access": "Public", + "access": "Private", "value": { "doc": "", "value": { @@ -18877,11 +20172,66 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Reference", + {}, [ - "x" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -18932,90 +20282,36 @@ ], [] ] - ] - ], - "outputType": [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "string" - ] - ], - [ - "string" - ] ], - [] - ], - "body": [ - "Apply", [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "string" - ] - ], - [ - "string" - ] - ], - [] - ], - [ - "Variable", + "AsPattern", [ - "Function", + "Reference", {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "string" - ] - ], + "s", + "d", + "k" + ] + ], + [ [ "string" ] ], - [] + [ + "string" + ] ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -19043,11 +20339,11 @@ ] ], [ - "f" + "x" ] ], [ - "Variable", + "Apply", [ "Reference", {}, @@ -19074,7 +20370,95 @@ [] ], [ - "x" + "Variable", + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ] + ], + [ + "f" + ] + ], + [ + "Variable", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ], + [ + "x" + ] ] ] ] @@ -19641,11 +21025,66 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Reference", + {}, [ - "x" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -19696,90 +21135,36 @@ ], [] ] - ] - ], - "outputType": [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "string" - ] - ], - [ - "string" - ] - ], - [] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "string" - ] - ], - [ - "string" - ] - ], - [] ], [ - "Variable", + "AsPattern", [ - "Function", + "Reference", {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "string" - ] - ], + "s", + "d", + "k" + ] + ], + [ [ "string" ] ], - [] + [ + "string" + ] ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -19807,11 +21192,11 @@ ] ], [ - "f" + "x" ] ], [ - "Variable", + "Apply", [ "Reference", {}, @@ -19838,7 +21223,95 @@ [] ], [ - "x" + "Variable", + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ] + ], + [ + "f" + ] + ], + [ + "Variable", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ], + [ + "x" + ] ] ] ] @@ -20622,7 +22095,7 @@ {}, [ "t", - "2" + "0" ] ], [ @@ -20630,7 +22103,7 @@ {}, [ "t", - "1" + "0" ] ] ] @@ -21358,7 +22831,7 @@ {}, [ "t", - "5" + "0" ] ], [ @@ -21366,7 +22839,7 @@ {}, [ "t", - "4" + "1" ] ] ] @@ -23269,7 +24742,7 @@ {}, [ "t", - "8" + "4" ] ], [ @@ -23277,7 +24750,7 @@ {}, [ "t", - "7" + "5" ] ], [ @@ -23285,7 +24758,7 @@ {}, [ "t", - "6" + "0" ] ] ] @@ -24899,7 +26372,7 @@ {}, [ "t", - "6" + "4" ] ], [ @@ -24907,7 +26380,7 @@ {}, [ "t", - "5" + "0" ] ] ] @@ -26011,7 +27484,7 @@ {}, [ "t", - "4" + "0" ] ], [ @@ -26019,7 +27492,7 @@ {}, [ "t", - "3" + "1" ] ] ] @@ -27300,7 +28773,7 @@ {}, [ "t", - "5" + "0" ] ], [ @@ -27308,7 +28781,7 @@ {}, [ "t", - "4" + "1" ] ] ] @@ -28550,49 +30023,58 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" + "t", + "0" + ] + ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "1" + ] ], [ - "Reference", + "Tuple", {}, [ [ + "Variable", + {}, [ - "morphir" - ], - [ - "s", - "d", - "k" + "t", + "1" ] ], [ + "Variable", + {}, [ - "basics" + "t", + "0" ] - ], - [ - "int" ] - ], - [] - ], - [ - "Variable", - {}, - [ - "t", - "0" ] ] - ], + ] + ], + "body": [ + "Lambda", [ - [ - "y" - ], + "Function", + {}, [ "Reference", {}, @@ -28619,43 +30101,8 @@ [] ], [ - "Variable", - {}, - [ - "t", - "1" - ] - ] - ] - ], - "outputType": [ - "Tuple", - {}, - [ - [ - "Variable", - {}, - [ - "t", - "3" - ] - ], - [ - "Variable", + "Function", {}, - [ - "t", - "2" - ] - ] - ] - ], - "body": [ - "Tuple", - [ - "Tuple", - {}, - [ [ "Reference", {}, @@ -28681,6 +30128,93 @@ ], [] ], + [ + "Tuple", + {}, + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ] + ] + ] + ], + [ + "AsPattern", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -28706,11 +30240,16 @@ ], [] ] + ], + [ + "x" ] ], [ + "Lambda", [ - "Variable", + "Function", + {}, [ "Reference", {}, @@ -28737,11 +30276,64 @@ [] ], [ - "y" + "Tuple", + {}, + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ] ] ], [ - "Variable", + "AsPattern", [ "Reference", {}, @@ -28768,7 +30360,158 @@ [] ], [ - "x" + "WildcardPattern", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ], + [ + "y" + ] + ], + [ + "Tuple", + [ + "Tuple", + {}, + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ] + ], + [ + [ + "Variable", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "y" + ] + ], + [ + "Variable", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "x" + ] + ] ] ] ] @@ -29854,11 +31597,58 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" + "t", + "0" + ] + ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "1" + ] ], + [ + "Tuple", + {}, + [ + [ + "Variable", + {}, + [ + "t", + "1" + ] + ], + [ + "Variable", + {}, + [ + "t", + "0" + ] + ] + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -29885,18 +31675,93 @@ [] ], [ - "Variable", + "Function", {}, [ - "t", - "0" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Tuple", + {}, + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ] ] ] ], [ - [ - "y" - ], + "AsPattern", [ "Reference", {}, @@ -29923,43 +31788,7 @@ [] ], [ - "Variable", - {}, - [ - "t", - "1" - ] - ] - ] - ], - "outputType": [ - "Tuple", - {}, - [ - [ - "Variable", - {}, - [ - "t", - "3" - ] - ], - [ - "Variable", - {}, - [ - "t", - "2" - ] - ] - ] - ], - "body": [ - "Tuple", - [ - "Tuple", - {}, - [ + "WildcardPattern", [ "Reference", {}, @@ -29984,7 +31813,17 @@ ] ], [] - ], + ] + ], + [ + "x" + ] + ], + [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -30009,12 +31848,66 @@ ] ], [] + ], + [ + "Tuple", + {}, + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ] ] - ] - ], - [ + ], [ - "Variable", + "AsPattern", [ "Reference", {}, @@ -30040,39 +31933,159 @@ ], [] ], + [ + "WildcardPattern", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ], [ "y" ] ], [ - "Variable", + "Tuple", [ - "Reference", + "Tuple", {}, [ [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] ], - [ - "s", - "d", - "k" - ] + [] ], [ + "Reference", + {}, [ - "basics" - ] + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ] + ], + [ + [ + "Variable", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ], [ - "int" + "y" ] ], - [] - ], - [ - "x" + [ + "Variable", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "x" + ] + ] ] ] ] @@ -30823,11 +32836,32 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" - ], + "t", + "0" + ] + ], + [ + "Variable", + {}, + [ + "t", + "3" + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Variable", {}, @@ -30841,56 +32875,73 @@ {}, [ "t", - "0" + "1" ] ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "3" - ] - ], - "body": [ - "Apply", - [ - "Variable", - {}, - [ - "t", - "1" - ] ], [ - "Variable", + "AsPattern", [ - "Function", + "Variable", {}, [ - "Unit", - {} - ], + "t", + "12" + ] + ], + [ + "WildcardPattern", [ "Variable", {}, [ "t", - "1" + "12" ] ] ], [ - "hang" + "x" ] ], [ - "Unit", + "Apply", + [ + "Variable", + {}, + [ + "t", + "1" + ] + ], + [ + "Variable", + [ + "Function", + {}, + [ + "Unit", + {} + ], + [ + "Variable", + {}, + [ + "t", + "1" + ] + ] + ], + [ + "hang" + ] + ], [ "Unit", - {} + [ + "Unit", + {} + ] ] ] ] @@ -31536,7 +33587,7 @@ {}, [ "t", - "4" + "0" ] ], "body": [ @@ -32081,11 +34132,37 @@ { "inputTypes": [], "outputType": [ - "Variable", + "Function", {}, [ - "t", - "15" + "Variable", + {}, + [ + "t", + "5" + ] + ], + [ + "Tuple", + {}, + [ + [ + "Variable", + {}, + [ + "t", + "5" + ] + ], + [ + "Variable", + {}, + [ + "t", + "0" + ] + ] + ] ] ], "body": [ @@ -32313,11 +34390,46 @@ "inner" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" - ], + "t", + "0" + ] + ], + [ + "Tuple", + {}, + [ + [ + "Variable", + {}, + [ + "t", + "0" + ] + ], + [ + "Variable", + {}, + [ + "t", + "1" + ] + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -32344,43 +34456,91 @@ [] ], [ - "Variable", + "Tuple", {}, [ - "t", - "0" + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] ] ] - ] - ], - "outputType": [ - "Tuple", - {}, + ], [ + "AsPattern", [ - "Variable", + "Reference", {}, [ - "t", - "2" - ] + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ], [ - "Variable", - {}, - [ - "t", - "1" - ] - ] - ] - ], - "body": [ - "Tuple", - [ - "Tuple", - {}, - [ + "WildcardPattern", [ "Reference", {}, @@ -32405,95 +34565,132 @@ ] ], [] - ], + ] + ], + [ + "x" + ] + ], + [ + "Tuple", + [ + "Tuple", + {}, [ - "Reference", - {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "basics" + ] + ], + [ + "int" ] ], + [] + ], + [ + "Reference", + {}, [ [ - "basics" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" ] ], - [ - "int" - ] - ], - [] + [] + ] ] - ] - ], - [ + ], [ - "Variable", [ - "Reference", - {}, + "Variable", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "int" ] ], - [ - "int" - ] + [] ], - [] + [ + "x" + ] ], [ - "x" - ] - ], - [ - "Variable", - [ - "Reference", - {}, + "Variable", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "int" ] ], - [ - "int" - ] + [] ], - [] - ], - [ - "c" + [ + "c" + ] ] ] ] @@ -33254,11 +35451,130 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" + "t", + "0" + ] + ], + [ + "Tuple", + {}, + [ + [ + "Variable", + {}, + [ + "t", + "0" + ] + ], + [ + "Variable", + {}, + [ + "t", + "0" + ] + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ], + [ + "Tuple", + {}, + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ] + ] + ], + [ + "AsPattern", [ "Reference", {}, @@ -33285,43 +35601,7 @@ [] ], [ - "Variable", - {}, - [ - "t", - "0" - ] - ] - ] - ], - "outputType": [ - "Tuple", - {}, - [ - [ - "Variable", - {}, - [ - "t", - "2" - ] - ], - [ - "Variable", - {}, - [ - "t", - "1" - ] - ] - ] - ], - "body": [ - "Tuple", - [ - "Tuple", - {}, - [ + "WildcardPattern", [ "Reference", {}, @@ -33346,95 +35626,132 @@ ] ], [] - ], + ] + ], + [ + "x" + ] + ], + [ + "Tuple", + [ + "Tuple", + {}, [ - "Reference", - {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "basics" + ] + ], + [ + "int" ] ], + [] + ], + [ + "Reference", + {}, [ [ - "basics" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" ] ], - [ - "int" - ] - ], - [] + [] + ] ] - ] - ], - [ + ], [ - "Variable", [ - "Reference", - {}, + "Variable", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "int" ] ], - [ - "int" - ] + [] ], - [] + [ + "x" + ] ], [ - "x" - ] - ], - [ - "Variable", - [ - "Reference", - {}, + "Variable", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "int" ] ], - [ - "int" - ] + [] ], - [] - ], - [ - "x" + [ + "x" + ] ] ] ] @@ -33843,49 +36160,58 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" + "t", + "0" + ] + ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "1" + ] ], [ - "Reference", + "Tuple", {}, [ [ + "Variable", + {}, [ - "morphir" - ], - [ - "s", - "d", - "k" + "t", + "1" ] ], [ + "Variable", + {}, [ - "basics" + "t", + "0" ] - ], - [ - "int" ] - ], - [] - ], - [ - "Variable", - {}, - [ - "t", - "0" ] ] - ], + ] + ], + "body": [ + "Lambda", [ - [ - "y" - ], + "Function", + {}, [ "Reference", {}, @@ -33912,43 +36238,8 @@ [] ], [ - "Variable", - {}, - [ - "t", - "1" - ] - ] - ] - ], - "outputType": [ - "Tuple", - {}, - [ - [ - "Variable", - {}, - [ - "t", - "3" - ] - ], - [ - "Variable", + "Function", {}, - [ - "t", - "2" - ] - ] - ] - ], - "body": [ - "Tuple", - [ - "Tuple", - {}, - [ [ "Reference", {}, @@ -33974,6 +36265,93 @@ ], [] ], + [ + "Tuple", + {}, + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ] + ] + ] + ], + [ + "AsPattern", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -33999,11 +36377,16 @@ ], [] ] + ], + [ + "x" ] ], [ + "Lambda", [ - "Variable", + "Function", + {}, [ "Reference", {}, @@ -34030,11 +36413,64 @@ [] ], [ - "y" + "Tuple", + {}, + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ] ] ], [ - "Variable", + "AsPattern", [ "Reference", {}, @@ -34061,7 +36497,158 @@ [] ], [ - "x" + "WildcardPattern", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ], + [ + "y" + ] + ], + [ + "Tuple", + [ + "Tuple", + {}, + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ] + ], + [ + [ + "Variable", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "y" + ] + ], + [ + "Variable", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "x" + ] + ] ] ] ] @@ -34543,11 +37130,66 @@ "fib" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Reference", + {}, [ - "x" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] ], + [] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -34598,62 +37240,68 @@ ], [] ] - ] - ], - "outputType": [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "int" - ] ], - [] - ], - "body": [ - "IfThenElse", [ - "Reference", - {}, + "AsPattern", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "int" ] ], + [] + ], + [ + "WildcardPattern", [ - "int" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ] ], - [] + [ + "x" + ] ], [ - "Apply", + "IfThenElse", [ "Reference", {}, @@ -34674,7 +37322,7 @@ ] ], [ - "bool" + "int" ] ], [] @@ -34682,64 +37330,60 @@ [ "Apply", [ - "Function", + "Reference", {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "basics" - ] - ], + "s", + "d", + "k" + ] + ], + [ [ - "int" + "basics" ] ], - [] + [ + "bool" + ] ], + [] + ], + [ + "Apply", [ - "Reference", + "Function", {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "int" ] ], - [ - "bool" - ] + [] ], - [] - ] - ], - [ - "Reference", - [ - "Function", - {}, [ "Reference", {}, @@ -34760,11 +37404,14 @@ ] ], [ - "int" + "bool" ] ], [] - ], + ] + ], + [ + "Reference", [ "Function", {}, @@ -34794,56 +37441,116 @@ [] ], [ - "Reference", + "Function", {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "basics" + ] + ], + [ + "int" ] ], + [] + ], + [ + "Reference", + {}, [ [ - "basics" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" ] ], - [ - "bool" - ] - ], - [] + [] + ] ] - ] - ], - [ + ], [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "basics" + ] + ], + [ + "less", + "than" ] - ], + ] + ], + [ + "Variable", [ + "Reference", + {}, [ - "basics" - ] + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ], [ - "less", - "than" + "x" ] ] ], [ - "Variable", + "Literal", [ "Reference", {}, @@ -34870,7 +37577,8 @@ [] ], [ - "x" + "WholeNumberLiteral", + 2 ] ] ], @@ -34903,130 +37611,66 @@ ], [ "WholeNumberLiteral", - 2 + 1 ] - ] - ], - [ - "Literal", - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "int" - ] - ], - [] - ], - [ - "WholeNumberLiteral", - 1 - ] - ], - [ - "Apply", - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "int" - ] - ], - [] ], [ "Apply", [ - "Function", + "Reference", {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "basics" - ] - ], + "s", + "d", + "k" + ] + ], + [ [ - "int" + "basics" ] ], - [] + [ + "int" + ] ], + [] + ], + [ + "Apply", [ - "Reference", + "Function", {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "int" ] ], - [ - "int" - ] + [] ], - [] - ] - ], - [ - "Reference", - [ - "Function", - {}, [ "Reference", {}, @@ -35051,7 +37695,10 @@ ] ], [] - ], + ] + ], + [ + "Reference", [ "Function", {}, @@ -35081,58 +37728,60 @@ [] ], [ - "Reference", + "Function", {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "basics" + ] + ], + [ + "int" ] ], + [] + ], + [ + "Reference", + {}, [ [ - "basics" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" ] ], - [ - "int" - ] - ], - [] - ] - ] - ], - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" + [] + ] ] ], - [ - "add" - ] - ] - ], - [ - "Apply", - [ - "Reference", - {}, [ [ [ @@ -35150,69 +37799,8 @@ ] ], [ - "int" - ] - ], - [] - ], - [ - "Variable", - [ - "Function", - {}, - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "int" - ] - ], - [] - ], - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "int" - ] - ], - [] + "add" ] - ], - [ - "fib" ] ], [ @@ -35243,7 +37831,7 @@ [] ], [ - "Apply", + "Variable", [ "Function", {}, @@ -35298,8 +37886,39 @@ [] ] ], + [ + "fib" + ] + ], + [ + "Apply", [ "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Apply", [ "Function", {}, @@ -35328,6 +37947,34 @@ ], [] ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ], + [ + "Reference", [ "Function", {}, @@ -35357,55 +38004,115 @@ [] ], [ - "Reference", + "Function", {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "basics" + ] + ], + [ + "int" ] ], + [] + ], + [ + "Reference", + {}, [ [ - "basics" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" ] ], - [ - "int" - ] - ], - [] + [] + ] ] - ] - ], - [ + ], [ [ - "morphir" - ], - [ - "s", - "d", - "k" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "subtract" ] - ], + ] + ], + [ + "Variable", [ + "Reference", + {}, [ - "basics" - ] + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ], [ - "subtract" + "x" ] ] ], [ - "Variable", + "Literal", [ "Reference", {}, @@ -35432,131 +38139,12 @@ [] ], [ - "x" + "WholeNumberLiteral", + 1 ] ] - ], - [ - "Literal", - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "int" - ] - ], - [] - ], - [ - "WholeNumberLiteral", - 1 - ] ] ] - ] - ], - [ - "Apply", - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "int" - ] - ], - [] - ], - [ - "Variable", - [ - "Function", - {}, - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "int" - ] - ], - [] - ], - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "int" - ] - ], - [] - ] - ], - [ - "fib" - ] ], [ "Apply", @@ -35586,7 +38174,7 @@ [] ], [ - "Apply", + "Variable", [ "Function", {}, @@ -35641,8 +38229,39 @@ [] ] ], + [ + "fib" + ] + ], + [ + "Apply", [ "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Apply", [ "Function", {}, @@ -35671,6 +38290,34 @@ ], [] ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ], + [ + "Reference", [ "Function", {}, @@ -35700,55 +38347,115 @@ [] ], [ - "Reference", + "Function", {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "basics" + ] + ], + [ + "int" ] ], + [] + ], + [ + "Reference", + {}, [ [ - "basics" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" ] ], - [ - "int" - ] - ], - [] + [] + ] ] - ] - ], - [ + ], [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "basics" + ] + ], + [ + "subtract" ] - ], + ] + ], + [ + "Variable", [ + "Reference", + {}, [ - "basics" - ] + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ], [ - "subtract" + "x" ] ] ], [ - "Variable", + "Literal", [ "Reference", {}, @@ -35775,41 +38482,10 @@ [] ], [ - "x" + "WholeNumberLiteral", + 2 ] ] - ], - [ - "Literal", - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "int" - ] - ], - [] - ], - [ - "WholeNumberLiteral", - 2 - ] ] ] ] @@ -36158,11 +38834,123 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Reference", + {}, [ - "l" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] ], + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ] + ], + [ + "Tuple", + {}, + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -36215,29 +39003,34 @@ ] ], [ - "Reference", + "Tuple", {}, [ [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "list" - ] + [] ], - [ - "list" - ] - ], - [ [ "Reference", {}, @@ -36265,12 +39058,9 @@ ] ] ] - ] - ], - "outputType": [ - "Tuple", - {}, + ], [ + "AsPattern", [ "Reference", {}, @@ -36287,48 +39077,43 @@ ], [ [ - "basics" + "list" ] ], [ - "int" + "list" ] ], - [] - ], - [ - "Reference", - {}, [ [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "int" + [] ] - ], - [] - ] - ] - ], - "body": [ - "PatternMatch", - [ - "Tuple", - {}, + ] + ], [ + "WildcardPattern", [ "Reference", {}, @@ -36345,67 +39130,51 @@ ], [ [ - "basics" + "list" ] ], [ - "int" + "list" ] ], - [] - ], - [ - "Reference", - {}, [ [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "int" + [] ] - ], - [] + ] ] + ], + [ + "l" ] ], [ - "Variable", + "PatternMatch", [ - "Reference", + "Tuple", {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "list" - ] - ], - [ - "list" - ] - ], [ [ "Reference", @@ -36431,17 +39200,7 @@ ] ], [] - ] - ] - ], - [ - "l" - ] - ], - [ - [ - [ - "HeadTailPattern", + ], [ "Reference", {}, @@ -36458,43 +39217,43 @@ ], [ [ - "list" + "basics" ] ], [ - "list" + "int" ] ], + [] + ] + ] + ], + [ + "Variable", + [ + "Reference", + {}, + [ [ [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "int" - ] - ], - [] + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" ] + ], + [ + "list" ] ], [ - "AsPattern", [ "Reference", {}, @@ -36519,39 +39278,15 @@ ] ], [] - ], - [ - "WildcardPattern", - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "int" - ] - ], - [] - ] - ], - [ - "head" ] - ], + ] + ], + [ + "l" + ] + ], + [ + [ [ "HeadTailPattern", [ @@ -36661,11 +39396,11 @@ ] ], [ - "neck" + "head" ] ], [ - "EmptyListPattern", + "HeadTailPattern", [ "Reference", {}, @@ -36716,249 +39451,249 @@ [] ] ] - ] - ] - ] - ], - [ - "Tuple", - [ - "Tuple", - {}, - [ + ], [ - "Reference", - {}, + "AsPattern", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "int" ] ], + [] + ], + [ + "WildcardPattern", [ - "int" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ] ], - [] + [ + "neck" + ] ], [ - "Reference", - {}, + "EmptyListPattern", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "list" + ] + ], + [ + "list" ] ], [ [ - "basics" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ] - ], - [ - "int" ] - ], - [] + ] ] ] ], [ + "Tuple", [ - "Variable", + "Tuple", + {}, [ - "Reference", - {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "int" ] ], - [ - "int" - ] + [] ], - [] - ], - [ - "head" - ] - ], - [ - "Variable", - [ - "Reference", - {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "int" ] ], - [ - "int" - ] - ], - [] - ], - [ - "neck" - ] - ] - ] - ] - ], - [ - [ - "HeadTailPattern", - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "list" + [] ] - ], - [ - "list" ] ], [ [ - "Reference", - {}, + "Variable", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "int" ] ], - [ - "int" - ] - ], - [] - ] - ] - ], - [ - "AsPattern", - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] + [] ], [ - "int" + "head" ] ], - [] - ], - [ - "WildcardPattern", [ - "Reference", - {}, + "Variable", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "int" ] ], - [ - "int" - ] + [] ], - [] + [ + "neck" + ] ] - ], - [ - "head" ] - ], + ] + ], + [ [ - "EmptyListPattern", + "HeadTailPattern", [ "Reference", {}, @@ -37009,15 +39744,9 @@ [] ] ] - ] - ] - ], - [ - "Tuple", - [ - "Tuple", - {}, + ], [ + "AsPattern", [ "Reference", {}, @@ -37044,35 +39773,39 @@ [] ], [ - "Reference", - {}, + "WildcardPattern", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "int" ] ], - [ - "int" - ] - ], - [] + [] + ] + ], + [ + "head" ] - ] - ], - [ + ], [ - "Variable", + "EmptyListPattern", [ "Reference", {}, @@ -37089,137 +39822,170 @@ ], [ [ - "basics" + "list" ] ], [ - "int" + "list" ] ], - [] - ], - [ - "head" + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ] ] - ], + ] + ], + [ + "Tuple", [ - "Variable", + "Tuple", + {}, [ - "Reference", - {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "basics" + ] + ], + [ + "int" ] ], + [] + ], + [ + "Reference", + {}, [ [ - "basics" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" ] ], - [ - "int" - ] - ], - [] - ], - [ - "head" - ] - ] - ] - ] - ], - [ - [ - "HeadTailPattern", - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "list" + [] ] - ], - [ - "list" ] ], [ [ - "Reference", - {}, + "Variable", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "int" ] ], - [ - "int" - ] + [] ], - [] - ] - ] - ], - [ - "WildcardPattern", - [ - "Reference", - {}, + [ + "head" + ] + ], [ + "Variable", [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] + [] ], [ - "int" + "head" ] - ], - [] + ] ] - ], + ] + ], + [ [ - "AsPattern", + "HeadTailPattern", [ "Reference", {}, @@ -37273,6 +40039,34 @@ ], [ "WildcardPattern", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ], + [ + "AsPattern", [ "Reference", {}, @@ -37323,156 +40117,267 @@ [] ] ] - ] - ], - [ - "tail" - ] - ] - ], - [ - "Apply", - [ - "Tuple", - {}, - [ + ], [ - "Reference", - {}, + "WildcardPattern", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "list" + ] + ], + [ + "list" ] ], [ [ - "basics" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ] - ], - [ - "int" ] - ], - [] + ] ], [ - "Reference", - {}, + "tail" + ] + ] + ], + [ + "Apply", + [ + "Tuple", + {}, + [ [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "basics" + ] + ], + [ + "int" ] ], + [] + ], + [ + "Reference", + {}, [ [ - "basics" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" ] ], - [ - "int" - ] - ], - [] + [] + ] ] - ] - ], - [ - "Variable", + ], [ - "Function", - {}, + "Variable", [ - "Reference", + "Function", {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "list" + ] + ], [ "list" ] ], [ - "list" + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] ] ], [ + "Tuple", + {}, [ - "Reference", - {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "basics" + ] + ], + [ + "int" ] ], + [] + ], + [ + "Reference", + {}, [ [ - "basics" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" ] ], - [ - "int" - ] - ], - [] + [] + ] ] ] ], [ - "Tuple", + "g" + ] + ], + [ + "Variable", + [ + "Reference", {}, [ [ - "Reference", - {}, [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "int" - ] + "morphir" ], - [] + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] ], + [ + "list" + ] + ], + [ [ "Reference", {}, @@ -37499,14 +40404,16 @@ [] ] ] + ], + [ + "tail" ] - ], - [ - "g" ] - ], + ] + ], + [ [ - "Variable", + "EmptyListPattern", [ "Reference", {}, @@ -37557,189 +40464,130 @@ [] ] ] - ], - [ - "tail" - ] - ] - ] - ], - [ - [ - "EmptyListPattern", - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "list" - ] - ], - [ - "list" - ] - ], - [ - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "int" - ] - ], - [] - ] ] - ] - ], - [ - "Tuple", + ], [ "Tuple", - {}, [ + "Tuple", + {}, [ - "Reference", - {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "int" ] ], - [ - "int" - ] + [] ], - [] - ], - [ - "Reference", - {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "int" ] ], - [ - "int" - ] - ], - [] + [] + ] ] - ] - ], - [ + ], [ - "Literal", [ - "Reference", - {}, + "Literal", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "int" ] ], - [ - "int" - ] + [] ], - [] + [ + "WholeNumberLiteral", + 0 + ] ], [ - "WholeNumberLiteral", - 0 - ] - ], - [ - "Literal", - [ - "Reference", - {}, + "Literal", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "int" ] ], - [ - "int" - ] + [] ], - [] - ], - [ - "WholeNumberLiteral", - 0 + [ + "WholeNumberLiteral", + 0 + ] ] ] ] @@ -37754,11 +40602,123 @@ "g" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Reference", + {}, [ - "l" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] ], + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ] + ], + [ + "Tuple", + {}, + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -37811,29 +40771,34 @@ ] ], [ - "Reference", + "Tuple", {}, [ [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "list" - ] + [] ], - [ - "list" - ] - ], - [ [ "Reference", {}, @@ -37861,12 +40826,9 @@ ] ] ] - ] - ], - "outputType": [ - "Tuple", - {}, + ], [ + "AsPattern", [ "Reference", {}, @@ -37883,48 +40845,43 @@ ], [ [ - "basics" + "list" ] ], [ - "int" + "list" ] ], - [] - ], - [ - "Reference", - {}, [ [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "int" + [] ] - ], - [] - ] - ] - ], - "body": [ - "PatternMatch", - [ - "Tuple", - {}, + ] + ], [ + "WildcardPattern", [ "Reference", {}, @@ -37941,67 +40898,51 @@ ], [ [ - "basics" + "list" ] ], [ - "int" + "list" ] ], - [] - ], - [ - "Reference", - {}, [ [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "int" + [] ] - ], - [] + ] ] + ], + [ + "l" ] ], [ - "Variable", + "PatternMatch", [ - "Reference", + "Tuple", {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "list" - ] - ], - [ - "list" - ] - ], [ [ "Reference", @@ -38027,17 +40968,7 @@ ] ], [] - ] - ] - ], - [ - "l" - ] - ], - [ - [ - [ - "HeadTailPattern", + ], [ "Reference", {}, @@ -38054,43 +40985,43 @@ ], [ [ - "list" + "basics" ] ], [ - "list" + "int" ] ], + [] + ] + ] + ], + [ + "Variable", + [ + "Reference", + {}, + [ [ [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "int" - ] - ], - [] + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" ] + ], + [ + "list" ] ], [ - "AsPattern", [ "Reference", {}, @@ -38115,39 +41046,15 @@ ] ], [] - ], - [ - "WildcardPattern", - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "int" - ] - ], - [] - ] - ], - [ - "head" ] - ], + ] + ], + [ + "l" + ] + ], + [ + [ [ "HeadTailPattern", [ @@ -38257,7 +41164,7 @@ ] ], [ - "neck" + "head" ] ], [ @@ -38314,7 +41221,7 @@ ] ], [ - "WildcardPattern", + "AsPattern", [ "Reference", {}, @@ -38339,10 +41246,41 @@ ] ], [] + ], + [ + "WildcardPattern", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ], + [ + "neck" ] ], [ - "EmptyListPattern", + "HeadTailPattern", [ "Reference", {}, @@ -38393,217 +41331,217 @@ [] ] ] - ] - ] - ] - ] - ], - [ - "Tuple", - [ - "Tuple", - {}, - [ - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "int" - ] ], - [] - ], - [ - "Reference", - {}, [ + "WildcardPattern", [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "int" + [] ] ], - [] - ] - ] - ], - [ - [ - "Variable", - [ - "Reference", - {}, [ + "EmptyListPattern", [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] ], [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] ] - ], - [ - "int" ] - ], - [] - ], - [ - "head" + ] ] - ], + ] + ], + [ + "Tuple", [ - "Variable", + "Tuple", + {}, [ - "Reference", - {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "basics" + ] + ], + [ + "int" ] ], + [] + ], + [ + "Reference", + {}, [ [ - "basics" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" ] ], - [ - "int" - ] - ], - [] - ], - [ - "neck" - ] - ] - ] - ] - ], - [ - [ - "HeadTailPattern", - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "list" + [] ] - ], - [ - "list" ] ], [ [ - "Reference", - {}, + "Variable", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "int" ] ], - [ - "int" - ] + [] ], - [] - ] - ] - ], - [ - "WildcardPattern", - [ - "Reference", - {}, + [ + "head" + ] + ], [ + "Variable", [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] + [] ], [ - "int" + "neck" ] - ], - [] + ] ] - ], + ] + ], + [ [ "HeadTailPattern", [ @@ -38686,7 +41624,7 @@ ] ], [ - "AsPattern", + "HeadTailPattern", [ "Reference", {}, @@ -38740,6 +41678,34 @@ ], [ "WildcardPattern", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ], + [ + "AsPattern", [ "Reference", {}, @@ -38790,157 +41756,268 @@ [] ] ] + ], + [ + "WildcardPattern", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ] + ] + ], + [ + "tail" ] - ], - [ - "tail" ] ] - ] - ], - [ - "Apply", + ], [ - "Tuple", - {}, + "Apply", [ + "Tuple", + {}, [ - "Reference", - {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "int" ] ], - [ - "int" - ] + [] ], - [] - ], - [ - "Reference", - {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "int" ] ], - [ - "int" - ] - ], - [] + [] + ] ] - ] - ], - [ - "Variable", + ], [ - "Function", - {}, + "Variable", [ - "Reference", + "Function", {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "list" + ] + ], [ "list" ] ], [ - "list" + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] ] ], [ + "Tuple", + {}, [ - "Reference", - {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "basics" + ] + ], + [ + "int" ] ], + [] + ], + [ + "Reference", + {}, [ [ - "basics" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" ] ], - [ - "int" - ] - ], - [] + [] + ] ] ] ], [ - "Tuple", + "f" + ] + ], + [ + "Variable", + [ + "Reference", {}, [ [ - "Reference", - {}, [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "int" - ] + "morphir" ], - [] + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] ], + [ + "list" + ] + ], + [ [ "Reference", {}, @@ -38967,14 +42044,16 @@ [] ] ] + ], + [ + "tail" ] - ], - [ - "f" ] - ], + ] + ], + [ [ - "Variable", + "AsPattern", [ "Reference", {}, @@ -39027,38 +42106,7 @@ ] ], [ - "tail" - ] - ] - ] - ], - [ - [ - "AsPattern", - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "list" - ] - ], - [ - "list" - ] - ], - [ + "WildcardPattern", [ "Reference", {}, @@ -39075,43 +42123,77 @@ ], [ [ - "basics" + "list" ] ], [ - "int" + "list" ] ], - [] + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ] ] + ], + [ + "other" ] ], [ - "WildcardPattern", + "Apply", [ - "Reference", + "Tuple", {}, [ [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "list" - ] + [] ], - [ - "list" - ] - ], - [ [ "Reference", {}, @@ -39138,75 +42220,126 @@ [] ] ] - ] - ], - [ - "other" - ] - ], - [ - "Apply", - [ - "Tuple", - {}, + ], [ + "Variable", [ - "Reference", + "Function", {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "list" + ] + ], + [ + "list" ] ], [ [ - "basics" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ] - ], - [ - "int" ] ], - [] - ], - [ - "Reference", - {}, [ + "Tuple", + {}, [ [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ], [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ] - ], - [ - "int" ] - ], - [] + ] + ], + [ + "f" ] - ] - ], - [ - "Variable", + ], [ - "Function", - {}, + "Variable", [ "Reference", {}, @@ -39259,121 +42392,8 @@ ] ], [ - "Tuple", - {}, - [ - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "int" - ] - ], - [] - ], - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "int" - ] - ], - [] - ] - ] + "other" ] - ], - [ - "f" - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "list" - ] - ], - [ - "list" - ] - ], - [ - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "int" - ] - ], - [] - ] - ] - ], - [ - "other" ] ] ] @@ -41663,88 +44683,144 @@ "flatten" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Reference", + {}, [ - "l" - ], - [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "list" - ] - ], + "s", + "d", + "k" + ] + ], + [ [ "list" ] ], [ + "list" + ] + ], + [ + [ + "Reference", + {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "list" - ] - ], + "s", + "d", + "k" + ] + ], + [ [ "list" ] ], [ + "list" + ] + ], + [ + [ + "Reference", + {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "string" - ] - ], + "s", + "d", + "k" + ] + ], + [ [ "string" ] ], - [] - ] + [ + "string" + ] + ], + [] ] ] ] + ] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] ], + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -41821,33 +44897,7 @@ ] ] ] - ] - ] - ], - "outputType": [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "list" - ] ], - [ - "list" - ] - ], - [ [ "Reference", {}, @@ -41864,72 +44914,44 @@ ], [ [ - "string" + "list" ] ], - [ - "string" - ] - ], - [] - ] - ] - ], - "body": [ - "PatternMatch", - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ [ "list" ] ], [ - "list" - ] - ], - [ - [ - "Reference", - {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "string" + ] + ], [ "string" ] ], - [ - "string" - ] - ], - [] + [] + ] ] ] ], [ - "Variable", + "AsPattern", [ "Reference", {}, @@ -42008,92 +45030,31 @@ ] ], [ - "l" - ] - ], - [ - [ + "WildcardPattern", [ - "HeadTailPattern", + "Reference", + {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "list" - ] + "morphir" ], [ - "list" + "s", + "d", + "k" ] ], [ [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "list" - ] - ], - [ - "list" - ] - ], - [ - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "string" - ] - ], - [ - "string" - ] - ], - [] - ] - ] + "list" ] + ], + [ + "list" ] ], [ - "HeadTailPattern", [ "Reference", {}, @@ -42144,121 +45105,117 @@ [] ] ] + ] + ] + ] + ], + [ + "l" + ] + ], + [ + "PatternMatch", + [ + "Reference", + {}, + [ + [ + [ + "morphir" ], [ - "AsPattern", + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Reference", + {}, + [ [ - "Reference", - {}, [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "string" - ] - ], - [ - "string" - ] + "morphir" ], - [] + [ + "s", + "d", + "k" + ] ], [ - "WildcardPattern", [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "string" - ] - ], - [ - "string" - ] - ], - [] + "string" ] ], [ - "head" + "string" + ] + ], + [] + ] + ] + ], + [ + "Variable", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" ] ], [ - "AsPattern", [ - "Reference", - {}, + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Reference", + {}, + [ [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "list" - ] + "morphir" ], [ - "list" + "s", + "d", + "k" ] ], [ [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "string" - ] - ], - [ - "string" - ] - ], - [] + "list" ] + ], + [ + "list" ] ], [ - "WildcardPattern", [ "Reference", {}, @@ -42275,49 +45232,27 @@ ], [ [ - "list" + "string" ] ], [ - "list" + "string" ] ], - [ - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "string" - ] - ], - [ - "string" - ] - ], - [] - ] - ] + [] ] - ], - [ - "tail" ] ] - ], + ] + ], + [ + "l" + ] + ], + [ + [ [ - "AsPattern", + "HeadTailPattern", [ "Reference", {}, @@ -42396,7 +45331,7 @@ ] ], [ - "WildcardPattern", + "HeadTailPattern", [ "Reference", {}, @@ -42437,183 +45372,46 @@ ], [ [ - "list" + "string" ] ], [ - "list" + "string" ] ], - [ - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "string" - ] - ], - [ - "string" - ] - ], - [] - ] - ] + [] ] ] - ] - ], - [ - "big", - "tail" - ] - ] - ], - [ - "Apply", - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "list" - ] ], [ - "list" - ] - ], - [ - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "string" - ] - ], - [ - "string" - ] - ], - [] - ] - ] - ], - [ - "Apply", - [ - "Function", - {}, - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "list" - ] - ], - [ - "list" - ] - ], + "AsPattern", [ + "Reference", + {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "string" - ] + "morphir" ], [ - "string" + "s", + "d", + "k" ] ], - [] - ] - ] - ], - [ - "Reference", - {}, - [ - [ [ - "morphir" + [ + "string" + ] ], [ - "s", - "d", - "k" - ] - ], - [ - [ - "list" + "string" ] ], - [ - "list" - ] + [] ], [ + "WildcardPattern", [ "Reference", {}, @@ -42639,14 +45437,13 @@ ], [] ] + ], + [ + "head" ] - ] - ], - [ - "Reference", + ], [ - "Function", - {}, + "AsPattern", [ "Reference", {}, @@ -42663,18 +45460,43 @@ ], [ [ - "string" + "list" ] ], [ - "string" + "list" ] ], - [] + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ] + ] ], [ - "Function", - {}, + "WildcardPattern", [ "Reference", {}, @@ -42725,7 +45547,39 @@ [] ] ] + ] + ], + [ + "tail" + ] + ] + ], + [ + "AsPattern", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] ], + [ + "list" + ] + ], + [ [ "Reference", {}, @@ -42780,55 +45634,88 @@ ] ], [ + "WildcardPattern", [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "list" - ] - ], - [ - "cons" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "list" + ] + ], + [ + "list" ] ], [ [ - "string" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ] + ] ] - ], - [ - "string" ] - ], - [] + ] ], [ - "head" + "big", + "tail" ] ] ], @@ -42886,7 +45773,7 @@ ] ], [ - "Variable", + "Apply", [ "Function", {}, @@ -42930,40 +45817,14 @@ ], [ [ - "list" + "string" ] ], [ - "list" + "string" ] ], - [ - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "string" - ] - ], - [ - "string" - ] - ], - [] - ] - ] + [] ] ] ], @@ -43019,36 +45880,11 @@ ] ] ], - [ - "flatten" - ] - ], - [ - "Apply", [ "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "list" - ] - ], - [ - "list" - ] - ], [ + "Function", + {}, [ "Reference", {}, @@ -43065,125 +45901,233 @@ ], [ [ - "list" + "string" ] ], [ - "list" + "string" ] ], + [] + ], + [ + "Function", + {}, [ + "Reference", + {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "string" - ] + "morphir" ], [ - "string" + "s", + "d", + "k" ] ], - [] - ] - ] - ] - ] - ], - [ - "Apply", - [ - "Function", - {}, - [ - "Reference", - {}, - [ - [ [ - "morphir" + [ + "list" + ] ], - [ - "s", - "d", - "k" - ] - ], - [ [ "list" ] ], [ - "list" - ] - ], - [ - [ - "Reference", - {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "string" + ] + ], + [ + "string" ] ], + [] + ] + ] + ], + [ + "Reference", + {}, + [ + [ [ - [ - "list" - ] + "morphir" ], + [ + "s", + "d", + "k" + ] + ], + [ [ "list" ] ], [ + "list" + ] + ], + [ + [ + "Reference", + {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "string" - ] - ], + "s", + "d", + "k" + ] + ], + [ [ "string" ] ], - [] - ] + [ + "string" + ] + ], + [] ] ] ] + ] + ], + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "cons" + ] + ] + ], + [ + "Variable", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ], + [ + "head" + ] + ] + ], + [ + "Apply", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] ], + [ + "list" + ] + ], + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ] + ] + ], + [ + "Variable", + [ + "Function", + {}, [ "Reference", {}, @@ -43260,13 +46204,89 @@ ] ] ] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ] + ] ] ], + [ + "flatten" + ] + ], + [ + "Apply", [ "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], [ - "Function", - {}, [ "Reference", {}, @@ -43317,87 +46337,174 @@ [] ] ] - ], + ] + ] + ], + [ + "Apply", + [ + "Function", + {}, [ - "Function", + "Reference", {}, [ - "Reference", - {}, [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "list" + ] + ], + [ + "list" ] ], [ [ - "list" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] ] + ] + ] + ] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" ], + [ + "s", + "d", + "k" + ] + ], + [ [ "list" ] ], [ + "list" + ] + ], + [ + [ + "Reference", + {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "list" - ] - ], + "s", + "d", + "k" + ] + ], + [ [ "list" ] ], [ + "list" + ] + ], + [ + [ + "Reference", + {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "string" - ] - ], + "s", + "d", + "k" + ] + ], + [ [ "string" ] ], - [] - ] + [ + "string" + ] + ], + [] ] ] ] - ], + ] + ] + ], + [ + "Reference", + [ + "Function", + {}, [ "Reference", {}, @@ -43438,71 +46545,176 @@ ], [ [ - "list" + "string" ] ], + [ + "string" + ] + ], + [] + ] + ] + ], + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ [ "list" ] ], [ + "list" + ] + ], + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], [ - "Reference", - {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "string" + ] + ], [ "string" ] ], + [] + ] + ] + ] + ] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], [ - "string" + "s", + "d", + "k" + ] + ], + [ + [ + "list" ] ], - [] + [ + "list" + ] + ], + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ] ] ] ] ] ] - ] - ], - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "list" - ] ], - [ - "cons" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, [ [ [ @@ -43520,68 +46732,12 @@ ] ], [ - "list" - ] - ], - [ - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "string" - ] - ], - [ - "string" - ] - ], - [] - ] - ] - ], - [ - "tail" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "list" + "cons" ] - ], - [ - "list" ] ], [ + "Variable", [ "Reference", {}, @@ -43632,69 +46788,14 @@ [] ] ] - ] - ] - ], - [ - "big", - "tail" - ] - ] - ] - ] - ] - ], - [ - [ - "HeadTailPattern", - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "list" - ] - ], - [ - "list" - ] - ], - [ - [ - "Reference", - {}, - [ - [ - [ - "morphir" ], [ - "s", - "d", - "k" - ] - ], - [ - [ - "list" + "tail" ] - ], - [ - "list" ] ], [ + "Variable", [ "Reference", {}, @@ -43711,75 +46812,79 @@ ], [ [ - "string" + "list" ] ], [ - "string" - ] - ], - [] - ] - ] - ] - ] - ], - [ - "EmptyListPattern", - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "list" - ] - ], - [ - "list" - ] - ], - [ - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" + "list" ] ], [ [ - "string" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ] + ] ] - ], - [ - "string" ] ], - [] + [ + "big", + "tail" + ] ] ] ] - ], + ] + ], + [ [ - "AsPattern", + "HeadTailPattern", [ "Reference", {}, @@ -43858,7 +46963,7 @@ ] ], [ - "WildcardPattern", + "EmptyListPattern", [ "Reference", {}, @@ -43899,108 +47004,20 @@ ], [ [ - "list" + "string" ] ], [ - "list" + "string" ] ], - [ - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "string" - ] - ], - [ - "string" - ] - ], - [] - ] - ] + [] ] ] ] ], [ - "big", - "tail" - ] - ] - ], - [ - "Apply", - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "list" - ] - ], - [ - "list" - ] - ], - [ - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "string" - ] - ], - [ - "string" - ] - ], - [] - ] - ] - ], - [ - "Variable", - [ - "Function", - {}, + "AsPattern", [ "Reference", {}, @@ -44079,63 +47096,93 @@ ] ], [ - "Reference", - {}, + "WildcardPattern", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "list" + ] + ], [ "list" ] ], [ - "list" - ] - ], - [ - [ - "Reference", - {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "list" + ] + ], + [ + "list" ] ], [ [ - "string" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] ] - ], - [ - "string" ] - ], - [] + ] ] ] + ], + [ + "big", + "tail" ] - ], - [ - "flatten" ] ], [ - "Variable", + "Apply", [ "Reference", {}, @@ -44160,6 +47207,38 @@ ] ], [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ] + ] + ], + [ + "Variable", + [ + "Function", + {}, [ "Reference", {}, @@ -44200,53 +47279,101 @@ ], [ [ - "string" + "list" ] ], [ - "string" + "list" ] ], - [] + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ] + ] ] ] - ] - ] - ], - [ - "big", - "tail" - ] - ] - ] - ], - [ - [ - "EmptyListPattern", - [ - "Reference", - {}, - [ - [ - [ - "morphir" ], [ - "s", - "d", - "k" - ] - ], - [ - [ - "list" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ] + ] ] ], [ - "list" + "flatten" ] ], [ + "Variable", [ "Reference", {}, @@ -44287,74 +47414,186 @@ ], [ [ - "string" + "list" ] ], [ - "string" + "list" ] ], - [] + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ] + ] ] ] + ], + [ + "big", + "tail" ] ] ] ], [ - "List", [ - "Reference", - {}, + "EmptyListPattern", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "list" + ] + ], [ "list" ] ], [ - "list" - ] - ], - [ - [ - "Reference", - {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "list" + ] + ], + [ + "list" ] ], [ [ - "string" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] ] + ] + ] + ] + ] + ], + [ + "List", + [ + "Reference", + {}, + [ + [ + [ + "morphir" ], [ - "string" + "s", + "d", + "k" ] ], - [] + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ] ] - ] - ], - [] + ], + [] + ] ] ] ] @@ -51107,11 +54346,44 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" + "t", + "0" + ] + ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "1" + ] ], + [ + "Variable", + {}, + [ + "t", + "4" + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -51138,18 +54410,62 @@ [] ], [ - "Variable", + "Function", {}, [ - "t", - "0" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ] ] ], [ - [ - "y" - ], + "AsPattern", [ "Reference", {}, @@ -51176,52 +54492,39 @@ [] ], [ - "Variable", - {}, - [ - "t", - "1" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "6" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ + "WildcardPattern", [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "int" + [] ] ], - [] + [ + "x" + ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -51277,10 +54580,34 @@ ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -51305,7 +54632,41 @@ ] ], [] + ] + ], + [ + "y" + ] + ], + [ + "Apply", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] ], + [] + ], + [ + "Apply", [ "Function", {}, @@ -51359,90 +54720,176 @@ ], [] ] - ] - ], - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] ], [ + "Reference", [ - "basics" - ] - ], - [ - "add" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ - [ + "Function", + {}, [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ], [ - "s", - "d", - "k" + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] ] ], [ [ - "basics" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "add" ] - ], - [ - "int" ] ], - [] - ], - [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ [ + "Variable", [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ], [ - "s", - "d", - "k" + "x" ] - ], + ] + ], + [ + "Variable", [ + "Reference", + {}, [ - "basics" - ] + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ], [ - "int" + "y" ] - ], - [] - ], - [ - "y" + ] ] ] ] @@ -51817,7 +55264,7 @@ {}, [ "t", - "6" + "5" ] ], "body": [ @@ -56950,11 +60397,73 @@ "match" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Reference", + {}, [ - "x" + [ + [ + "morphir" + ], + [ + "examples" + ], + [ + "app" + ] + ], + [ + [ + "pattern", + "match", + "tests" + ] + ], + [ + "pattern", + "match", + "union", + "test", + "type" + ] ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -56996,85 +60505,25 @@ "morphir" ], [ - "examples" - ], - [ - "app" + "s", + "d", + "k" ] ], [ [ - "pattern", - "match", - "tests" + "string" ] ], [ - "pattern", - "match", - "union", - "test", - "type" + "string" ] ], [] ] - ] - ], - "outputType": [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "string" - ] - ], - [ - "string" - ] - ], - [] - ], - "body": [ - "PatternMatch", - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "string" - ] - ], - [ - "string" - ] - ], - [] ], [ - "Variable", + "AsPattern", [ "Reference", {}, @@ -57108,45 +60557,76 @@ [] ], [ - "x" - ] - ], - [ - [ + "WildcardPattern", [ - "ConstructorPattern", + "Reference", + {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "examples" - ], - [ - "app" - ] + "morphir" ], [ - [ - "pattern", - "match", - "tests" - ] + "examples" ], + [ + "app" + ] + ], + [ [ "pattern", "match", - "union", - "test", - "type" + "tests" ] ], - [] + [ + "pattern", + "match", + "union", + "test", + "type" + ] + ], + [] + ] + ], + [ + "x" + ] + ], + [ + "PatternMatch", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] ], + [ + "string" + ] + ], + [] + ], + [ + "Variable", + [ + "Reference", + {}, [ [ [ @@ -57167,51 +60647,55 @@ ] ], [ - "zero", - "arg" + "pattern", + "match", + "union", + "test", + "type" ] ], [] ], [ - "Literal", + "x" + ] + ], + [ + [ [ - "Reference", - {}, + "ConstructorPattern", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "examples" + ], + [ + "app" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "pattern", + "match", + "tests" + ] + ], [ - "string" + "pattern", + "match", + "union", + "test", + "type" ] ], - [ - "string" - ] + [] ], - [] - ], - [ - "StringLiteral", - "Not a ZeroArg" - ] - ] - ], - [ - [ - "ConstructorPattern", - [ - "Reference", - {}, [ [ [ @@ -57232,113 +60716,80 @@ ] ], [ - "pattern", - "match", - "union", - "test", - "type" + "zero", + "arg" ] ], [] ], [ + "Literal", [ + "Reference", + {}, [ - "morphir" - ], - [ - "examples" - ], - [ - "app" - ] - ], - [ - [ - "pattern", - "match", - "tests" - ] - ], - [ - "one", - "arg" - ] - ], - [ - [ - "LiteralPattern", - [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "basics" - ] - ], + "s", + "d", + "k" + ] + ], + [ [ - "int" + "string" ] ], - [] + [ + "string" + ] ], - [ - "WholeNumberLiteral", - 3 - ] + [] + ], + [ + "StringLiteral", + "Not a ZeroArg" ] ] ], [ - "Literal", [ - "Reference", - {}, + "ConstructorPattern", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "examples" + ], + [ + "app" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "pattern", + "match", + "tests" + ] + ], [ - "string" + "pattern", + "match", + "union", + "test", + "type" ] ], - [ - "string" - ] + [] ], - [] - ], - [ - "StringLiteral", - "Not a OneArg" - ] - ] - ], - [ - [ - "ConstructorPattern", - [ - "Reference", - {}, [ [ [ @@ -57359,145 +60810,113 @@ ] ], [ - "pattern", - "match", - "union", - "test", - "type" - ] - ], - [] - ], - [ - [ - [ - "morphir" - ], - [ - "examples" - ], - [ - "app" - ] - ], - [ - [ - "pattern", - "match", - "tests" + "one", + "arg" ] ], [ - "two", - "arg" - ] - ], - [ - [ - "LiteralPattern", [ - "Reference", - {}, + "LiteralPattern", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "int" ] ], - [ - "int" - ] + [] ], - [] - ], - [ - "WholeNumberLiteral", - 3 + [ + "WholeNumberLiteral", + 3 + ] ] - ], + ] + ], + [ + "Literal", [ - "LiteralPattern", + "Reference", + {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "string" - ] - ], + "s", + "d", + "k" + ] + ], + [ [ "string" ] ], - [] + [ + "string" + ] ], - [ - "StringLiteral", - "Wrong" - ] + [] + ], + [ + "StringLiteral", + "Not a OneArg" ] ] ], [ - "Literal", [ - "Reference", - {}, + "ConstructorPattern", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "examples" + ], + [ + "app" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "pattern", + "match", + "tests" + ] + ], [ - "string" + "pattern", + "match", + "union", + "test", + "type" ] ], - [ - "string" - ] + [] ], - [] - ], - [ - "StringLiteral", - "Not a TwoArg with those arguments" - ] - ] - ], - [ - [ - "ConstructorPattern", - [ - "Reference", - {}, [ [ [ @@ -57518,102 +60937,205 @@ ] ], [ - "pattern", - "match", - "union", - "test", - "type" + "two", + "arg" ] ], - [] - ], - [ [ [ - "morphir" - ], - [ - "examples" + "LiteralPattern", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "WholeNumberLiteral", + 3 + ] ], [ - "app" + "LiteralPattern", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ], + [ + "StringLiteral", + "Wrong" + ] ] - ], + ] + ], + [ + "Literal", [ + "Reference", + {}, [ - "pattern", - "match", - "tests" - ] + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] ], [ - "other", - "two", - "arg" + "StringLiteral", + "Not a TwoArg with those arguments" ] - ], + ] + ], + [ [ + "ConstructorPattern", [ - "LiteralPattern", + "Reference", + {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "basics" - ] + "examples" ], [ - "int" + "app" ] ], - [] + [ + [ + "pattern", + "match", + "tests" + ] + ], + [ + "pattern", + "match", + "union", + "test", + "type" + ] ], + [] + ], + [ [ - "WholeNumberLiteral", - 3 + [ + "morphir" + ], + [ + "examples" + ], + [ + "app" + ] + ], + [ + [ + "pattern", + "match", + "tests" + ] + ], + [ + "other", + "two", + "arg" ] ], [ - "AsPattern", [ - "Reference", - {}, + "LiteralPattern", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "string" + "int" ] ], - [ - "string" - ] + [] ], - [] + [ + "WholeNumberLiteral", + 3 + ] ], [ - "WildcardPattern", + "AsPattern", [ "Reference", {}, @@ -57638,53 +61160,109 @@ ] ], [] + ], + [ + "WildcardPattern", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ] + ], + [ + "word" ] - ], - [ - "word" ] ] - ] - ], - [ - "Literal", + ], [ - "Reference", - {}, + "Literal", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "string" + ] + ], [ "string" ] ], - [ - "string" - ] + [] ], - [] - ], - [ - "StringLiteral", - "Arguments match but wrong constructor" + [ + "StringLiteral", + "Arguments match but wrong constructor" + ] ] - ] - ], - [ + ], [ - "ConstructorPattern", [ - "Reference", - {}, + "ConstructorPattern", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "examples" + ], + [ + "app" + ] + ], + [ + [ + "pattern", + "match", + "tests" + ] + ], + [ + "pattern", + "match", + "union", + "test", + "type" + ] + ], + [] + ], [ [ [ @@ -57705,98 +61283,223 @@ ] ], [ - "pattern", - "match", - "union", - "test", - "type" + "two", + "arg" ] ], - [] - ], - [ [ [ - "morphir" - ], - [ - "examples" + "LiteralPattern", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "WholeNumberLiteral", + 3 + ] ], [ - "app" + "AsPattern", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ], + [ + "WildcardPattern", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ] + ], + [ + "word" + ] ] - ], + ] + ], + [ + "Variable", [ + "Reference", + {}, [ - "pattern", - "match", - "tests" - ] + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] ], [ - "two", - "arg" + "word" ] - ], + ] + ], + [ [ + "ConstructorPattern", [ - "LiteralPattern", + "Reference", + {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "basics" - ] + "examples" ], [ - "int" + "app" ] ], - [] + [ + [ + "pattern", + "match", + "tests" + ] + ], + [ + "pattern", + "match", + "union", + "test", + "type" + ] ], + [] + ], + [ [ - "WholeNumberLiteral", - 3 + [ + "morphir" + ], + [ + "examples" + ], + [ + "app" + ] + ], + [ + [ + "pattern", + "match", + "tests" + ] + ], + [ + "two", + "arg" ] ], [ - "AsPattern", [ - "Reference", - {}, + "WildcardPattern", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "string" + "int" ] ], - [ - "string" - ] - ], - [] + [] + ] ], [ "WildcardPattern", @@ -57825,262 +61528,109 @@ ], [] ] - ], - [ - "word" ] ] - ] - ], - [ - "Variable", + ], [ - "Reference", - {}, + "Literal", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "string" + ] + ], [ "string" ] ], - [ - "string" - ] + [] ], - [] - ], - [ - "word" + [ + "StringLiteral", + "An earlier item should have matched" + ] ] - ] - ], - [ + ], [ - "ConstructorPattern", [ - "Reference", - {}, + "WildcardPattern", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "examples" + ], + [ + "app" + ] ], [ - "examples" + [ + "pattern", + "match", + "tests" + ] ], - [ - "app" - ] - ], - [ [ "pattern", "match", - "tests" + "union", + "test", + "type" ] ], - [ - "pattern", - "match", - "union", - "test", - "type" - ] - ], - [] - ], - [ - [ - [ - "morphir" - ], - [ - "examples" - ], - [ - "app" - ] - ], - [ - [ - "pattern", - "match", - "tests" - ] - ], - [ - "two", - "arg" + [] ] ], [ + "Literal", [ - "WildcardPattern", + "Reference", + {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] + "morphir" ], [ - "int" + "s", + "d", + "k" ] ], - [] - ] - ], - [ - "WildcardPattern", - [ - "Reference", - {}, [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "string" - ] - ], [ "string" ] ], - [] - ] - ] - ] - ], - [ - "Literal", - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ [ "string" ] ], - [ - "string" - ] - ], - [] - ], - [ - "StringLiteral", - "An earlier item should have matched" - ] - ] - ], - [ - [ - "WildcardPattern", - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "examples" - ], - [ - "app" - ] - ], - [ - [ - "pattern", - "match", - "tests" - ] - ], - [ - "pattern", - "match", - "union", - "test", - "type" - ] + [] ], - [] - ] - ], - [ - "Literal", - [ - "Reference", - {}, [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "string" - ] - ], - [ - "string" - ] - ], - [] - ], - [ - "StringLiteral", - "An earlier item should have matched" + "StringLiteral", + "An earlier item should have matched" + ] ] ] ] @@ -58588,11 +62138,92 @@ "match" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Reference", + {}, [ - "x" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ] + ] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] ], + [] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -58644,6 +62275,34 @@ ] ] ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ] + ], + [ + "AsPattern", [ "Reference", {}, @@ -58694,63 +62353,67 @@ [] ] ] - ] - ] - ], - "outputType": [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "string" - ] ], [ - "string" - ] - ], - [] - ], - "body": [ - "PatternMatch", - [ - "Reference", - {}, - [ + "WildcardPattern", [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] ], [ - "s", - "d", - "k" - ] - ], - [ - [ - "string" + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ] ] - ], - [ - "string" ] ], - [] + [ + "x" + ] ], [ - "Variable", + "PatternMatch", [ "Reference", {}, @@ -58767,73 +62430,129 @@ ], [ [ - "list" + "string" ] ], [ - "list" + "string" ] ], + [] + ], + [ + "Variable", [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], [ - "Reference", - {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "string" + ] + ], [ "string" ] ], - [ - "string" - ] - ], - [] + [] + ] ] + ], + [ + "x" ] ], - [ - "x" - ] - ], - [ [ [ - "HeadTailPattern", [ - "Reference", - {}, + "HeadTailPattern", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "list" + ] + ], [ "list" ] ], [ - "list" + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ] ] ], [ + "WildcardPattern", [ "Reference", {}, @@ -58859,10 +62578,64 @@ ], [] ] + ], + [ + "EmptyListPattern", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ] + ] + ] ] ], [ - "WildcardPattern", + "Literal", [ "Reference", {}, @@ -58887,10 +62660,16 @@ ] ], [] + ], + [ + "StringLiteral", + "Not a list of one element" ] - ], + ] + ], + [ [ - "EmptyListPattern", + "HeadTailPattern", [ "Reference", {}, @@ -58941,69 +62720,37 @@ [] ] ] - ] - ] - ], - [ - "Literal", - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "string" - ] - ], - [ - "string" - ] ], - [] - ], - [ - "StringLiteral", - "Not a list of one element" - ] - ] - ], - [ - [ - "HeadTailPattern", - [ - "Reference", - {}, [ + "WildcardPattern", [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "list" - ] - ], - [ - "list" + [] ] ], [ + "WildcardPattern", [ "Reference", {}, @@ -59020,19 +62767,45 @@ ], [ [ - "string" + "list" ] ], [ - "string" + "list" ] ], - [] + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ] + ] ] ] ], [ - "WildcardPattern", + "Literal", [ "Reference", {}, @@ -59057,10 +62830,16 @@ ] ], [] + ], + [ + "StringLiteral", + "Not a list of several elements" ] - ], + ] + ], + [ [ - "WildcardPattern", + "EmptyListPattern", [ "Reference", {}, @@ -59112,126 +62891,38 @@ ] ] ] - ] - ], - [ - "Literal", - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "string" - ] - ], - [ - "string" - ] - ], - [] ], [ - "StringLiteral", - "Not a list of several elements" - ] - ] - ], - [ - [ - "EmptyListPattern", - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "list" - ] - ], - [ - "list" - ] - ], + "Literal", [ + "Reference", + {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "string" - ] + "morphir" ], [ - "string" + "s", + "d", + "k" ] ], - [] - ] - ] - ] - ], - [ - "Literal", - [ - "Reference", - {}, - [ - [ [ - "morphir" + [ + "string" + ] ], - [ - "s", - "d", - "k" - ] - ], - [ [ "string" ] ], - [ - "string" - ] + [] ], - [] - ], - [ - "StringLiteral", - "Correct" + [ + "StringLiteral", + "Correct" + ] ] ] ] @@ -59626,11 +63317,123 @@ "match" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Reference", + {}, [ - "x" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] ], + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ] + ] + ], + [ + "Tuple", + {}, + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -59683,29 +63486,34 @@ ] ], [ - "Reference", + "Tuple", {}, [ [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "list" - ] + [] ], - [ - "list" - ] - ], - [ [ "Reference", {}, @@ -59733,12 +63541,9 @@ ] ] ] - ] - ], - "outputType": [ - "Tuple", - {}, + ], [ + "AsPattern", [ "Reference", {}, @@ -59755,48 +63560,43 @@ ], [ [ - "string" + "list" ] ], [ - "string" + "list" ] ], - [] - ], - [ - "Reference", - {}, [ [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "string" - ] - ], - [ - "string" + [] ] - ], - [] - ] - ] - ], - "body": [ - "PatternMatch", - [ - "Tuple", - {}, + ] + ], [ + "WildcardPattern", [ "Reference", {}, @@ -59813,67 +63613,51 @@ ], [ [ - "string" + "list" ] ], [ - "string" + "list" ] ], - [] - ], - [ - "Reference", - {}, [ [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "string" - ] - ], - [ - "string" + [] ] - ], - [] + ] ] + ], + [ + "x" ] ], [ - "Variable", + "PatternMatch", [ - "Reference", + "Tuple", {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "list" - ] - ], - [ - "list" - ] - ], [ [ "Reference", @@ -59899,17 +63683,7 @@ ] ], [] - ] - ] - ], - [ - "x" - ] - ], - [ - [ - [ - "HeadTailPattern", + ], [ "Reference", {}, @@ -59926,43 +63700,43 @@ ], [ [ - "list" + "string" ] ], [ - "list" + "string" ] ], + [] + ] + ] + ], + [ + "Variable", + [ + "Reference", + {}, + [ [ [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "string" - ] - ], - [ - "string" - ] - ], - [] + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" ] + ], + [ + "list" ] ], [ - "LiteralPattern", [ "Reference", {}, @@ -59987,14 +63761,17 @@ ] ], [] - ], - [ - "StringLiteral", - "Nope" ] - ], + ] + ], + [ + "x" + ] + ], + [ + [ [ - "WildcardPattern", + "HeadTailPattern", [ "Reference", {}, @@ -60045,15 +63822,9 @@ [] ] ] - ] - ] - ], - [ - "Tuple", - [ - "Tuple", - {}, + ], [ + "LiteralPattern", [ "Reference", {}, @@ -60079,6 +63850,13 @@ ], [] ], + [ + "StringLiteral", + "Nope" + ] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -60095,167 +63873,170 @@ ], [ [ - "string" + "list" ] ], [ - "string" + "list" ] ], - [] - ] - ] - ], - [ - [ - "Literal", - [ - "Reference", - {}, [ [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "string" - ] - ], - [ - "string" + [] ] - ], - [] - ], - [ - "StringLiteral", - "Does not start with that element" + ] ] - ], + ] + ], + [ + "Tuple", [ - "Literal", + "Tuple", + {}, [ - "Reference", - {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "string" + ] + ], [ "string" ] ], - [ - "string" - ] - ], - [] - ], - [ - "StringLiteral", - "" - ] - ] - ] - ] - ], - [ - [ - "HeadTailPattern", - [ - "Reference", - {}, - [ - [ - [ - "morphir" + [] ], [ - "s", - "d", - "k" - ] - ], - [ - [ - "list" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] ] - ], - [ - "list" ] ], [ [ - "Reference", - {}, + "Literal", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "string" + ] + ], [ "string" ] ], - [ - "string" - ] + [] ], - [] - ] - ] - ], - [ - "WildcardPattern", - [ - "Reference", - {}, + [ + "StringLiteral", + "Does not start with that element" + ] + ], [ + "Literal", [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "string" - ] + [] ], [ - "string" + "StringLiteral", + "" ] - ], - [] + ] ] - ], + ] + ], + [ [ "HeadTailPattern", [ @@ -60338,7 +64119,7 @@ ] ], [ - "EmptyListPattern", + "HeadTailPattern", [ "Reference", {}, @@ -60389,430 +64170,399 @@ [] ] ] - ] - ] - ] - ], - [ - "Tuple", - [ - "Tuple", - {}, - [ + ], [ - "Reference", - {}, + "WildcardPattern", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "string" + ] + ], [ "string" ] ], - [ - "string" - ] - ], - [] + [] + ] ], [ - "Reference", - {}, + "EmptyListPattern", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "list" + ] + ], + [ + "list" ] ], [ [ - "string" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] ] - ], - [ - "string" ] - ], - [] + ] ] ] ], [ + "Tuple", [ - "Literal", + "Tuple", + {}, [ - "Reference", - {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "string" + ] + ], + [ + "string" ] ], + [] + ], + [ + "Reference", + {}, [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], [ "string" ] ], - [ - "string" - ] - ], - [] - ], - [ - "StringLiteral", - "Not two elements long" + [] + ] ] ], [ - "Literal", [ - "Reference", - {}, + "Literal", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "string" + ] + ], [ "string" ] ], - [ - "string" - ] - ], - [] - ], - [ - "StringLiteral", - "" - ] - ] - ] - ] - ], - [ - [ - "EmptyListPattern", - [ - "Reference", - {}, - [ - [ - [ - "morphir" + [] ], [ - "s", - "d", - "k" - ] - ], - [ - [ - "list" + "StringLiteral", + "Not two elements long" ] ], [ - "list" - ] - ], - [ - [ - "Reference", - {}, + "Literal", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "string" + ] + ], [ "string" ] ], - [ - "string" - ] + [] ], - [] + [ + "StringLiteral", + "" + ] ] ] ] ], [ - "Tuple", [ - "Tuple", - {}, + "EmptyListPattern", [ + "Reference", + {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "string" - ] - ], + "s", + "d", + "k" + ] + ], + [ [ - "string" + "list" ] ], - [] + [ + "list" + ] ], [ - "Reference", - {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "string" + ] + ], [ "string" ] ], - [ - "string" - ] - ], - [] + [] + ] ] ] ], [ + "Tuple", [ - "Literal", + "Tuple", + {}, [ - "Reference", - {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "string" + ] + ], [ "string" ] ], - [ - "string" - ] + [] ], - [] - ], - [ - "StringLiteral", - "Not an empty list" - ] - ], - [ - "Literal", - [ - "Reference", - {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "string" + ] + ], [ "string" ] ], - [ - "string" - ] - ], - [] - ], - [ - "StringLiteral", - "" - ] - ] - ] - ] - ], - [ - [ - "HeadTailPattern", - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "list" + [] ] - ], - [ - "list" ] ], [ [ - "Reference", - {}, + "Literal", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "string" + ] + ], [ "string" ] ], - [ - "string" - ] - ], - [] - ] - ] - ], - [ - "AsPattern", - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "string" - ] + [] ], [ - "string" + "StringLiteral", + "Not an empty list" ] ], - [] - ], - [ - "WildcardPattern", [ - "Reference", - {}, + "Literal", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "string" + ] + ], [ "string" ] ], - [ - "string" - ] + [] ], - [] + [ + "StringLiteral", + "" + ] ] - ], - [ - "head" ] - ], + ] + ], + [ [ "HeadTailPattern", [ @@ -60922,11 +64672,11 @@ ] ], [ - "neck" + "head" ] ], [ - "WildcardPattern", + "HeadTailPattern", [ "Reference", {}, @@ -60977,310 +64727,423 @@ [] ] ] - ] - ] - ] - ], - [ - "Tuple", - [ - "Tuple", - {}, - [ + ], [ - "Reference", - {}, + "AsPattern", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "string" + ] + ], [ "string" ] ], + [] + ], + [ + "WildcardPattern", [ - "string" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] ] ], - [] + [ + "neck" + ] ], [ - "Reference", - {}, + "WildcardPattern", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "list" + ] + ], + [ + "list" ] ], [ [ - "string" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] ] - ], - [ - "string" ] - ], - [] + ] ] ] ], [ + "Tuple", [ - "Variable", + "Tuple", + {}, [ - "Reference", - {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "string" + ] + ], + [ + "string" ] ], + [] + ], + [ + "Reference", + {}, [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], [ "string" ] ], - [ - "string" - ] - ], - [] - ], - [ - "neck" + [] + ] ] ], [ - "Variable", [ - "Reference", - {}, + "Variable", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "string" + ] + ], + [ + "string" ] ], + [] + ], + [ + "neck" + ] + ], + [ + "Variable", + [ + "Reference", + {}, [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], [ "string" ] ], - [ - "string" - ] + [] ], - [] - ], - [ - "head" + [ + "head" + ] ] ] ] - ] - ], - [ + ], [ - "WildcardPattern", [ - "Reference", - {}, + "WildcardPattern", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "list" + ] + ], [ "list" ] ], [ - "list" - ] - ], - [ - [ - "Reference", - {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "string" + ] + ], [ "string" ] ], - [ - "string" - ] - ], - [] + [] + ] ] ] - ] - ], - [ - "Tuple", + ], [ "Tuple", - {}, [ + "Tuple", + {}, [ - "Reference", - {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "string" + ] + ], [ "string" ] ], - [ - "string" - ] + [] ], - [] - ], - [ - "Reference", - {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "string" + ] + ], [ "string" ] ], - [ - "string" - ] - ], - [] + [] + ] ] - ] - ], - [ + ], [ - "Literal", [ - "Reference", - {}, + "Literal", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "string" + ] + ], [ "string" ] ], - [ - "string" - ] + [] ], - [] + [ + "StringLiteral", + "An earlier item should have matched" + ] ], [ - "StringLiteral", - "An earlier item should have matched" - ] - ], - [ - "Literal", - [ - "Reference", - {}, + "Literal", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "string" + ] + ], [ "string" ] ], - [ - "string" - ] + [] ], - [] - ], - [ - "StringLiteral", - "" + [ + "StringLiteral", + "" + ] ] ] ] @@ -61774,11 +65637,66 @@ "match" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Reference", + {}, [ - "x" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] ], + [] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -61829,62 +65747,68 @@ ], [] ] - ] - ], - "outputType": [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "string" - ] - ], - [ - "string" - ] ], - [] - ], - "body": [ - "PatternMatch", [ - "Reference", - {}, + "AsPattern", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "string" + ] + ], [ "string" ] ], + [] + ], + [ + "WildcardPattern", [ - "string" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] ] ], - [] + [ + "x" + ] ], [ - "Variable", + "PatternMatch", [ "Reference", {}, @@ -61911,201 +65835,229 @@ [] ], [ - "x" - ] - ], - [ - [ + "Variable", [ - "LiteralPattern", + "Reference", + {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "string" - ] - ], + "s", + "d", + "k" + ] + ], + [ [ "string" ] ], - [] + [ + "string" + ] ], - [ - "StringLiteral", - "Nope" - ] + [] ], [ - "Literal", + "x" + ] + ], + [ + [ [ - "Reference", - {}, + "LiteralPattern", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "string" + ] + ], [ "string" ] ], - [ - "string" - ] + [] ], - [] + [ + "StringLiteral", + "Nope" + ] ], [ - "StringLiteral", - "Not that" - ] - ] - ], - [ - [ - "LiteralPattern", - [ - "Reference", - {}, + "Literal", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "string" + ] + ], [ "string" ] ], - [ - "string" - ] + [] ], - [] - ], - [ - "StringLiteral", - "Yes" + [ + "StringLiteral", + "Not that" + ] ] ], [ - "Literal", [ - "Reference", - {}, + "LiteralPattern", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "string" + ] + ], [ "string" ] ], - [ - "string" - ] + [] ], - [] + [ + "StringLiteral", + "Yes" + ] ], [ - "StringLiteral", - "Correct" - ] - ] - ], - [ - [ - "WildcardPattern", - [ - "Reference", - {}, + "Literal", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "string" + ] + ], [ "string" ] ], - [ - "string" - ] + [] ], - [] + [ + "StringLiteral", + "Correct" + ] ] ], [ - "Literal", [ - "Reference", - {}, + "WildcardPattern", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "string" + ] + ], + [ + "string" ] ], + [] + ] + ], + [ + "Literal", + [ + "Reference", + {}, [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], [ "string" ] ], - [ - "string" - ] + [] ], - [] - ], - [ - "StringLiteral", - "An earlier item should have matched" + [ + "StringLiteral", + "An earlier item should have matched" + ] ] ] ] @@ -62544,214 +66496,66 @@ "match" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Tuple", + {}, [ - "x" - ], - [ - "Tuple", - {}, - [ - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "int" - ] - ], - [] - ], - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "int" - ] - ], - [] - ] - ] - ], - [ - "Tuple", - {}, [ + "Reference", + {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] + "morphir" ], [ - "int" + "s", + "d", + "k" ] ], - [] - ], - [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "int" + "basics" ] ], - [] - ] - ] - ] - ] - ], - "outputType": [ - "Tuple", - {}, - [ - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ [ - "basics" + "int" ] ], - [ - "int" - ] + [] ], - [] - ], - [ - "Tuple", - {}, [ + "Reference", + {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] + "morphir" ], [ - "int" + "s", + "d", + "k" ] ], - [] - ], - [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "int" + "basics" ] ], - [] - ] + [ + "int" + ] + ], + [] ] ] - ] - ], - "body": [ - "PatternMatch", + ], [ "Tuple", {}, @@ -62838,9 +66642,13 @@ ] ] ] - ], + ] + ], + "body": [ + "Lambda", [ - "Variable", + "Function", + {}, [ "Tuple", {}, @@ -62898,13 +66706,34 @@ ] ], [ - "x" - ] - ], - [ - [ + "Tuple", + {}, [ - "TuplePattern", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], [ "Tuple", {}, @@ -62960,72 +66789,162 @@ [] ] ] + ] + ] + ] + ], + [ + "AsPattern", + [ + "Tuple", + {}, + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ], [ + "Reference", + {}, [ - "LiteralPattern", [ - "Reference", - {}, + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ] + ], + [ + "WildcardPattern", + [ + "Tuple", + {}, + [ + [ + "Reference", + {}, + [ [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "basics" - ] - ], + "s", + "d", + "k" + ] + ], + [ [ - "int" + "basics" ] ], - [] + [ + "int" + ] ], - [ - "WholeNumberLiteral", - 0 - ] + [] ], [ - "WildcardPattern", + "Reference", + {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "basics" - ] - ], + "s", + "d", + "k" + ] + ], + [ [ - "int" + "basics" ] ], - [] - ] + [ + "int" + ] + ], + [] ] ] - ], + ] + ], + [ + "x" + ] + ], + [ + "PatternMatch", + [ + "Tuple", + {}, [ - "Tuple", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], [ "Tuple", {}, @@ -63055,67 +66974,6 @@ ], [] ], - [ - "Tuple", - {}, - [ - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "int" - ] - ], - [] - ], - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "int" - ] - ], - [] - ] - ] - ] - ] - ], - [ - [ - "Literal", [ "Reference", {}, @@ -63140,205 +66998,136 @@ ] ], [] - ], - [ - "WholeNumberLiteral", - 0 ] - ], + ] + ] + ] + ], + [ + "Variable", + [ + "Tuple", + {}, + [ [ - "Tuple", + "Reference", + {}, [ - "Tuple", - {}, [ [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "int" - ] - ], - [] + "morphir" ], [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "int" - ] - ], - [] + "s", + "d", + "k" ] - ] - ], - [ + ], [ - "Literal", - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "int" - ] - ], - [] - ], [ - "WholeNumberLiteral", - 0 + "basics" ] ], [ - "Literal", - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "int" - ] - ], - [] + "int" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" ], [ - "WholeNumberLiteral", - 0 + "s", + "d", + "k" + ] + ], + [ + [ + "basics" ] + ], + [ + "int" ] - ] + ], + [] ] ] + ], + [ + "x" ] ], [ [ - "AsPattern", [ - "Tuple", - {}, + "TuplePattern", [ + "Tuple", + {}, [ - "Reference", - {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "int" ] ], - [ - "int" - ] + [] ], - [] - ], - [ - "Reference", - {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "int" ] ], - [ - "int" - ] - ], - [] + [] + ] ] - ] - ], - [ - "TuplePattern", + ], [ - "Tuple", - {}, [ + "LiteralPattern", [ "Reference", {}, @@ -63364,6 +67153,13 @@ ], [] ], + [ + "WholeNumberLiteral", + 0 + ] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -63390,10 +67186,14 @@ [] ] ] - ], + ] + ], + [ + "Tuple", [ + "Tuple", + {}, [ - "LiteralPattern", [ "Reference", {}, @@ -63420,12 +67220,66 @@ [] ], [ - "WholeNumberLiteral", - 1 + "Tuple", + {}, + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ] ] - ], + ] + ], + [ [ - "AsPattern", + "Literal", [ "Reference", {}, @@ -63452,74 +67306,199 @@ [] ], [ - "WildcardPattern", + "WholeNumberLiteral", + 0 + ] + ], + [ + "Tuple", + [ + "Tuple", + {}, [ - "Reference", - {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "basics" + ] + ], + [ + "int" ] ], + [] + ], + [ + "Reference", + {}, [ [ - "basics" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" ] ], - [ - "int" - ] - ], - [] + [] + ] ] ], [ - "y" + [ + "Literal", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "WholeNumberLiteral", + 0 + ] + ], + [ + "Literal", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "WholeNumberLiteral", + 0 + ] + ] ] ] ] - ], - [ - "z" ] ], [ - "Tuple", [ - "Tuple", - {}, + "AsPattern", [ + "Tuple", + {}, [ - "Reference", - {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "basics" + ] + ], + [ + "int" ] ], + [] + ], + [ + "Reference", + {}, [ [ - "basics" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" ] ], - [ - "int" - ] - ], - [] - ], + [] + ] + ] + ], + [ + "TuplePattern", [ "Tuple", {}, @@ -63575,47 +67554,10 @@ [] ] ] - ] - ] - ], - [ - [ - "Variable", - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "int" - ] - ], - [] ], [ - "y" - ] - ], - [ - "Variable", - [ - "Tuple", - {}, [ + "LiteralPattern", [ "Reference", {}, @@ -63641,6 +67583,13 @@ ], [] ], + [ + "WholeNumberLiteral", + 1 + ] + ], + [ + "AsPattern", [ "Reference", {}, @@ -63665,319 +67614,535 @@ ] ], [] + ], + [ + "WildcardPattern", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ], + [ + "y" ] ] - ], - [ - "z" ] + ], + [ + "z" ] - ] - ] - ], - [ - [ - "WildcardPattern", + ], [ "Tuple", - {}, [ + "Tuple", + {}, [ - "Reference", - {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "int" ] ], - [ - "int" - ] + [] ], - [] - ], - [ - "Reference", - {}, [ + "Tuple", + {}, [ [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ], [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ] - ], - [ - "int" ] - ], - [] + ] ] - ] - ] - ], - [ - "Tuple", - [ - "Tuple", - {}, + ], [ [ - "Reference", - {}, + "Variable", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "int" ] ], - [ - "int" - ] + [] ], - [] + [ + "y" + ] ], [ - "Tuple", - {}, + "Variable", [ + "Tuple", + {}, [ - "Reference", - {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "int" ] ], - [ - "int" - ] + [] ], - [] - ], - [ - "Reference", - {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "int" ] ], - [ - "int" - ] - ], - [] + [] + ] ] + ], + [ + "z" ] ] ] - ], + ] + ], + [ [ + "WildcardPattern", [ - "Literal", + "Tuple", + {}, [ - "Reference", - {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "basics" + ] + ], + [ + "int" ] ], + [] + ], + [ + "Reference", + {}, [ [ - "basics" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" ] ], - [ - "int" - ] - ], - [] - ], - [ - "WholeNumberLiteral", - 0 + [] + ] ] - ], + ] + ], + [ + "Tuple", [ "Tuple", + {}, [ - "Tuple", - {}, [ + "Reference", + {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "basics" - ] - ], + "s", + "d", + "k" + ] + ], + [ [ - "int" + "basics" ] ], - [] + [ + "int" + ] ], + [] + ], + [ + "Tuple", + {}, [ - "Reference", - {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "basics" + ] + ], + [ + "int" ] ], + [] + ], + [ + "Reference", + {}, [ [ - "basics" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" ] ], + [] + ] + ] + ] + ] + ], + [ + [ + "Literal", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], [ - "int" + "s", + "d", + "k" ] ], - [] - ] + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "WholeNumberLiteral", + 0 ] ], [ + "Tuple", [ - "Literal", + "Tuple", + {}, [ - "Reference", - {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "basics" + ] + ], + [ + "int" ] ], + [] + ], + [ + "Reference", + {}, [ [ - "basics" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" ] ], - [ - "int" - ] - ], - [] - ], - [ - "WholeNumberLiteral", - 0 + [] + ] ] ], [ - "Literal", [ - "Reference", - {}, + "Literal", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "basics" + ] + ], + [ + "int" ] ], + [] + ], + [ + "WholeNumberLiteral", + 0 + ] + ], + [ + "Literal", + [ + "Reference", + {}, [ [ - "basics" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" ] ], - [ - "int" - ] + [] ], - [] - ], - [ - "WholeNumberLiteral", - 0 + [ + "WholeNumberLiteral", + 0 + ] ] ] ] @@ -64481,92 +68646,122 @@ "match" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Tuple", + {}, [ - "x" - ], - [ - "Tuple", - {}, [ + "Reference", + {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] + "morphir" ], [ - "int" + "s", + "d", + "k" ] ], - [] - ], - [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ [ - [ - "string" - ] + "morphir" ], + [ + "s", + "d", + "k" + ] + ], + [ [ "string" ] ], - [] + [ + "string" + ] ], + [] + ], + [ + "Reference", + {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "string" - ] - ], + "s", + "d", + "k" + ] + ], + [ [ "string" ] ], - [] + [ + "string" + ] + ], + [] + ] + ] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" ] + ], + [ + "string" ] ], + [] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Tuple", {}, @@ -64647,63 +68842,35 @@ [] ] ] - ] - ] - ], - "outputType": [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "string" - ] ], [ - "string" - ] - ], - [] - ], - "body": [ - "PatternMatch", - [ - "Reference", - {}, - [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "string" + ] + ], [ "string" ] ], - [ - "string" - ] - ], - [] + [] + ] ], [ - "Variable", + "AsPattern", [ "Tuple", {}, @@ -64786,812 +68953,983 @@ ] ], [ - "x" - ] - ], - [ - [ + "WildcardPattern", [ - "TuplePattern", + "Tuple", + {}, [ - "Tuple", - {}, [ + "Reference", + {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "basics" - ] - ], + "s", + "d", + "k" + ] + ], + [ [ - "int" + "basics" ] ], - [] + [ + "int" + ] ], + [] + ], + [ + "Reference", + {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "string" - ] - ], + "s", + "d", + "k" + ] + ], + [ [ "string" ] ], - [] + [ + "string" + ] ], + [] + ], + [ + "Reference", + {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "string" - ] - ], + "s", + "d", + "k" + ] + ], + [ [ "string" ] ], - [] - ] + [ + "string" + ] + ], + [] + ] + ] + ] + ], + [ + "x" + ] + ], + [ + "PatternMatch", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" ] ], [ [ - "LiteralPattern", + "string" + ] + ], + [ + "string" + ] + ], + [] + ], + [ + "Variable", + [ + "Tuple", + {}, + [ + [ + "Reference", + {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "basics" - ] - ], + "s", + "d", + "k" + ] + ], + [ [ - "int" + "basics" ] ], - [] + [ + "int" + ] ], - [ - "WholeNumberLiteral", - 0 - ] + [] ], [ - "WildcardPattern", + "Reference", + {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "string" - ] - ], + "s", + "d", + "k" + ] + ], + [ [ "string" ] ], - [] - ] + [ + "string" + ] + ], + [] ], [ - "WildcardPattern", + "Reference", + {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "string" - ] + "morphir" ], [ - "string" + "s", + "d", + "k" ] ], - [] - ] - ] - ] - ], - [ - "Literal", - [ - "Reference", - {}, - [ - [ [ - "morphir" + [ + "string" + ] ], - [ - "s", - "d", - "k" - ] - ], - [ [ "string" ] ], - [ - "string" - ] - ], - [] - ], - [ - "StringLiteral", - "First element is not 0" + [] + ] ] + ], + [ + "x" ] ], [ [ - "TuplePattern", [ - "Tuple", - {}, + "TuplePattern", [ + "Tuple", + {}, [ - "Reference", - {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "int" ] ], - [ - "int" - ] + [] ], - [] - ], - [ - "Reference", - {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "string" + ] + ], [ "string" ] ], - [ - "string" - ] + [] ], - [] - ], - [ - "Reference", - {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "string" + ] + ], [ "string" ] ], - [ - "string" - ] - ], - [] + [] + ] ] - ] - ], - [ + ], [ - "WildcardPattern", [ - "Reference", - {}, + "LiteralPattern", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "int" ] ], - [ - "int" - ] + [] ], - [] - ] - ], - [ - "LiteralPattern", + [ + "WholeNumberLiteral", + 0 + ] + ], [ - "Reference", - {}, + "WildcardPattern", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "string" + ] + ], [ "string" ] ], - [ - "string" - ] - ], - [] + [] + ] ], [ - "StringLiteral", - "Red" - ] - ], - [ - "WildcardPattern", - [ - "Reference", - {}, + "WildcardPattern", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "string" + ] + ], [ "string" ] ], - [ - "string" - ] - ], - [] + [] + ] ] ] - ] - ], - [ - "Literal", + ], [ - "Reference", - {}, + "Literal", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "string" + ] + ], [ "string" ] ], - [ - "string" - ] + [] ], - [] - ], - [ - "StringLiteral", - "Second element is not Red" + [ + "StringLiteral", + "First element is not 0" + ] ] - ] - ], - [ + ], [ - "TuplePattern", [ - "Tuple", - {}, + "TuplePattern", [ + "Tuple", + {}, [ - "Reference", - {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "int" ] ], - [ - "int" - ] + [] ], - [] - ], - [ - "Reference", - {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "string" + ] + ], [ "string" ] ], - [ - "string" - ] + [] ], - [] - ], - [ - "Reference", - {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "string" + ] + ], [ "string" ] ], - [ - "string" - ] - ], - [] + [] + ] ] - ] - ], - [ + ], [ - "WildcardPattern", [ - "Reference", - {}, + "WildcardPattern", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "int" ] ], - [ - "int" - ] - ], - [] - ] - ], - [ - "WildcardPattern", + [] + ] + ], [ - "Reference", - {}, + "LiteralPattern", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "string" + ] + ], [ "string" ] ], - [ - "string" - ] + [] ], - [] - ] - ], - [ - "LiteralPattern", + [ + "StringLiteral", + "Red" + ] + ], [ - "Reference", - {}, + "WildcardPattern", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "string" + ] + ], [ "string" ] ], - [ - "string" - ] - ], - [] - ], - [ - "StringLiteral", - "Car" + [] + ] ] ] - ] - ], - [ - "Literal", + ], [ - "Reference", - {}, + "Literal", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "string" + ] + ], [ "string" ] ], - [ - "string" - ] + [] ], - [] - ], - [ - "StringLiteral", - "Third element is not Car" + [ + "StringLiteral", + "Second element is not Red" + ] ] - ] - ], - [ + ], [ - "TuplePattern", [ - "Tuple", - {}, + "TuplePattern", [ + "Tuple", + {}, [ - "Reference", - {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "basics" + ] + ], + [ + "int" ] ], + [] + ], + [ + "Reference", + {}, [ [ - "basics" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" ] ], - [ - "int" - ] + [] ], - [] + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ] + ] + ], + [ + [ + "WildcardPattern", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] ], [ - "Reference", - {}, + "WildcardPattern", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "string" + ] + ], [ "string" ] ], - [ - "string" - ] - ], - [] + [] + ] ], [ - "Reference", - {}, + "LiteralPattern", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "string" + ] + ], [ "string" ] ], - [ - "string" - ] + [] ], - [] + [ + "StringLiteral", + "Car" + ] ] ] ], [ + "Literal", [ - "LiteralPattern", + "Reference", + {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "basics" - ] - ], + "s", + "d", + "k" + ] + ], + [ [ - "int" + "string" ] ], - [] + [ + "string" + ] ], - [ - "WholeNumberLiteral", - 1 - ] + [] ], [ - "LiteralPattern", + "StringLiteral", + "Third element is not Car" + ] + ] + ], + [ + [ + "TuplePattern", + [ + "Tuple", + {}, [ - "Reference", - {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "basics" + ] + ], + [ + "int" ] ], + [] + ], + [ + "Reference", + {}, [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], [ "string" ] ], - [ - "string" - ] + [] ], - [] - ], - [ - "StringLiteral", - "Car" + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ] ] ], [ - "AsPattern", [ - "Reference", - {}, + "LiteralPattern", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "basics" + ] + ], + [ + "int" ] ], + [] + ], + [ + "WholeNumberLiteral", + 1 + ] + ], + [ + "LiteralPattern", + [ + "Reference", + {}, [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], [ "string" ] ], - [ - "string" - ] + [] ], - [] + [ + "StringLiteral", + "Car" + ] ], [ - "WildcardPattern", + "AsPattern", [ "Reference", {}, @@ -65616,161 +69954,189 @@ ] ], [] + ], + [ + "WildcardPattern", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ] + ], + [ + "third" ] - ], - [ - "third" ] ] - ] - ], - [ - "Variable", + ], [ - "Reference", - {}, + "Variable", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "string" + ] + ], [ "string" ] ], - [ - "string" - ] + [] ], - [] - ], - [ - "third" + [ + "third" + ] ] - ] - ], - [ + ], [ - "WildcardPattern", [ - "Tuple", - {}, + "WildcardPattern", [ + "Tuple", + {}, [ - "Reference", - {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "int" ] ], - [ - "int" - ] + [] ], - [] - ], - [ - "Reference", - {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "string" + ] + ], [ "string" ] ], - [ - "string" - ] + [] ], - [] - ], - [ - "Reference", - {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "string" + ] + ], [ "string" ] ], - [ - "string" - ] - ], - [] + [] + ] ] ] - ] - ], - [ - "Literal", + ], [ - "Reference", - {}, + "Literal", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "string" + ] + ], [ "string" ] ], - [ - "string" - ] + [] ], - [] - ], - [ - "StringLiteral", - "An earlier item should have matched" + [ + "StringLiteral", + "An earlier item should have matched" + ] ] ] ] @@ -66228,11 +70594,92 @@ "match" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Reference", + {}, [ - "x" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] ], + [] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -66284,6 +70731,34 @@ ] ] ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ] + ], + [ + "AsPattern", [ "Reference", {}, @@ -66334,63 +70809,67 @@ [] ] ] - ] - ] - ], - "outputType": [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "string" - ] ], [ - "string" - ] - ], - [] - ], - "body": [ - "PatternMatch", - [ - "Reference", - {}, - [ + "WildcardPattern", [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] ], [ - "s", - "d", - "k" - ] - ], - [ - [ - "string" + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] ] - ], - [ - "string" ] ], - [] + [ + "x" + ] ], [ - "Variable", + "PatternMatch", [ "Reference", {}, @@ -66407,161 +70886,217 @@ ], [ [ - "list" + "string" ] ], [ - "list" + "string" ] ], + [] + ], + [ + "Variable", [ + "Reference", + {}, [ - "Reference", - {}, [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "int" ] ], - [ - "int" - ] - ], - [] + [] + ] ] + ], + [ + "x" ] ], - [ - "x" - ] - ], - [ [ [ - "EmptyListPattern", [ - "Reference", - {}, + "EmptyListPattern", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "list" + ] + ], [ "list" ] ], [ - "list" - ] - ], - [ - [ - "Reference", - {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "int" ] ], - [ - "int" - ] - ], - [] + [] + ] ] ] - ] - ], - [ - "Literal", + ], [ - "Reference", - {}, + "Literal", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "string" + ] + ], [ "string" ] ], - [ - "string" - ] + [] ], - [] - ], - [ - "StringLiteral", - "Not an empty list" + [ + "StringLiteral", + "Not an empty list" + ] ] - ] - ], - [ + ], [ - "HeadTailPattern", [ - "Reference", - {}, + "HeadTailPattern", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "list" + ] + ], [ "list" ] ], [ - "list" + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] ] ], [ + "LiteralPattern", [ "Reference", {}, @@ -66586,11 +71121,69 @@ ] ], [] + ], + [ + "WholeNumberLiteral", + 3 + ] + ], + [ + "WildcardPattern", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ] ] ] ], [ - "LiteralPattern", + "Literal", [ "Reference", {}, @@ -66607,22 +71200,24 @@ ], [ [ - "basics" + "string" ] ], [ - "int" + "string" ] ], [] ], [ - "WholeNumberLiteral", - 3 + "StringLiteral", + "Does not start with a 3" ] - ], + ] + ], + [ [ - "WildcardPattern", + "HeadTailPattern", [ "Reference", {}, @@ -66673,69 +71268,9 @@ [] ] ] - ] - ] - ], - [ - "Literal", - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "string" - ] - ], - [ - "string" - ] - ], - [] - ], - [ - "StringLiteral", - "Does not start with a 3" - ] - ] - ], - [ - [ - "HeadTailPattern", - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "list" - ] - ], - [ - "list" - ] ], [ + "WildcardPattern", [ "Reference", {}, @@ -66761,10 +71296,64 @@ ], [] ] + ], + [ + "EmptyListPattern", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ] + ] ] ], [ - "WildcardPattern", + "Literal", [ "Reference", {}, @@ -66781,18 +71370,24 @@ ], [ [ - "basics" + "string" ] ], [ - "int" + "string" ] ], [] + ], + [ + "StringLiteral", + "Not a list of one element" ] - ], + ] + ], + [ [ - "EmptyListPattern", + "WildcardPattern", [ "Reference", {}, @@ -66844,126 +71439,38 @@ ] ] ] - ] - ], - [ - "Literal", - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "string" - ] - ], - [ - "string" - ] - ], - [] ], [ - "StringLiteral", - "Not a list of one element" - ] - ] - ], - [ - [ - "WildcardPattern", - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "list" - ] - ], - [ - "list" - ] - ], + "Literal", [ + "Reference", + {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] + "morphir" ], [ - "int" + "s", + "d", + "k" ] ], - [] - ] - ] - ] - ], - [ - "Literal", - [ - "Reference", - {}, - [ - [ [ - "morphir" + [ + "string" + ] ], - [ - "s", - "d", - "k" - ] - ], - [ [ "string" ] ], - [ - "string" - ] + [] ], - [] - ], - [ - "StringLiteral", - "Correct" + [ + "StringLiteral", + "Correct" + ] ] ] ] @@ -67363,11 +71870,73 @@ "match" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Reference", + {}, [ - "x" + [ + [ + "morphir" + ], + [ + "examples" + ], + [ + "app" + ] + ], + [ + [ + "pattern", + "match", + "tests" + ] + ], + [ + "pattern", + "match", + "union", + "test", + "type" + ] ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -67409,85 +71978,25 @@ "morphir" ], [ - "examples" - ], - [ - "app" + "s", + "d", + "k" ] ], [ [ - "pattern", - "match", - "tests" + "string" ] ], [ - "pattern", - "match", - "union", - "test", - "type" + "string" ] ], [] ] - ] - ], - "outputType": [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "string" - ] - ], - [ - "string" - ] - ], - [] - ], - "body": [ - "PatternMatch", - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "string" - ] - ], - [ - "string" - ] - ], - [] ], [ - "Variable", + "AsPattern", [ "Reference", {}, @@ -67521,45 +72030,76 @@ [] ], [ - "x" - ] - ], - [ - [ + "WildcardPattern", [ - "ConstructorPattern", + "Reference", + {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "examples" - ], - [ - "app" - ] + "morphir" ], [ - [ - "pattern", - "match", - "tests" - ] + "examples" ], + [ + "app" + ] + ], + [ [ "pattern", "match", - "union", - "test", - "type" + "tests" ] ], - [] + [ + "pattern", + "match", + "union", + "test", + "type" + ] + ], + [] + ] + ], + [ + "x" + ] + ], + [ + "PatternMatch", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] ], + [ + "string" + ] + ], + [] + ], + [ + "Variable", + [ + "Reference", + {}, [ [ [ @@ -67580,80 +72120,55 @@ ] ], [ - "one", - "arg" + "pattern", + "match", + "union", + "test", + "type" ] ], + [] + ], + [ + "x" + ] + ], + [ + [ [ + "ConstructorPattern", [ - "WildcardPattern", + "Reference", + {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "basics" - ] + "examples" ], [ - "int" + "app" ] ], - [] - ] - ] - ] - ], - [ - "Literal", - [ - "Reference", - {}, - [ - [ [ - "morphir" + [ + "pattern", + "match", + "tests" + ] ], [ - "s", - "d", - "k" - ] - ], - [ - [ - "string" + "pattern", + "match", + "union", + "test", + "type" ] ], - [ - "string" - ] + [] ], - [] - ], - [ - "StringLiteral", - "Not a OneArg" - ] - ] - ], - [ - [ - "ConstructorPattern", - [ - "Reference", - {}, [ [ [ @@ -67674,137 +72189,109 @@ ] ], [ - "pattern", - "match", - "union", - "test", - "type" - ] - ], - [] - ], - [ - [ - [ - "morphir" - ], - [ - "examples" - ], - [ - "app" + "one", + "arg" ] ], [ [ - "pattern", - "match", - "tests" - ] - ], - [ - "two", - "arg" - ] - ], - [ - [ - "WildcardPattern", - [ - "Reference", - {}, + "WildcardPattern", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "int" ] ], - [ - "int" - ] - ], - [] + [] + ] ] - ], + ] + ], + [ + "Literal", [ - "WildcardPattern", + "Reference", + {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "string" - ] - ], + "s", + "d", + "k" + ] + ], + [ [ "string" ] ], - [] - ] + [ + "string" + ] + ], + [] + ], + [ + "StringLiteral", + "Not a OneArg" ] ] ], [ - "Literal", [ - "Reference", - {}, + "ConstructorPattern", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "examples" + ], + [ + "app" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "pattern", + "match", + "tests" + ] + ], [ - "string" + "pattern", + "match", + "union", + "test", + "type" ] ], - [ - "string" - ] + [] ], - [] - ], - [ - "StringLiteral", - "Not a TwoArg" - ] - ] - ], - [ - [ - "ConstructorPattern", - [ - "Reference", - {}, [ [ [ @@ -67825,80 +72312,137 @@ ] ], [ - "pattern", - "match", - "union", - "test", - "type" + "two", + "arg" ] ], - [] - ], - [ [ [ - "morphir" - ], - [ - "examples" + "WildcardPattern", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] ], [ - "app" + "WildcardPattern", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ] ] - ], + ] + ], + [ + "Literal", [ + "Reference", + {}, [ - "pattern", - "match", - "tests" - ] + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] ], [ - "zero", - "arg" + "StringLiteral", + "Not a TwoArg" ] - ], - [] + ] ], [ - "Literal", [ - "Reference", - {}, + "ConstructorPattern", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "examples" + ], + [ + "app" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "pattern", + "match", + "tests" + ] + ], [ - "string" + "pattern", + "match", + "union", + "test", + "type" ] ], - [ - "string" - ] + [] ], - [] - ], - [ - "StringLiteral", - "Correct" - ] - ] - ], - [ - [ - "WildcardPattern", - [ - "Reference", - {}, [ [ [ @@ -67919,46 +72463,112 @@ ] ], [ - "pattern", - "match", - "union", - "test", - "type" + "zero", + "arg" ] ], [] + ], + [ + "Literal", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ], + [ + "StringLiteral", + "Correct" + ] ] ], [ - "Literal", [ - "Reference", - {}, + "WildcardPattern", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "examples" + ], + [ + "app" + ] ], [ - "s", - "d", - "k" + [ + "pattern", + "match", + "tests" + ] + ], + [ + "pattern", + "match", + "union", + "test", + "type" ] ], + [] + ] + ], + [ + "Literal", + [ + "Reference", + {}, [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], [ "string" ] ], - [ - "string" - ] + [] ], - [] - ], - [ - "StringLiteral", - "An earlier item should have matched" + [ + "StringLiteral", + "An earlier item should have matched" + ] ] ] ] @@ -74865,11 +79475,32 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" - ], + "t", + "0" + ] + ], + [ + "Variable", + {}, + [ + "t", + "2" + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -74896,80 +79527,60 @@ [] ], [ - "Variable", + "Reference", {}, - [ - "t", - "0" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "3" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "float" ] ], - [ - "float" - ] - ], - [] + [] + ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "basics" - ] - ], + "s", + "d", + "k" + ] + ], + [ [ - "float" + "basics" ] ], - [] + [ + "float" + ] ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -74997,31 +79608,92 @@ ] ], [ + "x" + ] + ], + [ + "Apply", + [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "basics" + ] + ], + [ + "float" ] ], + [] + ], + [ + "Reference", [ + "Function", + {}, [ - "basics" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] ] ], - [ - "acos" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, [ [ [ @@ -75039,13 +79711,40 @@ ] ], [ - "float" + "acos" ] - ], - [] + ] ], [ - "x" + "Variable", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "x" + ] ] ] ] @@ -75518,11 +80217,32 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" - ], + "t", + "0" + ] + ], + [ + "Variable", + {}, + [ + "t", + "2" + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -75549,80 +80269,60 @@ [] ], [ - "Variable", + "Reference", {}, - [ - "t", - "0" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "3" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "float" ] ], - [ - "float" - ] - ], - [] + [] + ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "basics" - ] - ], + "s", + "d", + "k" + ] + ], + [ [ - "float" + "basics" ] ], - [] + [ + "float" + ] ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -75650,31 +80350,92 @@ ] ], [ + "x" + ] + ], + [ + "Apply", + [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "basics" + ] + ], + [ + "float" ] ], + [] + ], + [ + "Reference", [ + "Function", + {}, [ - "basics" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] ] ], - [ - "asin" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, [ [ [ @@ -75692,13 +80453,40 @@ ] ], [ - "float" + "asin" ] - ], - [] + ] ], [ - "x" + "Variable", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "x" + ] ] ] ] @@ -76172,11 +80960,44 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" + "t", + "0" + ] + ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "1" + ] ], + [ + "Variable", + {}, + [ + "t", + "4" + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -76203,18 +81024,62 @@ [] ], [ - "Variable", + "Function", {}, [ - "t", - "0" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] ] ] ], [ - [ - "y" - ], + "AsPattern", [ "Reference", {}, @@ -76241,52 +81106,39 @@ [] ], [ - "Variable", - {}, - [ - "t", - "1" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "6" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ + "WildcardPattern", [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "float" + [] ] ], - [] + [ + "x" + ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -76342,10 +81194,34 @@ ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -76370,7 +81246,41 @@ ] ], [] + ] + ], + [ + "y" + ] + ], + [ + "Apply", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] ], + [] + ], + [ + "Apply", [ "Function", {}, @@ -76424,91 +81334,177 @@ ], [] ] - ] - ], - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] ], [ + "Reference", [ - "basics" - ] - ], - [ - "atan", - "2" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ - [ + "Function", + {}, [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] ], [ - "s", - "d", - "k" + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ] ] ], [ [ - "basics" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "atan", + "2" ] - ], - [ - "float" ] ], - [] - ], - [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ [ + "Variable", [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] ], [ - "s", - "d", - "k" + "x" ] - ], + ] + ], + [ + "Variable", [ + "Reference", + {}, [ - "basics" - ] + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] ], [ - "float" + "y" ] - ], - [] - ], - [ - "y" + ] ] ] ] @@ -76876,11 +81872,32 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" - ], + "t", + "0" + ] + ], + [ + "Variable", + {}, + [ + "t", + "2" + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -76907,80 +81924,60 @@ [] ], [ - "Variable", + "Reference", {}, - [ - "t", - "0" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "3" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "float" ] ], - [ - "float" - ] - ], - [] + [] + ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "basics" - ] - ], + "s", + "d", + "k" + ] + ], + [ [ - "float" + "basics" ] ], - [] + [ + "float" + ] ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -77008,31 +82005,92 @@ ] ], [ + "x" + ] + ], + [ + "Apply", + [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "basics" + ] + ], + [ + "float" ] ], + [] + ], + [ + "Reference", [ + "Function", + {}, [ - "basics" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] ] ], - [ - "atan" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, [ [ [ @@ -77050,13 +82108,40 @@ ] ], [ - "float" + "atan" ] - ], - [] + ] ], [ - "x" + "Variable", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "x" + ] ] ] ] @@ -77305,11 +82390,32 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" - ], + "t", + "0" + ] + ], + [ + "Variable", + {}, + [ + "t", + "2" + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -77336,80 +82442,60 @@ [] ], [ - "Variable", + "Reference", {}, - [ - "t", - "0" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "3" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "int" ] ], - [ - "int" - ] - ], - [] + [] + ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "basics" - ] - ], + "s", + "d", + "k" + ] + ], + [ [ - "int" + "basics" ] ], - [] + [ + "int" + ] ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -77437,31 +82523,92 @@ ] ], [ + "x" + ] + ], + [ + "Apply", + [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "basics" + ] + ], + [ + "int" ] ], + [] + ], + [ + "Reference", [ + "Function", + {}, [ - "basics" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ] ], - [ - "abs" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, [ [ [ @@ -77475,17 +82622,44 @@ ], [ [ - "basics" + "basics" + ] + ], + [ + "abs" + ] + ] + ], + [ + "Variable", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" ] ], - [ - "int" - ] + [] ], - [] - ], - [ - "x" + [ + "x" + ] ] ] ] @@ -77840,11 +83014,32 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" - ], + "t", + "0" + ] + ], + [ + "Variable", + {}, + [ + "t", + "2" + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -77871,80 +83066,60 @@ [] ], [ - "Variable", + "Reference", {}, - [ - "t", - "0" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "3" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "int" ] ], - [ - "int" - ] - ], - [] + [] + ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "basics" - ] - ], + "s", + "d", + "k" + ] + ], + [ [ - "int" + "basics" ] ], - [] + [ + "int" + ] ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -77972,31 +83147,92 @@ ] ], [ + "x" + ] + ], + [ + "Apply", + [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "basics" + ] + ], + [ + "int" ] ], + [] + ], + [ + "Reference", [ + "Function", + {}, [ - "basics" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ] ], - [ - "abs" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, [ [ [ @@ -78014,13 +83250,40 @@ ] ], [ - "int" + "abs" ] - ], - [] + ] ], [ - "x" + "Variable", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "x" + ] ] ] ] @@ -78270,11 +83533,44 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "0" + ] + ], [ + "Function", + {}, [ - "x" + "Variable", + {}, + [ + "t", + "1" + ] ], + [ + "Variable", + {}, + [ + "t", + "4" + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -78301,18 +83597,62 @@ [] ], [ - "Variable", + "Function", {}, [ - "t", - "0" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] ] ] ], [ - [ - "y" - ], + "AsPattern", [ "Reference", {}, @@ -78339,52 +83679,39 @@ [] ], [ - "Variable", - {}, - [ - "t", - "1" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "6" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ + "WildcardPattern", [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "float" + [] ] ], - [] + [ + "x" + ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -78440,10 +83767,34 @@ ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -78468,7 +83819,41 @@ ] ], [] + ] + ], + [ + "y" + ] + ], + [ + "Apply", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] ], + [] + ], + [ + "Apply", [ "Function", {}, @@ -78522,90 +83907,176 @@ ], [] ] - ] - ], - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] ], [ + "Reference", [ - "basics" - ] - ], - [ - "add" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ - [ + "Function", + {}, [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] ], [ - "s", - "d", - "k" + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ] ] ], [ [ - "basics" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "add" ] - ], - [ - "float" ] ], - [] - ], - [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ [ + "Variable", [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] ], [ - "s", - "d", - "k" + "x" ] - ], + ] + ], + [ + "Variable", [ + "Reference", + {}, [ - "basics" - ] + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] ], [ - "float" + "y" ] - ], - [] - ], - [ - "y" + ] ] ] ] @@ -78972,11 +84443,44 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" + "t", + "0" + ] + ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "1" + ] ], + [ + "Variable", + {}, + [ + "t", + "4" + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -79003,18 +84507,62 @@ [] ], [ - "Variable", + "Function", {}, [ - "t", - "0" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ] ] ], [ - [ - "y" - ], + "AsPattern", [ "Reference", {}, @@ -79041,52 +84589,39 @@ [] ], [ - "Variable", - {}, - [ - "t", - "1" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "6" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ + "WildcardPattern", [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "int" + [] ] ], - [] + [ + "x" + ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -79142,10 +84677,34 @@ ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -79170,7 +84729,41 @@ ] ], [] + ] + ], + [ + "y" + ] + ], + [ + "Apply", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] ], + [] + ], + [ + "Apply", [ "Function", {}, @@ -79223,91 +84816,177 @@ ] ], [] - ] - ] - ], - [ - [ - [ - "morphir" + ] + ], + [ + "Reference", + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ] + ], + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "add" + ] + ] + ], + [ + "Variable", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ], [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" + "x" ] - ], - [ - "add" ] - ] - ], - [ - "Variable", + ], [ - "Reference", - {}, + "Variable", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "int" ] ], - [ - "int" - ] - ], - [] - ], - [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] + [] ], [ - "int" + "y" ] - ], - [] - ], - [ - "y" + ] ] ] ] @@ -79769,11 +85448,44 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" + "t", + "0" + ] + ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "1" + ] ], + [ + "Variable", + {}, + [ + "t", + "4" + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -79801,18 +85513,64 @@ [] ], [ - "Variable", + "Function", {}, [ - "t", - "0" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "int" + ] + ], + [ + "int", + "64" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "int" + ] + ], + [ + "int", + "64" + ] + ], + [] ] ] ], [ - [ - "y" - ], + "AsPattern", [ "Reference", {}, @@ -79840,53 +85598,40 @@ [] ], [ - "Variable", - {}, - [ - "t", - "1" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "6" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ + "WildcardPattern", [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "int" + ] + ], + [ + "int", + "64" + ] ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "int" - ] - ], - [ - "int", - "64" + [] ] ], - [] + [ + "x" + ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -79915,7 +85660,36 @@ ] ], [] - ], + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "int" + ] + ], + [ + "int", + "64" + ] + ], + [] + ] + ], + [ + "AsPattern", [ "Reference", {}, @@ -79941,13 +85715,9 @@ ] ], [] - ] - ], - [ - "Reference", + ], [ - "Function", - {}, + "WildcardPattern", [ "Reference", {}, @@ -79973,7 +85743,42 @@ ] ], [] + ] + ], + [ + "y" + ] + ], + [ + "Apply", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "int" + ] + ], + [ + "int", + "64" + ] ], + [] + ], + [ + "Apply", [ "Function", {}, @@ -80029,92 +85834,181 @@ ], [] ] - ] - ], - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] ], [ - "add" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ + "Reference", [ + "Function", + {}, [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "int" + ] + ], + [ + "int", + "64" + ] + ], + [] ], [ - "s", - "d", - "k" + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "int" + ] + ], + [ + "int", + "64" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "int" + ] + ], + [ + "int", + "64" + ] + ], + [] + ] ] ], [ [ - "int" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "add" ] - ], - [ - "int", - "64" ] ], - [] - ], - [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ [ + "Variable", [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "int" + ] + ], + [ + "int", + "64" + ] + ], + [] ], [ - "s", - "d", - "k" + "x" ] - ], + ] + ], + [ + "Variable", [ + "Reference", + {}, [ - "int" - ] + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "int" + ] + ], + [ + "int", + "64" + ] + ], + [] ], [ - "int", - "64" + "y" ] - ], - [] - ], - [ - "y" + ] ] ] ] @@ -80713,11 +86607,32 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" - ], + "t", + "0" + ] + ], + [ + "Variable", + {}, + [ + "t", + "6" + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -80770,132 +86685,112 @@ ] ], [ - "Variable", + "Reference", {}, - [ - "t", - "0" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "7" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "list" + ] + ], [ "list" ] ], [ - "list" - ] - ], - [ - [ - "Reference", - {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "char" + ] + ], [ "char" ] ], - [ - "char" - ] - ], - [] + [] + ] ] ] ], [ - "Apply", + "AsPattern", [ - "Function", + "Reference", {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "list" - ] - ], + "s", + "d", + "k" + ] + ], + [ [ "list" ] ], [ + "list" + ] + ], + [ + [ + "Reference", + {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "char" - ] - ], + "s", + "d", + "k" + ] + ], + [ [ "char" ] ], - [] - ] + [ + "char" + ] + ], + [] ] - ], + ] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -80948,254 +86843,388 @@ ] ] ], + [ + "x" + ] + ], + [ + "Apply", [ "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "char" + ] + ], + [ + "char" + ] + ], + [] + ] + ] + ], + [ + "Apply", [ "Function", {}, [ - "Function", + "Reference", {}, [ - "Reference", - {}, [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "char" + ] + ], [ "char" ] ], + [] + ] + ] + ], + [ + "Reference", + {}, + [ + [ [ - "char" + "morphir" + ], + [ + "s", + "d", + "k" ] ], - [] + [ + [ + "list" + ] + ], + [ + "list" + ] ], [ - "Reference", - {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "char" + ] + ], [ "char" ] ], - [ - "char" - ] - ], - [] + [] + ] ] - ], + ] + ], + [ + "Reference", [ "Function", {}, [ - "Reference", + "Function", {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "char" + ] + ], [ - "list" + "char" ] ], - [ - "list" - ] + [] ], [ + "Reference", + {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "char" - ] - ], + "s", + "d", + "k" + ] + ], + [ [ "char" ] ], - [] - ] + [ + "char" + ] + ], + [] ] ], [ - "Reference", + "Function", {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "list" + ] + ], [ "list" ] ], [ - "list" + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "char" + ] + ], + [ + "char" + ] + ], + [] + ] ] ], [ + "Reference", + {}, [ - "Reference", - {}, [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "char" + ] + ], [ "char" ] ], - [ - "char" - ] - ], - [] + [] + ] ] ] ] - ] - ], - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "list" - ] ], [ - "map" - ] - ] - ], - [ - "Apply", - [ - "Function", - {}, - [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "char" - ] - ], + "s", + "d", + "k" + ] + ], + [ [ - "char" + "list" ] ], - [] - ], + [ + "map" + ] + ] + ], + [ + "Apply", [ - "Reference", + "Function", {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "char" + ] + ], [ "char" ] ], - [ - "char" - ] + [] ], - [] - ] - ], - [ - "Reference", - [ - "Function", - {}, [ "Reference", {}, @@ -81220,7 +87249,10 @@ ] ], [] - ], + ] + ], + [ + "Reference", [ "Function", {}, @@ -81250,58 +87282,60 @@ [] ], [ - "Reference", + "Function", {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "char" + ] + ], + [ + "char" ] ], + [] + ], + [ + "Reference", + {}, [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "char" + ] + ], [ "char" ] ], - [ - "char" - ] - ], - [] - ] - ] - ], - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" + [] + ] ] ], - [ - "always" - ] - ] - ], - [ - "Literal", - [ - "Reference", - {}, [ [ [ @@ -81315,77 +87349,104 @@ ], [ [ - "char" + "basics" ] ], [ - "char" + "always" ] - ], - [] + ] ], [ - "CharLiteral", - "a" + "Literal", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "char" + ] + ], + [ + "char" + ] + ], + [] + ], + [ + "CharLiteral", + "a" + ] ] ] - ] - ], - [ - "Variable", + ], [ - "Reference", - {}, + "Variable", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "list" + ] + ], [ "list" ] ], [ - "list" - ] - ], - [ - [ - "Reference", - {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "char" + ] + ], [ "char" ] ], - [ - "char" - ] - ], - [] + [] + ] ] + ], + [ + "x" ] - ], - [ - "x" ] ] ] @@ -81847,11 +87908,32 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" - ], + "t", + "0" + ] + ], + [ + "Variable", + {}, + [ + "t", + "6" + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -81904,81 +87986,112 @@ ] ], [ - "Variable", + "Reference", {}, [ - "t", - "0" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ] ] ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "7" - ] - ], - "body": [ - "Apply", + ], [ - "Reference", - {}, + "AsPattern", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "list" + ] + ], [ "list" ] ], [ - "list" - ] - ], - [ - [ - "Reference", - {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "float" ] ], - [ - "float" - ] - ], - [] + [] + ] ] - ] - ], - [ - "Apply", + ], [ - "Function", - {}, + "WildcardPattern", [ "Reference", {}, @@ -82029,64 +88142,362 @@ [] ] ] + ] + ], + [ + "x" + ] + ], + [ + "Apply", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] ], [ - "Reference", - {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "basics" + ] + ], + [ + "float" ] ], + [] + ] + ] + ], + [ + "Apply", + [ + "Function", + {}, + [ + "Reference", + {}, [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], [ "list" ] ], [ - "list" + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ] ] ], [ + "Reference", + {}, [ - "Reference", + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ] + ] + ] + ], + [ + "Reference", + [ + "Function", + {}, + [ + "Function", {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "basics" + ] + ], + [ + "float" ] ], + [] + ], + [ + "Reference", + {}, [ [ - "basics" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" ] ], + [] + ] + ], + [ + "Function", + {}, + [ + "Reference", + {}, [ - "float" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ] ] ], - [] + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ] + ] + ] + ] + ], + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "map" ] ] - ] - ], - [ - "Reference", + ], [ - "Function", - {}, + "Apply", [ "Function", {}, @@ -82142,32 +88553,38 @@ ] ], [ - "Function", - {}, + "Reference", [ - "Reference", + "Function", {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "list" + "float" ] ], - [ - "list" - ] + [] ], [ + "Function", + {}, [ "Reference", {}, @@ -82192,33 +88609,7 @@ ] ], [] - ] - ] - ], - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] ], - [ - [ - "list" - ] - ], - [ - "list" - ] - ], - [ [ "Reference", {}, @@ -82245,38 +88636,7 @@ [] ] ] - ] - ] - ], - [ - [ - [ - "morphir" ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "list" - ] - ], - [ - "map" - ] - ] - ], - [ - "Apply", - [ - "Function", - {}, - [ - "Reference", - {}, [ [ [ @@ -82294,42 +88654,12 @@ ] ], [ - "float" + "always" ] - ], - [] + ] ], [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "float" - ] - ], - [] - ] - ], - [ - "Reference", - [ - "Function", - {}, + "Literal", [ "Reference", {}, @@ -82356,60 +88686,17 @@ [] ], [ - "Function", - {}, - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "float" - ] - ], - [] - ], - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "float" - ] - ], - [] - ] + "FloatLiteral", + 0 ] - ], + ] + ] + ], + [ + "Variable", + [ + "Reference", + {}, [ [ [ @@ -82423,103 +88710,44 @@ ], [ [ - "basics" + "list" ] ], [ - "always" + "list" ] - ] - ], - [ - "Literal", + ], [ - "Reference", - {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "float" ] ], - [ - "float" - ] - ], - [] - ], - [ - "FloatLiteral", - 0 - ] - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "list" + [] ] - ], - [ - "list" ] ], [ - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "float" - ] - ], - [] - ] + "x" ] - ], - [ - "x" ] ] ] @@ -82981,11 +89209,32 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" - ], + "t", + "0" + ] + ], + [ + "Variable", + {}, + [ + "t", + "6" + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -83021,49 +89270,95 @@ ] ], [ - "Variable", + "Reference", {}, [ - "t", - "0" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] ] ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "7" - ] - ], - "body": [ - "Apply", + ], [ - "Reference", - {}, + "AsPattern", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "list" + ] + ], [ "list" ] ], [ - "list" + [ + "Variable", + {}, + [ + "t", + "7" + ] + ] ] ], [ + "WildcardPattern", [ "Reference", {}, @@ -83080,113 +89375,328 @@ ], [ [ - "basics" + "list" ] ], [ - "int" + "list" ] ], - [] + [ + [ + "Variable", + {}, + [ + "t", + "7" + ] + ] + ] ] + ], + [ + "x" ] ], [ "Apply", [ - "Function", + "Reference", {}, [ - "Reference", + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ] + ], + [ + "Apply", + [ + "Function", {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "list" + ] + ], + [ + "list" ] ], [ + [ + "Variable", + {}, + [ + "t", + "7" + ] + ] + ] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], [ "list" ] ], [ - "list" - ] - ], - [ - [ - "Variable", - {}, [ - "t", - "7" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ] ] ] ], [ "Reference", - {}, [ + "Function", + {}, [ + "Function", + {}, [ - "morphir" + "Variable", + {}, + [ + "t", + "7" + ] ], [ - "s", - "d", - "k" - ] - ], - [ - [ - "list" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ] ], [ - "list" - ] - ], - [ - [ - "Reference", + "Function", {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "list" + ] + ], + [ + "list" ] ], [ [ - "basics" + "Variable", + {}, + [ + "t", + "7" + ] + ] + ] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" ] ], [ - "int" + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] ] + ] + ] + ], + [ + [ + [ + "morphir" ], - [] + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "map" ] ] - ] - ], - [ - "Reference", + ], [ - "Function", - {}, + "Apply", [ "Function", {}, @@ -83225,32 +89735,38 @@ ] ], [ - "Function", - {}, + "Reference", [ - "Reference", + "Function", {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "list" + "int" ] ], - [ - "list" - ] + [] ], [ + "Function", + {}, [ "Variable", {}, @@ -83258,33 +89774,7 @@ "t", "7" ] - ] - ] - ], - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "list" - ] ], - [ - "list" - ] - ], - [ [ "Reference", {}, @@ -83311,46 +89801,7 @@ [] ] ] - ] - ] - ], - [ - [ - [ - "morphir" ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "list" - ] - ], - [ - "map" - ] - ] - ], - [ - "Apply", - [ - "Function", - {}, - [ - "Variable", - {}, - [ - "t", - "7" - ] - ], - [ - "Reference", - {}, [ [ [ @@ -83368,17 +89819,12 @@ ] ], [ - "int" + "always" ] - ], - [] - ] - ], - [ - "Reference", + ] + ], [ - "Function", - {}, + "Literal", [ "Reference", {}, @@ -83405,43 +89851,17 @@ [] ], [ - "Function", - {}, - [ - "Variable", - {}, - [ - "t", - "7" - ] - ], - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "int" - ] - ], - [] - ] + "WholeNumberLiteral", + 0 ] - ], + ] + ] + ], + [ + "Variable", + [ + "Reference", + {}, [ [ [ @@ -83455,86 +89875,27 @@ ], [ [ - "basics" + "list" ] ], [ - "always" + "list" ] - ] - ], - [ - "Literal", + ], [ - "Reference", - {}, [ + "Variable", + {}, [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "int" + "t", + "7" ] - ], - [] - ], - [ - "WholeNumberLiteral", - 0 - ] - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "list" ] - ], - [ - "list" ] ], [ - [ - "Variable", - {}, - [ - "t", - "7" - ] - ] + "x" ] - ], - [ - "x" ] ] ] @@ -83945,11 +90306,32 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" - ], + "t", + "0" + ] + ], + [ + "Variable", + {}, + [ + "t", + "6" + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -84002,81 +90384,112 @@ ] ], [ - "Variable", + "Reference", {}, [ - "t", - "0" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ] ] ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "7" - ] - ], - "body": [ - "Apply", + ], [ - "Reference", - {}, + "AsPattern", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "list" + ] + ], [ "list" ] ], [ - "list" - ] - ], - [ - [ - "Reference", - {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "string" + ] + ], [ "string" ] ], - [ - "string" - ] - ], - [] + [] + ] ] - ] - ], - [ - "Apply", + ], [ - "Function", - {}, + "WildcardPattern", [ "Reference", {}, @@ -84127,64 +90540,362 @@ [] ] ] + ] + ], + [ + "x" + ] + ], + [ + "Apply", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] ], [ - "Reference", - {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "string" + ] + ], + [ + "string" ] ], + [] + ] + ] + ], + [ + "Apply", + [ + "Function", + {}, + [ + "Reference", + {}, [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], [ "list" ] ], [ - "list" + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ] ] ], [ + "Reference", + {}, [ - "Reference", + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ] + ] + ] + ], + [ + "Reference", + [ + "Function", + {}, + [ + "Function", {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "string" + ] + ], + [ + "string" ] ], + [] + ], + [ + "Reference", + {}, [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], [ "string" ] ], + [] + ] + ], + [ + "Function", + {}, + [ + "Reference", + {}, [ - "string" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ] ] ], - [] + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ] + ] + ] + ] + ], + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "map" ] ] - ] - ], - [ - "Reference", + ], [ - "Function", - {}, + "Apply", [ "Function", {}, @@ -84240,32 +90951,38 @@ ] ], [ - "Function", - {}, + "Reference", [ - "Reference", + "Function", {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "string" + ] + ], [ - "list" + "string" ] ], - [ - "list" - ] + [] ], [ + "Function", + {}, [ "Reference", {}, @@ -84290,33 +91007,7 @@ ] ], [] - ] - ] - ], - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "list" - ] ], - [ - "list" - ] - ], - [ [ "Reference", {}, @@ -84343,63 +91034,7 @@ [] ] ] - ] - ] - ], - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "list" - ] - ], - [ - "map" - ] - ] - ], - [ - "Apply", - [ - "Function", - {}, - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "string" - ] - ], - [ - "string" - ] ], - [] - ], - [ - "Reference", - {}, [ [ [ @@ -84413,21 +91048,16 @@ ], [ [ - "string" + "basics" ] ], [ - "string" + "always" ] - ], - [] - ] - ], - [ - "Reference", + ] + ], [ - "Function", - {}, + "Literal", [ "Reference", {}, @@ -84454,60 +91084,17 @@ [] ], [ - "Function", - {}, - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "string" - ] - ], - [ - "string" - ] - ], - [] - ], - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "string" - ] - ], - [ - "string" - ] - ], - [] - ] + "StringLiteral", + "A" ] - ], + ] + ] + ], + [ + "Variable", + [ + "Reference", + {}, [ [ [ @@ -84521,103 +91108,44 @@ ], [ [ - "basics" + "list" ] ], [ - "always" + "list" ] - ] - ], - [ - "Literal", + ], [ - "Reference", - {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "string" + ] + ], [ "string" ] ], - [ - "string" - ] - ], - [] - ], - [ - "StringLiteral", - "A" - ] - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "list" + [] ] - ], - [ - "list" ] ], [ - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "string" - ] - ], - [ - "string" - ] - ], - [] - ] + "x" ] - ], - [ - "x" ] ] ] @@ -85000,11 +91528,44 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" + "t", + "0" + ] + ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "1" + ] ], + [ + "Variable", + {}, + [ + "t", + "4" + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -85031,18 +91592,62 @@ [] ], [ - "Variable", + "Function", {}, [ - "t", - "0" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] ] ] ], [ - [ - "y" - ], + "AsPattern", [ "Reference", {}, @@ -85069,52 +91674,39 @@ [] ], [ - "Variable", - {}, - [ - "t", - "1" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "6" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ + "WildcardPattern", [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "bool" + [] ] ], - [] + [ + "x" + ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -85170,10 +91762,34 @@ ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -85198,7 +91814,41 @@ ] ], [] + ] + ], + [ + "y" + ] + ], + [ + "Apply", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] ], + [] + ], + [ + "Apply", [ "Function", {}, @@ -85252,90 +91902,176 @@ ], [] ] - ] - ], - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] ], [ + "Reference", [ - "basics" - ] - ], - [ - "and" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ - [ + "Function", + {}, [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] ], [ - "s", - "d", - "k" + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ] ] ], [ [ - "basics" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "and" ] - ], - [ - "bool" ] ], - [] - ], - [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ [ + "Variable", [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] ], [ - "s", - "d", - "k" + "x" ] - ], + ] + ], + [ + "Variable", [ + "Reference", + {}, [ - "basics" - ] + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] ], [ - "bool" + "y" ] - ], - [] - ], - [ - "y" + ] ] ] ] @@ -85727,11 +92463,44 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "0" + ] + ], [ + "Function", + {}, [ - "x" + "Variable", + {}, + [ + "t", + "1" + ] ], + [ + "Variable", + {}, + [ + "t", + "4" + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -85766,18 +92535,78 @@ ] ], [ - "Variable", + "Function", {}, [ - "t", - "0" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Variable", + {}, + [ + "number" + ] + ] + ] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Variable", + {}, + [ + "number" + ] + ] + ] ] ] ], [ - [ - "y" - ], + "AsPattern", [ "Reference", {}, @@ -85812,60 +92641,47 @@ ] ], [ - "Variable", - {}, - [ - "t", - "1" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "6" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ + "WildcardPattern", [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] ], [ - "s", - "d", - "k" - ] - ], - [ - [ - "list" + [ + "Variable", + {}, + [ + "number" + ] + ] ] - ], - [ - "list" ] ], [ - [ - "Variable", - {}, - [ - "number" - ] - ] + "x" ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -85937,10 +92753,42 @@ ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Variable", + {}, + [ + "number" + ] + ] + ] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -85973,7 +92821,49 @@ ] ] ] + ] + ], + [ + "y" + ] + ], + [ + "Apply", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] ], + [ + [ + "Variable", + {}, + [ + "number" + ] + ] + ] + ], + [ + "Apply", [ "Function", {}, @@ -86042,107 +92932,217 @@ ] ] ] - ] - ] - ], - [ - [ - [ - "morphir" + ] + ], + [ + "Reference", + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Variable", + {}, + [ + "number" + ] + ] + ] + ], + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Variable", + {}, + [ + "number" + ] + ] + ] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Variable", + {}, + [ + "number" + ] + ] + ] + ] + ] + ], + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "append" + ] + ] + ], + [ + "Variable", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Variable", + {}, + [ + "number" + ] + ] + ] ], [ - "s", - "d", - "k" - ] - ], - [ - [ - "list" + "x" ] - ], - [ - "append" ] - ] - ], - [ - "Variable", + ], [ - "Reference", - {}, + "Variable", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "list" + ] + ], [ "list" ] ], [ - "list" - ] - ], - [ - [ - "Variable", - {}, [ - "number" + "Variable", + {}, + [ + "number" + ] ] ] - ] - ], - [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "list" - ] ], [ - "list" - ] - ], - [ - [ - "Variable", - {}, - [ - "number" - ] + "y" ] ] - ], - [ - "y" ] ] ] @@ -86626,11 +93626,44 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" + "t", + "0" + ] + ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "1" + ] ], + [ + "Variable", + {}, + [ + "t", + "4" + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -86657,18 +93690,62 @@ [] ], [ - "Variable", + "Function", {}, [ - "t", - "0" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] ] ] ], [ - [ - "y" - ], + "AsPattern", [ "Reference", {}, @@ -86695,52 +93772,39 @@ [] ], [ - "Variable", - {}, - [ - "t", - "1" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "6" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ + "WildcardPattern", [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "string" - ] - ], - [ - "string" + [] ] ], - [] + [ + "x" + ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -86796,10 +93860,34 @@ ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -86815,16 +93903,50 @@ ] ], [ - [ - "string" - ] - ], + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ] + ], + [ + "y" + ] + ], + [ + "Apply", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ [ "string" ] ], - [] + [ + "string" + ] ], + [] + ], + [ + "Apply", [ "Function", {}, @@ -86878,90 +94000,176 @@ ], [] ] - ] - ], - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "string" - ] ], [ - "append" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ + "Reference", [ + "Function", + {}, [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] ], [ - "s", - "d", - "k" + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ] ] ], [ [ - "string" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "append" ] - ], - [ - "string" ] ], - [] - ], - [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ [ + "Variable", [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] ], [ - "s", - "d", - "k" + "x" ] - ], + ] + ], + [ + "Variable", [ + "Reference", + {}, [ - "string" - ] + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] ], [ - "string" + "y" ] - ], - [] - ], - [ - "y" + ] ] ] ] @@ -87328,11 +94536,32 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" - ], + "t", + "0" + ] + ], + [ + "Variable", + {}, + [ + "t", + "2" + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -87359,80 +94588,60 @@ [] ], [ - "Variable", + "Reference", {}, - [ - "t", - "0" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "3" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "int" ] ], - [ - "int" - ] - ], - [] + [] + ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "basics" - ] - ], + "s", + "d", + "k" + ] + ], + [ [ - "float" + "basics" ] ], - [] + [ + "float" + ] ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -87453,38 +94662,99 @@ ] ], [ - "int" + "float" ] ], [] ] ], [ + "x" + ] + ], + [ + "Apply", + [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "basics" + ] + ], + [ + "int" ] ], + [] + ], + [ + "Reference", [ + "Function", + {}, [ - "basics" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ] ], - [ - "ceiling" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, [ [ [ @@ -87502,13 +94772,40 @@ ] ], [ - "float" + "ceiling" ] - ], - [] + ] ], [ - "x" + "Variable", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "x" + ] ] ] ] @@ -87758,11 +95055,32 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" - ], + "t", + "0" + ] + ], + [ + "Variable", + {}, + [ + "t", + "2" + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -87789,80 +95107,60 @@ [] ], [ - "Variable", + "Reference", {}, - [ - "t", - "0" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "3" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "int" ] ], - [ - "int" - ] - ], - [] + [] + ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "basics" - ] - ], + "s", + "d", + "k" + ] + ], + [ [ - "float" + "basics" ] ], - [] + [ + "float" + ] ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -87883,38 +95181,99 @@ ] ], [ - "int" + "float" ] ], [] ] ], [ + "x" + ] + ], + [ + "Apply", + [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "basics" + ] + ], + [ + "int" ] ], + [] + ], + [ + "Reference", [ + "Function", + {}, [ - "basics" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ] ], - [ - "ceiling" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, [ [ [ @@ -87932,13 +95291,40 @@ ] ], [ - "float" + "ceiling" ] - ], - [] + ] ], [ - "x" + "Variable", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "x" + ] ] ] ] @@ -88187,11 +95573,56 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "0" + ] + ], [ + "Function", + {}, [ - "x" + "Variable", + {}, + [ + "t", + "1" + ] ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "2" + ] + ], + [ + "Variable", + {}, + [ + "t", + "6" + ] + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -88218,56 +95649,91 @@ [] ], [ - "Variable", - {}, - [ - "t", - "0" - ] - ] - ], - [ - [ - "y" - ], - [ - "Reference", + "Function", {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "basics" + ] + ], + [ + "int" ] ], + [] + ], + [ + "Function", + {}, [ + "Reference", + {}, [ - "basics" - ] + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ], [ - "int" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ] - ], - [] - ], - [ - "Variable", - {}, - [ - "t", - "1" ] ] ], [ - [ - "z" - ], + "AsPattern", [ "Reference", {}, @@ -88294,52 +95760,39 @@ [] ], [ - "Variable", - {}, - [ - "t", - "2" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "9" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ + "WildcardPattern", [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "int" + [] ] ], - [] + [ + "x" + ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -88368,6 +95821,63 @@ ], [] ], + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ] + ], + [ + "AsPattern", [ "Reference", {}, @@ -88392,10 +95902,41 @@ ] ], [] + ], + [ + "WildcardPattern", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ], + [ + "y" ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -88423,35 +95964,62 @@ ] ], [] - ], + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ], + [ + "AsPattern", [ - "Function", + "Reference", {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "basics" - ] - ], + "s", + "d", + "k" + ] + ], + [ [ - "int" + "basics" ] ], - [] + [ + "int" + ] ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -88477,38 +96045,40 @@ ], [] ] + ], + [ + "z" ] ], [ - "Reference", + "Apply", [ - "Function", + "Reference", {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "basics" - ] - ], + "s", + "d", + "k" + ] + ], + [ [ - "int" + "basics" ] ], - [] + [ + "int" + ] ], + [] + ], + [ + "Apply", [ "Function", {}, @@ -88537,6 +96107,34 @@ ], [] ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ], + [ + "Apply", [ "Function", {}, @@ -88565,6 +96163,198 @@ ], [] ], + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ] + ], + [ + "Reference", + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ] + ] + ], + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "clamp" + ] + ] + ], + [ + "Variable", [ "Reference", {}, @@ -88589,124 +96379,76 @@ ] ], [] + ], + [ + "x" ] ] - ] - ], - [ + ], [ + "Variable", [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ], [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" + "y" ] - ], - [ - "clamp" ] - ] - ], - [ - "Variable", + ], [ - "Reference", - {}, + "Variable", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "int" ] ], - [ - "int" - ] - ], - [] - ], - [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "int" - ] - ], - [] - ], - [ - "y" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ - [ - [ - "morphir" + [] ], [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" + "z" ] - ], - [ - "int" ] - ], - [] - ], - [ - "z" + ] ] ] ] @@ -89221,11 +96963,56 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" + "t", + "0" + ] + ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "1" + ] ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "2" + ] + ], + [ + "Variable", + {}, + [ + "t", + "6" + ] + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -89252,56 +97039,91 @@ [] ], [ - "Variable", - {}, - [ - "t", - "0" - ] - ] - ], - [ - [ - "y" - ], - [ - "Reference", + "Function", {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "basics" + ] + ], + [ + "int" ] ], + [] + ], + [ + "Function", + {}, [ + "Reference", + {}, [ - "basics" - ] + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ], [ - "int" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ] - ], - [] - ], - [ - "Variable", - {}, - [ - "t", - "1" ] ] ], [ - [ - "z" - ], + "AsPattern", [ "Reference", {}, @@ -89328,52 +97150,39 @@ [] ], [ - "Variable", - {}, - [ - "t", - "2" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "9" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ + "WildcardPattern", [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "int" + [] ] ], - [] + [ + "x" + ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -89402,6 +97211,63 @@ ], [] ], + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ] + ], + [ + "AsPattern", [ "Reference", {}, @@ -89426,10 +97292,41 @@ ] ], [] + ], + [ + "WildcardPattern", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ], + [ + "y" ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -89459,33 +97356,60 @@ [] ], [ - "Function", + "Reference", {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "basics" - ] + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ], + [ + "AsPattern", + [ + "Reference", + {}, + [ + [ + [ + "morphir" ], [ - "int" + "s", + "d", + "k" ] ], - [] + [ + [ + "basics" + ] + ], + [ + "int" + ] ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -89511,44 +97435,293 @@ ], [] ] + ], + [ + "z" ] ], [ - "Reference", + "Apply", [ - "Function", + "Reference", {}, [ - "Reference", + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Apply", + [ + "Function", {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "basics" + ] + ], + [ + "int" ] ], + [] + ], + [ + "Reference", + {}, [ [ - "basics" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ], + [ + "Apply", + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ] + ], + [ + "Reference", + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ] ] ], - [ - "int" - ] - ], - [] - ], - [ - "Function", - {}, - [ - "Reference", - {}, [ [ [ @@ -89566,14 +97739,12 @@ ] ], [ - "int" + "clamp" ] - ], - [] + ] ], [ - "Function", - {}, + "Variable", [ "Reference", {}, @@ -89600,147 +97771,74 @@ [] ], [ - "Reference", - {}, + "x" + ] + ] + ], + [ + "Variable", + [ + "Reference", + {}, + [ [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "basics" - ] - ], + "s", + "d", + "k" + ] + ], + [ [ - "int" + "basics" ] ], - [] - ] - ] - ] - ], - [ - [ - [ - "morphir" + [ + "int" + ] + ], + [] ], [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" + "y" ] - ], - [ - "clamp" ] - ] - ], - [ - "Variable", + ], [ - "Reference", - {}, + "Variable", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "int" ] ], - [ - "int" - ] - ], - [] - ], - [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "int" - ] - ], - [] - ], - [ - "y" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ - [ - [ - "morphir" + [] ], [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" + "z" ] - ], - [ - "int" ] - ], - [] - ], - [ - "z" + ] ] ] ] @@ -90255,11 +98353,56 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" + "t", + "0" + ] + ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "1" + ] ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "2" + ] + ], + [ + "Variable", + {}, + [ + "t", + "6" + ] + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -90286,56 +98429,91 @@ [] ], [ - "Variable", - {}, - [ - "t", - "0" - ] - ] - ], - [ - [ - "y" - ], - [ - "Reference", + "Function", {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "basics" + ] + ], + [ + "int" ] ], + [] + ], + [ + "Function", + {}, [ + "Reference", + {}, [ - "basics" - ] + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ], [ - "int" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ] - ], - [] - ], - [ - "Variable", - {}, - [ - "t", - "1" ] ] ], [ - [ - "z" - ], + "AsPattern", [ "Reference", {}, @@ -90362,52 +98540,39 @@ [] ], [ - "Variable", - {}, - [ - "t", - "2" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "9" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ + "WildcardPattern", [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "int" + [] ] ], - [] + [ + "x" + ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -90436,6 +98601,63 @@ ], [] ], + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ] + ], + [ + "AsPattern", [ "Reference", {}, @@ -90460,10 +98682,41 @@ ] ], [] + ], + [ + "WildcardPattern", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ], + [ + "y" ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -90493,33 +98746,60 @@ [] ], [ - "Function", + "Reference", {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "basics" - ] + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ], + [ + "AsPattern", + [ + "Reference", + {}, + [ + [ + [ + "morphir" ], [ - "int" + "s", + "d", + "k" ] ], - [] + [ + [ + "basics" + ] + ], + [ + "int" + ] ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -90545,38 +98825,40 @@ ], [] ] + ], + [ + "z" ] ], [ - "Reference", + "Apply", [ - "Function", + "Reference", {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "basics" - ] - ], + "s", + "d", + "k" + ] + ], + [ [ - "int" + "basics" ] ], - [] + [ + "int" + ] ], + [] + ], + [ + "Apply", [ "Function", {}, @@ -90605,6 +98887,34 @@ ], [] ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ], + [ + "Apply", [ "Function", {}, @@ -90633,6 +98943,198 @@ ], [] ], + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ] + ], + [ + "Reference", + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ] + ] + ], + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "clamp" + ] + ] + ], + [ + "Variable", [ "Reference", {}, @@ -90657,124 +99159,76 @@ ] ], [] + ], + [ + "x" ] ] - ] - ], - [ + ], [ + "Variable", [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ], [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" + "y" ] - ], - [ - "clamp" ] - ] - ], - [ - "Variable", + ], [ - "Reference", - {}, + "Variable", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "int" ] ], - [ - "int" - ] - ], - [] - ], - [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "int" - ] - ], - [] - ], - [ - "y" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ - [ - [ - "morphir" + [] ], [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" + "z" ] - ], - [ - "int" ] - ], - [] - ], - [ - "z" + ] ] ] ] @@ -91278,22 +99732,67 @@ [ "basics" ] - ], - [ - "bool" + ], + [ + "bool" + ] + ], + [] + ], + [ + "f" + ], + { + "inputTypes": [], + "outputType": [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "0" + ] + ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "1" + ] + ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "2" + ] + ], + [ + "Variable", + {}, + [ + "t", + "8" + ] + ] + ] ] ], - [] - ], - [ - "f" - ], - { - "inputTypes": [ + "body": [ + "Lambda", [ - [ - "x" - ], + "Function", + {}, [ "Function", {}, @@ -91348,86 +99847,179 @@ [] ] ], - [ - "Variable", - {}, - [ - "t", - "0" - ] - ] - ], - [ - [ - "y" - ], [ "Function", {}, [ - "Reference", + "Function", {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "basics" + ] + ], + [ + "bool" ] ], + [] + ], + [ + "Reference", + {}, [ [ - "basics" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" ] ], - [ - "bool" - ] - ], - [] + [] + ] ], [ - "Reference", + "Function", {}, [ + "Function", + {}, [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] ], - [ - "s", - "d", - "k" - ] + [] ], [ + "Reference", + {}, [ - "basics" - ] + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ] + ], + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] ], [ - "bool" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] ] - ], - [] - ] - ], - [ - "Variable", - {}, - [ - "t", - "1" + ] ] ] ], [ - [ - "z" - ], + "AsPattern", [ "Function", {}, @@ -91483,84 +100075,7 @@ ] ], [ - "Variable", - {}, - [ - "t", - "2" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "11" - ] - ], - "body": [ - "Apply", - [ - "Function", - {}, - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "bool" - ] - ], - [] - ], - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "bool" - ] - ], - [] - ] - ], - [ - "Apply", - [ - "Function", - {}, + "WildcardPattern", [ "Function", {}, @@ -91614,7 +100129,17 @@ ], [] ] - ], + ] + ], + [ + "x" + ] + ], + [ + "Lambda", + [ + "Function", + {}, [ "Function", {}, @@ -91668,10 +100193,7 @@ ], [] ] - ] - ], - [ - "Reference", + ], [ "Function", {}, @@ -91733,139 +100255,60 @@ "Function", {}, [ - "Function", + "Reference", {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] + "morphir" ], [ - "bool" + "s", + "d", + "k" ] ], - [] - ], - [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "bool" + "basics" ] ], - [] - ] + [ + "bool" + ] + ], + [] ], [ - "Function", + "Reference", {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] + "morphir" ], [ - "bool" + "s", + "d", + "k" ] ], - [] - ], - [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "bool" + "basics" ] ], - [] - ] - ] - ] - ], - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" + [ + "bool" + ] + ], + [] ] - ], - [ - "compose", - "left" ] ] ], [ - "Apply", + "AsPattern", [ "Function", {}, @@ -91921,10 +100364,238 @@ ] ], [ - "Apply", + "WildcardPattern", + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ] + ] + ], + [ + "y" + ] + ], + [ + "Lambda", + [ + "Function", + {}, + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ] + ], + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ] + ] + ], + [ + "AsPattern", [ "Function", {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ] + ], + [ + "WildcardPattern", [ "Function", {}, @@ -91978,67 +100649,378 @@ ], [] ] + ] + ], + [ + "z" + ] + ], + [ + "Apply", + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ] + ], + [ + "Apply", [ "Function", {}, [ - "Reference", + "Function", {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "basics" + ] + ], + [ + "bool" ] ], + [] + ], + [ + "Reference", + {}, [ [ - "basics" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" ] ], + [] + ] + ], + [ + "Function", + {}, + [ + "Reference", + {}, [ - "bool" - ] + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] ], - [] - ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ] + ] + ], + [ + "Reference", [ - "Reference", + "Function", {}, [ + "Function", + {}, [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] ], + [] + ], + [ + "Reference", + {}, [ - "s", - "d", - "k" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ] + ], + [ + "Function", + {}, + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] ] ], [ + "Function", + {}, [ - "basics" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] ] + ] + ] + ], + [ + [ + [ + "morphir" ], [ - "bool" + "s", + "d", + "k" ] ], - [] + [ + [ + "basics" + ] + ], + [ + "compose", + "left" + ] ] - ] - ], - [ - "Reference", + ], [ - "Function", - {}, + "Apply", [ "Function", {}, @@ -92094,62 +101076,376 @@ ] ], [ - "Function", - {}, + "Apply", [ "Function", {}, [ - "Reference", + "Function", {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "basics" + ] + ], + [ + "bool" ] ], + [] + ], + [ + "Reference", + {}, [ [ - "basics" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" ] ], + [] + ] + ], + [ + "Function", + {}, + [ + "Reference", + {}, [ - "bool" - ] + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] ], - [] - ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ] + ] + ], + [ + "Reference", [ - "Reference", + "Function", {}, [ + "Function", + {}, [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] ], + [] + ], + [ + "Reference", + {}, [ - "s", - "d", - "k" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ] + ], + [ + "Function", + {}, + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] ] ], [ + "Function", + {}, [ - "basics" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] ] + ] + ] + ], + [ + [ + [ + "morphir" ], [ - "bool" + "s", + "d", + "k" ] ], - [] + [ + [ + "basics" + ] + ], + [ + "compose", + "left" + ] ] ], + [ + "Variable", + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ] + ], + [ + "x" + ] + ] + ], + [ + "Variable", [ "Function", {}, @@ -92203,28 +101499,10 @@ ], [] ] - ] - ] - ], - [ - [ - [ - "morphir" ], [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" + "y" ] - ], - [ - "compose", - "left" ] ] ], @@ -92285,131 +101563,11 @@ ] ], [ - "x" + "z" ] ] - ], - [ - "Variable", - [ - "Function", - {}, - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "bool" - ] - ], - [] - ], - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "bool" - ] - ], - [] - ] - ], - [ - "y" - ] ] ] - ], - [ - "Variable", - [ - "Function", - {}, - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "bool" - ] - ], - [] - ], - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "bool" - ] - ], - [] - ] - ], - [ - "z" - ] ] ] }, @@ -93510,78 +102668,56 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" + "t", + "0" + ] + ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "1" + ] ], [ "Function", {}, [ - "Reference", + "Variable", {}, [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "bool" - ] - ], - [] + "t", + "2" + ] ], [ - "Reference", + "Variable", {}, [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "bool" - ] - ], - [] - ] - ], - [ - "Variable", - {}, - [ - "t", - "0" + "t", + "8" + ] ] ] - ], - [ - [ - "y" - ], + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Function", {}, @@ -93637,18 +102773,178 @@ ] ], [ - "Variable", + "Function", {}, [ - "t", - "1" + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ] + ], + [ + "Function", + {}, + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ] + ], + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ] + ] ] ] ], [ - [ - "z" - ], + "AsPattern", [ "Function", {}, @@ -93704,84 +103000,7 @@ ] ], [ - "Variable", - {}, - [ - "t", - "2" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "11" - ] - ], - "body": [ - "Apply", - [ - "Function", - {}, - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "bool" - ] - ], - [] - ], - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "bool" - ] - ], - [] - ] - ], - [ - "Apply", - [ - "Function", - {}, + "WildcardPattern", [ "Function", {}, @@ -93835,7 +103054,17 @@ ], [] ] - ], + ] + ], + [ + "x" + ] + ], + [ + "Lambda", + [ + "Function", + {}, [ "Function", {}, @@ -93889,10 +103118,7 @@ ], [] ] - ] - ], - [ - "Reference", + ], [ "Function", {}, @@ -93954,139 +103180,60 @@ "Function", {}, [ - "Function", + "Reference", {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] + "morphir" ], [ - "bool" + "s", + "d", + "k" ] ], - [] - ], - [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "bool" + "basics" ] ], - [] - ] + [ + "bool" + ] + ], + [] ], [ - "Function", + "Reference", {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] + "morphir" ], [ - "bool" + "s", + "d", + "k" ] ], - [] - ], - [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "bool" + "basics" ] ], - [] - ] - ] - ] - ], - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" + [ + "bool" + ] + ], + [] ] - ], - [ - "compose", - "right" ] ] ], [ - "Variable", + "AsPattern", [ "Function", {}, @@ -94142,71 +103289,125 @@ ] ], [ - "x" - ] - ] - ], - [ - "Apply", - [ - "Function", - {}, - [ - "Reference", - {}, + "WildcardPattern", [ + "Function", + {}, [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] ], - [ - "s", - "d", - "k" - ] + [] ], [ + "Reference", + {}, [ - "basics" - ] - ], - [ - "bool" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] ] - ], - [] + ] ], [ - "Reference", + "y" + ] + ], + [ + "Lambda", + [ + "Function", {}, [ + "Function", + {}, [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] ], - [ - "s", - "d", - "k" - ] + [] ], [ + "Reference", + {}, [ - "basics" - ] - ], - [ - "bool" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] ] ], - [] - ] - ], - [ - "Apply", - [ - "Function", - {}, [ "Function", {}, @@ -94260,7 +103461,10 @@ ], [] ] - ], + ] + ], + [ + "AsPattern", [ "Function", {}, @@ -94314,13 +103518,495 @@ ], [] ] + ], + [ + "WildcardPattern", + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ] + ] + ], + [ + "z" ] ], [ - "Reference", + "Apply", [ "Function", {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ] + ], + [ + "Apply", + [ + "Function", + {}, + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ] + ], + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ] + ] + ], + [ + "Reference", + [ + "Function", + {}, + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ] + ], + [ + "Function", + {}, + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ] + ], + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ] + ] + ] + ], + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "compose", + "right" + ] + ] + ], + [ + "Variable", + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ] + ], + [ + "x" + ] + ] + ], + [ + "Apply", [ "Function", {}, @@ -94376,62 +104062,376 @@ ] ], [ - "Function", - {}, + "Apply", [ "Function", {}, [ - "Reference", + "Function", {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "basics" + ] + ], + [ + "bool" ] ], + [] + ], + [ + "Reference", + {}, [ [ - "basics" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" ] ], + [] + ] + ], + [ + "Function", + {}, + [ + "Reference", + {}, [ - "bool" - ] + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] ], - [] - ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ] + ] + ], + [ + "Reference", [ - "Reference", + "Function", {}, [ + "Function", + {}, [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] ], + [] + ], + [ + "Reference", + {}, [ - "s", - "d", - "k" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ] + ], + [ + "Function", + {}, + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] ] ], [ + "Function", + {}, [ - "basics" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] ] + ] + ] + ], + [ + [ + [ + "morphir" ], [ - "bool" + "s", + "d", + "k" ] ], - [] + [ + [ + "basics" + ] + ], + [ + "compose", + "right" + ] ] ], + [ + "Variable", + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ] + ], + [ + "y" + ] + ] + ], + [ + "Variable", [ "Function", {}, @@ -94485,150 +104485,12 @@ ], [] ] - ] - ] - ], - [ - [ - [ - "morphir" ], [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" + "z" ] - ], - [ - "compose", - "right" ] ] - ], - [ - "Variable", - [ - "Function", - {}, - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "bool" - ] - ], - [] - ], - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "bool" - ] - ], - [] - ] - ], - [ - "y" - ] - ] - ], - [ - "Variable", - [ - "Function", - {}, - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "bool" - ] - ], - [] - ], - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "bool" - ] - ], - [] - ] - ], - [ - "z" ] ] ] @@ -95730,10 +105592,56 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" + "t", + "0" + ] + ], + [ + "Variable", + {}, + [ + "t", + "2" + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] ], [ "Reference", @@ -95759,57 +105667,37 @@ ] ], [] - ], - [ - "Variable", - {}, - [ - "t", - "0" - ] ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "3" - ] - ], - "body": [ - "Apply", + ], [ - "Reference", - {}, + "AsPattern", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "float" ] ], - [ - "float" - ] + [] ], - [] - ], - [ - "Reference", [ - "Function", - {}, + "WildcardPattern", [ "Reference", {}, @@ -95834,59 +105722,95 @@ ] ], [] - ], + ] + ], + [ + "x" + ] + ], + [ + "Apply", + [ + "Reference", + {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] + "morphir" ], [ - "float" + "s", + "d", + "k" ] ], - [] - ] - ], - [ - [ [ - "morphir" + [ + "basics" + ] ], [ - "s", - "d", - "k" + "float" ] ], + [] + ], + [ + "Reference", [ + "Function", + {}, [ - "basics" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] ] ], - [ - "cos" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, [ [ [ @@ -95904,13 +105828,40 @@ ] ], [ - "float" + "cos" ] - ], - [] + ] ], [ - "x" + "Variable", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "x" + ] ] ] ] @@ -96264,11 +106215,32 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" - ], + "t", + "0" + ] + ], + [ + "Variable", + {}, + [ + "t", + "2" + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -96295,80 +106267,60 @@ [] ], [ - "Variable", + "Reference", {}, - [ - "t", - "0" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "3" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] ], [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" + "float" ] ], - [ - "float" - ] - ], - [] + [] + ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "basics" - ] - ], + "s", + "d", + "k" + ] + ], + [ [ - "float" + "basics" ] ], - [] + [ + "float" + ] ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -96396,31 +106348,92 @@ ] ], [ + "x" + ] + ], + [ + "Apply", + [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "basics" + ] + ], + [ + "float" ] ], + [] + ], + [ + "Reference", [ + "Function", + {}, [ - "basics" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] ] ], - [ - "degrees" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, [ [ [ @@ -96438,13 +106451,40 @@ ] ], [ - "float" + "degrees" ] - ], - [] + ] ], [ - "x" + "Variable", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "x" + ] ] ] ] @@ -96695,11 +106735,44 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" + "t", + "0" + ] + ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "1" + ] ], + [ + "Variable", + {}, + [ + "t", + "4" + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -96726,18 +106799,62 @@ [] ], [ - "Variable", + "Function", {}, [ - "t", - "0" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] ] ] ], [ - [ - "y" - ], + "AsPattern", [ "Reference", {}, @@ -96764,52 +106881,39 @@ [] ], [ - "Variable", - {}, - [ - "t", - "1" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "6" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ + "WildcardPattern", [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "float" + [] ] ], - [] + [ + "x" + ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -96865,10 +106969,34 @@ ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -96893,7 +107021,41 @@ ] ], [] + ] + ], + [ + "y" + ] + ], + [ + "Apply", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] ], + [] + ], + [ + "Apply", [ "Function", {}, @@ -96947,90 +107109,176 @@ ], [] ] - ] - ], - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] ], [ - "divide" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ + "Reference", [ + "Function", + {}, [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] ], [ - "s", - "d", - "k" + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ] ] ], [ [ - "basics" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "divide" ] - ], - [ - "float" ] ], - [] - ], - [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ [ + "Variable", [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] ], [ - "s", - "d", - "k" + "x" ] - ], + ] + ], + [ + "Variable", [ + "Reference", + {}, [ - "basics" - ] + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] ], [ - "float" + "y" ] - ], - [] - ], - [ - "y" + ] ] ] ] @@ -97397,11 +107645,44 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" + "t", + "0" + ] + ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "1" + ] ], + [ + "Variable", + {}, + [ + "t", + "4" + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -97428,18 +107709,62 @@ [] ], [ - "Variable", + "Function", {}, [ - "t", - "0" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] ] ] ], [ - [ - "y" - ], + "AsPattern", [ "Reference", {}, @@ -97466,52 +107791,39 @@ [] ], [ - "Variable", - {}, - [ - "t", - "1" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "6" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ + "WildcardPattern", [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "float" + [] ] ], - [] + [ + "x" + ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -97567,10 +107879,34 @@ ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -97595,7 +107931,41 @@ ] ], [] + ] + ], + [ + "y" + ] + ], + [ + "Apply", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] ], + [] + ], + [ + "Apply", [ "Function", {}, @@ -97649,90 +108019,176 @@ ], [] ] - ] - ], - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] ], [ - "divide" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ + "Reference", [ + "Function", + {}, [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] ], [ - "s", - "d", - "k" + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ] ] ], [ [ - "basics" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "divide" ] - ], - [ - "float" ] ], - [] - ], - [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ [ + "Variable", [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] ], [ - "s", - "d", - "k" + "x" ] - ], + ] + ], + [ + "Variable", [ + "Reference", + {}, [ - "basics" - ] + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] ], [ - "float" + "y" ] - ], - [] - ], - [ - "y" + ] ] ] ] @@ -98099,17 +108555,27 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" - ], + "t", + "0" + ] + ], + [ + "Function", + {}, [ "Variable", {}, [ "t", - "2" + "1" ] ], [ @@ -98117,14 +108583,16 @@ {}, [ "t", - "0" + "4" ] ] - ], + ] + ], + "body": [ + "Lambda", [ - [ - "y" - ], + "Function", + {}, [ "Variable", {}, @@ -98134,52 +108602,70 @@ ] ], [ - "Variable", + "Function", {}, [ - "t", - "1" + "Variable", + {}, + [ + "t", + "2" + ] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] ] ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "6" - ] - ], - "body": [ - "Apply", + ], [ - "Reference", - {}, + "AsPattern", [ + "Variable", + {}, [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], + "t", + "2" + ] + ], + [ + "WildcardPattern", [ + "Variable", + {}, [ - "basics" + "t", + "2" ] - ], - [ - "bool" ] ], - [] + [ + "x" + ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -98218,10 +108704,17 @@ ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Variable", {}, + [ + "t", + "2" + ] + ], + [ + "WildcardPattern", [ "Variable", {}, @@ -98229,7 +108722,41 @@ "t", "2" ] + ] + ], + [ + "y" + ] + ], + [ + "Apply", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] ], + [] + ], + [ + "Apply", [ "Function", {}, @@ -98266,56 +108793,108 @@ ], [] ] - ] - ], - [ + ], [ + "Reference", [ - "morphir" + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "2" + ] + ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "2" + ] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ] + ] ], [ - "s", - "d", - "k" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "equal" + ] ] ], [ + "Variable", [ - "basics" + "Variable", + {}, + [ + "t", + "2" + ] + ], + [ + "x" ] - ], - [ - "equal" ] - ] - ], - [ - "Variable", + ], [ "Variable", - {}, [ - "t", - "2" + "Variable", + {}, + [ + "t", + "2" + ] + ], + [ + "y" ] - ], - [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Variable", - {}, - [ - "t", - "2" ] - ], - [ - "y" ] ] ] @@ -98598,11 +109177,44 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" + "t", + "0" + ] + ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "1" + ] ], + [ + "Variable", + {}, + [ + "t", + "4" + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -98629,18 +109241,62 @@ [] ], [ - "Variable", + "Function", {}, [ - "t", - "0" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] ] ] ], [ - [ - "y" - ], + "AsPattern", [ "Reference", {}, @@ -98667,52 +109323,39 @@ [] ], [ - "Variable", - {}, - [ - "t", - "1" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "6" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ + "WildcardPattern", [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "bool" + [] ] ], - [] + [ + "x" + ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -98768,10 +109411,34 @@ ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -98787,16 +109454,50 @@ ] ], [ - [ - "basics" - ] + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ] + ], + [ + "y" + ] + ], + [ + "Apply", + [ + "Reference", + {}, + [ + [ + [ + "morphir" ], [ - "float" + "s", + "d", + "k" ] ], - [] + [ + [ + "basics" + ] + ], + [ + "bool" + ] ], + [] + ], + [ + "Apply", [ "Function", {}, @@ -98850,90 +109551,176 @@ ], [] ] - ] - ], - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] ], [ - "equal" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ + "Reference", [ + "Function", + {}, [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] ], [ - "s", - "d", - "k" + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ] ] ], [ [ - "basics" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "equal" ] - ], - [ - "float" ] ], - [] - ], - [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ [ + "Variable", [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] ], [ - "s", - "d", - "k" + "x" ] - ], + ] + ], + [ + "Variable", [ + "Reference", + {}, [ - "basics" - ] + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] ], [ - "float" + "y" ] - ], - [] - ], - [ - "y" + ] ] ] ] @@ -99301,11 +110088,44 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" + "t", + "0" + ] + ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "1" + ] ], + [ + "Variable", + {}, + [ + "t", + "4" + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -99332,18 +110152,62 @@ [] ], [ - "Variable", + "Function", {}, [ - "t", - "0" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] ] ] ], [ - [ - "y" - ], + "AsPattern", [ "Reference", {}, @@ -99370,52 +110234,39 @@ [] ], [ - "Variable", - {}, - [ - "t", - "1" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "6" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ + "WildcardPattern", [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "bool" + [] ] ], - [] + [ + "x" + ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -99471,10 +110322,34 @@ ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -99499,7 +110374,41 @@ ] ], [] + ] + ], + [ + "y" + ] + ], + [ + "Apply", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] ], + [] + ], + [ + "Apply", [ "Function", {}, @@ -99553,90 +110462,176 @@ ], [] ] - ] - ], - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] ], [ - "equal" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ + "Reference", [ + "Function", + {}, [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] ], [ - "s", - "d", - "k" + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ] ] ], [ [ - "basics" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "equal" ] - ], - [ - "bool" ] ], - [] - ], - [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ [ + "Variable", [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] ], [ - "s", - "d", - "k" + "x" ] - ], + ] + ], + [ + "Variable", [ + "Reference", + {}, [ - "basics" - ] + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] ], [ - "bool" + "y" ] - ], - [] - ], - [ - "y" + ] ] ] ] @@ -100004,11 +110999,44 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" + "t", + "0" + ] + ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "1" + ] ], + [ + "Variable", + {}, + [ + "t", + "4" + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -100035,18 +111063,62 @@ [] ], [ - "Variable", + "Function", {}, [ - "t", - "0" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "char" + ] + ], + [ + "char" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] ] ] ], [ - [ - "y" - ], + "AsPattern", [ "Reference", {}, @@ -100073,52 +111145,39 @@ [] ], [ - "Variable", - {}, - [ - "t", - "1" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "6" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ + "WildcardPattern", [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "char" + ] + ], + [ + "char" + ] ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "bool" + [] ] ], - [] + [ + "x" + ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -100174,10 +111233,34 @@ ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "char" + ] + ], + [ + "char" + ] + ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -100194,18 +111277,211 @@ ], [ [ - "char" + "char" + ] + ], + [ + "char" + ] + ], + [] + ] + ], + [ + "y" + ] + ], + [ + "Apply", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ], + [ + "Apply", + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "char" + ] + ], + [ + "char" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ] + ], + [ + "Reference", + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "char" + ] + ], + [ + "char" + ] + ], + [] + ], + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "char" + ] + ], + [ + "char" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ] + ] + ], + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" ] ], [ - "char" + "equal" ] - ], - [] + ] ], [ - "Function", - {}, + "Variable", [ "Reference", {}, @@ -100232,114 +111508,41 @@ [] ], [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "bool" - ] - ], - [] + "x" ] ] ], [ + "Variable", [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "equal" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "char" + ] + ], [ "char" ] ], - [ - "char" - ] - ], - [] - ], - [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "char" - ] + [] ], [ - "char" + "y" ] - ], - [] - ], - [ - "y" + ] ] ] ] @@ -100707,11 +111910,44 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" + "t", + "0" + ] + ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "1" + ] ], + [ + "Variable", + {}, + [ + "t", + "4" + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -100738,18 +111974,62 @@ [] ], [ - "Variable", + "Function", {}, [ - "t", - "0" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] ] ] ], [ - [ - "y" - ], + "AsPattern", [ "Reference", {}, @@ -100776,52 +112056,39 @@ [] ], [ - "Variable", - {}, - [ - "t", - "1" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "6" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ + "WildcardPattern", [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "bool" + [] ] ], - [] + [ + "x" + ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -100877,10 +112144,34 @@ ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -100905,7 +112196,41 @@ ] ], [] + ] + ], + [ + "y" + ] + ], + [ + "Apply", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] ], + [] + ], + [ + "Apply", [ "Function", {}, @@ -100959,90 +112284,176 @@ ], [] ] - ] - ], - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] ], [ - "equal" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ + "Reference", [ + "Function", + {}, [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] ], [ - "s", - "d", - "k" + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ] ] ], [ [ - "string" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "equal" ] - ], - [ - "string" ] ], - [] - ], - [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ [ + "Variable", [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] ], [ - "s", - "d", - "k" + "x" ] - ], + ] + ], + [ + "Variable", [ + "Reference", + {}, [ - "string" - ] + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] ], [ - "string" + "y" ] - ], - [] - ], - [ - "y" + ] ] ] ] @@ -101410,11 +112821,44 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" + "t", + "0" + ] + ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "1" + ] ], + [ + "Variable", + {}, + [ + "t", + "4" + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -101444,24 +112888,77 @@ {}, [ "t", - "17" + "19" ] ] ] ], [ - "Variable", + "Function", {}, [ - "t", - "0" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Variable", + {}, + [ + "t", + "19" + ] + ] + ] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] ] ] ], [ - [ - "y" - ], + "AsPattern", [ "Reference", {}, @@ -101491,58 +112988,54 @@ {}, [ "t", - "17" + "19" ] ] ] ], [ - "Variable", - {}, - [ - "t", - "1" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "6" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ + "WildcardPattern", [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] ], [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" + [ + "Variable", + {}, + [ + "t", + "19" + ] + ] ] - ], - [ - "bool" ] ], - [] + [ + "x" + ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -101575,7 +113068,7 @@ {}, [ "t", - "17" + "19" ] ] ] @@ -101607,10 +113100,43 @@ ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Variable", + {}, + [ + "t", + "19" + ] + ] + ] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -101640,11 +113166,45 @@ {}, [ "t", - "17" + "19" ] ] ] + ] + ], + [ + "y" + ] + ], + [ + "Apply", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] ], + [] + ], + [ + "Apply", [ "Function", {}, @@ -101677,7 +113237,7 @@ {}, [ "t", - "17" + "19" ] ] ] @@ -101707,108 +113267,212 @@ ], [] ] - ] - ], - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] ], [ - "equal" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ + "Reference", [ + "Function", + {}, [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Variable", + {}, + [ + "t", + "19" + ] + ] + ] ], [ - "s", - "d", - "k" + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Variable", + {}, + [ + "t", + "19" + ] + ] + ] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ] ] ], [ [ - "list" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "equal" ] - ], - [ - "list" ] ], [ + "Variable", [ - "Variable", + "Reference", {}, [ - "t", - "17" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Variable", + {}, + [ + "t", + "19" + ] + ] ] + ], + [ + "x" ] ] ], [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ + "Variable", [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] ], [ - "s", - "d", - "k" - ] - ], - [ - [ - "list" + [ + "Variable", + {}, + [ + "t", + "19" + ] + ] ] ], [ - "list" - ] - ], - [ - [ - "Variable", - {}, - [ - "t", - "17" - ] + "y" ] ] - ], - [ - "y" ] ] ] @@ -101874,7 +113538,7 @@ {}, [ "t", - "17" + "19" ] ] ] @@ -101939,7 +113603,7 @@ {}, [ "t", - "17" + "19" ] ] ] @@ -101976,7 +113640,7 @@ {}, [ "t", - "17" + "19" ] ] ] @@ -102043,7 +113707,7 @@ {}, [ "t", - "17" + "19" ] ] ] @@ -102056,7 +113720,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -102071,7 +113735,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -102113,7 +113777,7 @@ {}, [ "t", - "17" + "19" ] ] ] @@ -102126,7 +113790,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -102141,7 +113805,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -102277,11 +113941,44 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" + "t", + "0" + ] + ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "1" + ] ], + [ + "Variable", + {}, + [ + "t", + "4" + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Tuple", {}, @@ -102291,7 +113988,7 @@ {}, [ "t", - "18" + "20" ] ], [ @@ -102299,7 +113996,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -102307,24 +114004,73 @@ {}, [ "t", - "16" + "18" ] ] ] ], [ - "Variable", + "Function", {}, [ - "t", - "0" + "Tuple", + {}, + [ + [ + "Variable", + {}, + [ + "t", + "20" + ] + ], + [ + "Variable", + {}, + [ + "t", + "19" + ] + ], + [ + "Variable", + {}, + [ + "t", + "18" + ] + ] + ] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] ] ] ], [ - [ - "y" - ], + "AsPattern", [ "Tuple", {}, @@ -102334,7 +114080,7 @@ {}, [ "t", - "18" + "20" ] ], [ @@ -102342,7 +114088,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -102350,58 +114096,50 @@ {}, [ "t", - "16" + "18" ] ] ] ], [ - "Variable", - {}, - [ - "t", - "1" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "6" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], + "WildcardPattern", [ + "Tuple", + {}, [ - "basics" + [ + "Variable", + {}, + [ + "t", + "20" + ] + ], + [ + "Variable", + {}, + [ + "t", + "19" + ] + ], + [ + "Variable", + {}, + [ + "t", + "18" + ] + ] ] - ], - [ - "bool" ] ], - [] + [ + "x" + ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -102414,7 +114152,7 @@ {}, [ "t", - "18" + "20" ] ], [ @@ -102422,7 +114160,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -102430,7 +114168,7 @@ {}, [ "t", - "16" + "18" ] ] ] @@ -102462,10 +114200,39 @@ ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Tuple", {}, + [ + [ + "Variable", + {}, + [ + "t", + "20" + ] + ], + [ + "Variable", + {}, + [ + "t", + "19" + ] + ], + [ + "Variable", + {}, + [ + "t", + "18" + ] + ] + ] + ], + [ + "WildcardPattern", [ "Tuple", {}, @@ -102475,7 +114242,7 @@ {}, [ "t", - "18" + "20" ] ], [ @@ -102483,7 +114250,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -102491,11 +114258,45 @@ {}, [ "t", - "16" + "18" ] ] ] + ] + ], + [ + "y" + ] + ], + [ + "Apply", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] ], + [] + ], + [ + "Apply", [ "Function", {}, @@ -102508,7 +114309,7 @@ {}, [ "t", - "18" + "20" ] ], [ @@ -102516,7 +114317,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -102524,7 +114325,7 @@ {}, [ "t", - "16" + "18" ] ] ] @@ -102554,100 +114355,196 @@ ], [] ] - ] - ], - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] ], [ - "equal" - ] - ] - ], - [ - "Variable", - [ - "Tuple", - {}, - [ + "Reference", [ - "Variable", + "Function", {}, [ - "t", - "18" + "Tuple", + {}, + [ + [ + "Variable", + {}, + [ + "t", + "20" + ] + ], + [ + "Variable", + {}, + [ + "t", + "19" + ] + ], + [ + "Variable", + {}, + [ + "t", + "18" + ] + ] + ] + ], + [ + "Function", + {}, + [ + "Tuple", + {}, + [ + [ + "Variable", + {}, + [ + "t", + "20" + ] + ], + [ + "Variable", + {}, + [ + "t", + "19" + ] + ], + [ + "Variable", + {}, + [ + "t", + "18" + ] + ] + ] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ] ] ], [ - "Variable", - {}, [ - "t", - "17" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "equal" ] - ], + ] + ], + [ + "Variable", [ - "Variable", + "Tuple", {}, [ - "t", - "16" + [ + "Variable", + {}, + [ + "t", + "20" + ] + ], + [ + "Variable", + {}, + [ + "t", + "19" + ] + ], + [ + "Variable", + {}, + [ + "t", + "18" + ] + ] ] + ], + [ + "x" ] ] ], [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Tuple", - {}, - [ - [ - "Variable", - {}, - [ - "t", - "18" - ] - ], + "Variable", [ - "Variable", + "Tuple", {}, [ - "t", - "17" + [ + "Variable", + {}, + [ + "t", + "20" + ] + ], + [ + "Variable", + {}, + [ + "t", + "19" + ] + ], + [ + "Variable", + {}, + [ + "t", + "18" + ] + ] ] ], [ - "Variable", - {}, - [ - "t", - "16" - ] + "y" ] ] - ], - [ - "y" ] ] ] @@ -102693,7 +114590,7 @@ {}, [ "t", - "18" + "20" ] ], [ @@ -102701,7 +114598,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -102709,7 +114606,7 @@ {}, [ "t", - "16" + "18" ] ] ] @@ -102754,7 +114651,7 @@ {}, [ "t", - "18" + "20" ] ], [ @@ -102762,7 +114659,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -102770,7 +114667,7 @@ {}, [ "t", - "16" + "18" ] ] ] @@ -102787,7 +114684,7 @@ {}, [ "t", - "18" + "20" ] ], [ @@ -102795,7 +114692,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -102803,7 +114700,7 @@ {}, [ "t", - "16" + "18" ] ] ] @@ -102850,7 +114747,7 @@ {}, [ "t", - "18" + "20" ] ], [ @@ -102858,7 +114755,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -102866,7 +114763,7 @@ {}, [ "t", - "16" + "18" ] ] ] @@ -102879,7 +114776,7 @@ {}, [ "t", - "18" + "20" ] ], [ @@ -102894,7 +114791,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -102909,7 +114806,7 @@ {}, [ "t", - "16" + "18" ] ], [ @@ -102931,7 +114828,7 @@ {}, [ "t", - "18" + "20" ] ], [ @@ -102939,7 +114836,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -102947,7 +114844,7 @@ {}, [ "t", - "16" + "18" ] ] ] @@ -102960,7 +114857,7 @@ {}, [ "t", - "18" + "20" ] ], [ @@ -102975,7 +114872,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -102990,7 +114887,7 @@ {}, [ "t", - "16" + "18" ] ], [ @@ -103340,11 +115237,44 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" + "t", + "0" + ] + ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "1" + ] ], + [ + "Variable", + {}, + [ + "t", + "4" + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -103371,18 +115301,62 @@ [] ], [ - "Variable", + "Function", {}, [ - "t", - "0" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] ] ] ], [ - [ - "y" - ], + "AsPattern", [ "Reference", {}, @@ -103409,52 +115383,39 @@ [] ], [ - "Variable", - {}, - [ - "t", - "1" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "6" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ + "WildcardPattern", [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "float" + [] ] ], - [] + [ + "x" + ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -103510,10 +115471,34 @@ ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -103538,7 +115523,41 @@ ] ], [] + ] + ], + [ + "y" + ] + ], + [ + "Apply", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] ], + [] + ], + [ + "Apply", [ "Function", {}, @@ -103591,91 +115610,177 @@ ] ], [] - ] - ] - ], - [ - [ - [ - "morphir" + ] + ], + [ + "Reference", + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ] + ] + ], + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "add" + ] + ] + ], + [ + "Variable", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] ], [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" + "x" ] - ], - [ - "add" ] - ] - ], - [ - "Variable", + ], [ - "Reference", - {}, + "Variable", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "float" ] ], - [ - "float" - ] - ], - [] - ], - [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] + [] ], [ - "float" + "y" ] - ], - [] - ], - [ - "y" + ] ] ] ] @@ -104488,11 +116593,32 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" - ], + "t", + "0" + ] + ], + [ + "Variable", + {}, + [ + "t", + "2" + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -104519,80 +116645,60 @@ [] ], [ - "Variable", + "Reference", {}, - [ - "t", - "0" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "3" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "int" ] ], - [ - "int" - ] - ], - [] + [] + ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "basics" - ] - ], + "s", + "d", + "k" + ] + ], + [ [ - "float" + "basics" ] ], - [] + [ + "float" + ] ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -104613,38 +116719,99 @@ ] ], [ - "int" + "float" ] ], [] ] ], [ + "x" + ] + ], + [ + "Apply", + [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "basics" + ] + ], + [ + "int" ] ], + [] + ], + [ + "Reference", [ + "Function", + {}, [ - "basics" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ] ], - [ - "floor" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, [ [ [ @@ -104662,13 +116829,40 @@ ] ], [ - "float" + "floor" ] - ], - [] + ] ], [ - "x" + "Variable", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "x" + ] ] ] ] @@ -104918,11 +117112,32 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" - ], + "t", + "0" + ] + ], + [ + "Variable", + {}, + [ + "t", + "2" + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -104949,80 +117164,60 @@ [] ], [ - "Variable", + "Reference", {}, - [ - "t", - "0" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "3" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "int" ] ], - [ - "int" - ] - ], - [] + [] + ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "basics" - ] - ], + "s", + "d", + "k" + ] + ], + [ [ - "float" + "basics" ] ], - [] + [ + "float" + ] ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -105043,38 +117238,99 @@ ] ], [ - "int" + "float" ] ], [] ] ], [ + "x" + ] + ], + [ + "Apply", + [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "basics" + ] + ], + [ + "int" ] ], + [] + ], + [ + "Reference", [ + "Function", + {}, [ - "basics" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ] ], - [ - "floor" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, [ [ [ @@ -105092,13 +117348,40 @@ ] ], [ - "float" + "floor" ] - ], - [] + ] ], [ - "x" + "Variable", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "x" + ] ] ] ] @@ -105441,11 +117724,32 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" - ], + "t", + "0" + ] + ], + [ + "Variable", + {}, + [ + "t", + "2" + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Tuple", {}, @@ -105503,142 +117807,122 @@ ] ], [ - "Variable", + "Tuple", {}, [ - "t", - "0" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "3" - ] - ], - "body": [ - "Apply", - [ - "Tuple", - {}, - [ - [ - "Reference", - {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "float" ] ], - [ - "float" - ] + [] ], - [] - ], - [ - "Reference", - {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "float" ] ], - [ - "float" - ] - ], - [] + [] + ] ] ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Tuple", {}, [ - "Tuple", - {}, [ + "Reference", + {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "basics" - ] - ], + "s", + "d", + "k" + ] + ], + [ [ - "float" + "basics" ] ], - [] + [ + "float" + ] ], + [] + ], + [ + "Reference", + {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "basics" - ] - ], + "s", + "d", + "k" + ] + ], + [ [ - "float" + "basics" ] ], - [] - ] + [ + "float" + ] + ], + [] ] - ], + ] + ], + [ + "WildcardPattern", [ "Tuple", {}, @@ -105697,29 +117981,11 @@ ] ], [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "from", - "polar" - ] + "x" ] ], [ - "Variable", + "Apply", [ "Tuple", {}, @@ -105777,7 +118043,206 @@ ] ], [ - "x" + "Reference", + [ + "Function", + {}, + [ + "Tuple", + {}, + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ] + ] + ], + [ + "Tuple", + {}, + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ] + ] + ] + ], + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "from", + "polar" + ] + ] + ], + [ + "Variable", + [ + "Tuple", + {}, + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ] + ] + ], + [ + "x" + ] ] ] ] @@ -106426,11 +118891,44 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" + "t", + "0" + ] + ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "1" + ] ], + [ + "Variable", + {}, + [ + "t", + "4" + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -106457,18 +118955,62 @@ [] ], [ - "Variable", + "Function", {}, [ - "t", - "0" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "char" + ] + ], + [ + "char" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] ] ] ], [ - [ - "y" - ], + "AsPattern", [ "Reference", {}, @@ -106495,52 +119037,39 @@ [] ], [ - "Variable", - {}, - [ - "t", - "1" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "6" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ + "WildcardPattern", [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "char" + ] + ], + [ + "char" + ] ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "bool" + [] ] ], - [] + [ + "x" + ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -106596,10 +119125,34 @@ ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "char" + ] + ], + [ + "char" + ] + ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -106624,7 +119177,41 @@ ] ], [] + ] + ], + [ + "y" + ] + ], + [ + "Apply", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] ], + [] + ], + [ + "Apply", [ "Function", {}, @@ -106678,93 +119265,179 @@ ], [] ] - ] - ], - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] ], [ - "greater", - "than", - "or", - "equal" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ + "Reference", [ + "Function", + {}, [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "char" + ] + ], + [ + "char" + ] + ], + [] ], [ - "s", - "d", - "k" + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "char" + ] + ], + [ + "char" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ] ] ], [ [ - "char" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "greater", + "than", + "or", + "equal" ] - ], - [ - "char" ] ], - [] - ], - [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ [ + "Variable", [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "char" + ] + ], + [ + "char" + ] + ], + [] ], [ - "s", - "d", - "k" + "x" ] - ], + ] + ], + [ + "Variable", [ + "Reference", + {}, [ - "char" - ] + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "char" + ] + ], + [ + "char" + ] + ], + [] ], [ - "char" + "y" ] - ], - [] - ], - [ - "y" + ] ] ] ] @@ -107135,11 +119808,44 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" + "t", + "0" + ] + ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "1" + ] ], + [ + "Variable", + {}, + [ + "t", + "4" + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -107166,18 +119872,62 @@ [] ], [ - "Variable", + "Function", {}, [ - "t", - "0" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] ] ] ], [ - [ - "y" - ], + "AsPattern", [ "Reference", {}, @@ -107204,52 +119954,39 @@ [] ], [ - "Variable", - {}, - [ - "t", - "1" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "6" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ + "WildcardPattern", [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "bool" + [] ] ], - [] + [ + "x" + ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -107305,10 +120042,34 @@ ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -107333,7 +120094,41 @@ ] ], [] + ] + ], + [ + "y" + ] + ], + [ + "Apply", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] ], + [] + ], + [ + "Apply", [ "Function", {}, @@ -107363,117 +120158,203 @@ [] ], [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "bool" - ] - ], - [] + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ] + ], + [ + "Reference", + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ] + ] + ], + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "greater", + "than", + "or", + "equal" + ] + ] + ], + [ + "Variable", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "x" ] ] ], [ + "Variable", [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "greater", - "than", - "or", - "equal" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "float" ] ], - [ - "float" - ] - ], - [] - ], - [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] + [] ], [ - "float" + "y" ] - ], - [] - ], - [ - "y" + ] ] ] ] @@ -107844,17 +120725,27 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" - ], + "t", + "0" + ] + ], + [ + "Function", + {}, [ "Variable", {}, [ "t", - "2" + "1" ] ], [ @@ -107862,14 +120753,16 @@ {}, [ "t", - "0" + "4" ] ] - ], + ] + ], + "body": [ + "Lambda", [ - [ - "y" - ], + "Function", + {}, [ "Variable", {}, @@ -107879,52 +120772,70 @@ ] ], [ - "Variable", + "Function", {}, [ - "t", - "1" + "Variable", + {}, + [ + "t", + "2" + ] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] ] ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "6" - ] - ], - "body": [ - "Apply", + ], [ - "Reference", - {}, + "AsPattern", [ + "Variable", + {}, [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], + "t", + "2" + ] + ], + [ + "WildcardPattern", [ + "Variable", + {}, [ - "basics" + "t", + "2" ] - ], - [ - "bool" ] ], - [] + [ + "x" + ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -107963,18 +120874,59 @@ ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Variable", {}, + [ + "t", + "2" + ] + ], + [ + "WildcardPattern", [ "Variable", {}, [ - "t", - "2" + "t", + "2" + ] + ] + ], + [ + "y" + ] + ], + [ + "Apply", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" ] ], + [] + ], + [ + "Apply", [ "Function", {}, @@ -108011,59 +120963,111 @@ ], [] ] - ] - ], - [ + ], [ + "Reference", [ - "morphir" + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "2" + ] + ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "2" + ] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ] + ] ], [ - "s", - "d", - "k" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "greater", + "than", + "or", + "equal" + ] ] ], [ + "Variable", [ - "basics" + "Variable", + {}, + [ + "t", + "2" + ] + ], + [ + "x" ] - ], - [ - "greater", - "than", - "or", - "equal" ] - ] - ], - [ - "Variable", + ], [ "Variable", - {}, [ - "t", - "2" + "Variable", + {}, + [ + "t", + "2" + ] + ], + [ + "y" ] - ], - [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Variable", - {}, - [ - "t", - "2" ] - ], - [ - "y" ] ] ] @@ -108349,11 +121353,44 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" + "t", + "0" + ] + ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "1" + ] ], + [ + "Variable", + {}, + [ + "t", + "4" + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -108383,24 +121420,77 @@ {}, [ "t", - "17" + "19" ] ] ] ], [ - "Variable", + "Function", {}, [ - "t", - "0" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Variable", + {}, + [ + "t", + "19" + ] + ] + ] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] ] ] ], [ - [ - "y" - ], + "AsPattern", [ "Reference", {}, @@ -108430,58 +121520,54 @@ {}, [ "t", - "17" + "19" ] ] ] ], [ - "Variable", - {}, - [ - "t", - "1" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "6" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ + "WildcardPattern", [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] ], [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" + [ + "Variable", + {}, + [ + "t", + "19" + ] + ] ] - ], - [ - "bool" ] ], - [] + [ + "x" + ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -108514,7 +121600,7 @@ {}, [ "t", - "17" + "19" ] ] ] @@ -108546,10 +121632,43 @@ ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Variable", + {}, + [ + "t", + "19" + ] + ] + ] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -108579,11 +121698,45 @@ {}, [ "t", - "17" + "19" ] ] ] + ] + ], + [ + "y" + ] + ], + [ + "Apply", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] ], + [] + ], + [ + "Apply", [ "Function", {}, @@ -108616,7 +121769,7 @@ {}, [ "t", - "17" + "19" ] ] ] @@ -108646,111 +121799,215 @@ ], [] ] - ] - ], - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] ], [ + "Reference", [ - "basics" - ] - ], - [ - "greater", - "than", - "or", - "equal" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ - [ + "Function", + {}, [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Variable", + {}, + [ + "t", + "19" + ] + ] + ] ], [ - "s", - "d", - "k" + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Variable", + {}, + [ + "t", + "19" + ] + ] + ] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ] ] ], [ [ - "list" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "greater", + "than", + "or", + "equal" ] - ], - [ - "list" ] ], [ + "Variable", [ - "Variable", + "Reference", {}, [ - "t", - "17" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Variable", + {}, + [ + "t", + "19" + ] + ] ] + ], + [ + "x" ] ] ], [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ + "Variable", [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] ], [ - "s", - "d", - "k" - ] - ], - [ - [ - "list" + [ + "Variable", + {}, + [ + "t", + "19" + ] + ] ] ], [ - "list" - ] - ], - [ - [ - "Variable", - {}, - [ - "t", - "17" - ] + "y" ] ] - ], - [ - "y" ] ] ] @@ -108816,7 +122073,7 @@ {}, [ "t", - "17" + "19" ] ] ] @@ -108881,7 +122138,7 @@ {}, [ "t", - "17" + "19" ] ] ] @@ -108918,7 +122175,7 @@ {}, [ "t", - "17" + "19" ] ] ] @@ -108985,7 +122242,7 @@ {}, [ "t", - "17" + "19" ] ] ] @@ -108998,7 +122255,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -109013,7 +122270,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -109055,7 +122312,7 @@ {}, [ "t", - "17" + "19" ] ] ] @@ -109068,7 +122325,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -109083,7 +122340,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -109222,11 +122479,44 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" + "t", + "0" + ] + ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "1" + ] ], + [ + "Variable", + {}, + [ + "t", + "4" + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -109253,18 +122543,62 @@ [] ], [ - "Variable", + "Function", {}, [ - "t", - "0" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] ] ] ], [ - [ - "y" - ], + "AsPattern", [ "Reference", {}, @@ -109291,52 +122625,39 @@ [] ], [ - "Variable", - {}, - [ - "t", - "1" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "6" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ + "WildcardPattern", [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "bool" + [] ] ], - [] + [ + "x" + ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -109392,10 +122713,34 @@ ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -109420,7 +122765,41 @@ ] ], [] + ] + ], + [ + "y" + ] + ], + [ + "Apply", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] ], + [] + ], + [ + "Apply", [ "Function", {}, @@ -109474,93 +122853,179 @@ ], [] ] - ] - ], - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] ], [ - "greater", - "than", - "or", - "equal" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ + "Reference", [ + "Function", + {}, [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] ], [ - "s", - "d", - "k" + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ] ] ], [ [ - "string" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "greater", + "than", + "or", + "equal" ] - ], - [ - "string" ] ], - [] - ], - [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ [ + "Variable", [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] ], [ - "s", - "d", - "k" + "x" ] - ], + ] + ], + [ + "Variable", [ + "Reference", + {}, [ - "string" - ] + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] ], [ - "string" + "y" ] - ], - [] - ], - [ - "y" + ] ] ] ] @@ -109931,11 +123396,44 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" + "t", + "0" + ] + ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "1" + ] ], + [ + "Variable", + {}, + [ + "t", + "4" + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Tuple", {}, @@ -109945,7 +123443,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -109953,24 +123451,65 @@ {}, [ "t", - "16" + "18" ] ] ] ], [ - "Variable", + "Function", {}, [ - "t", - "0" + "Tuple", + {}, + [ + [ + "Variable", + {}, + [ + "t", + "19" + ] + ], + [ + "Variable", + {}, + [ + "t", + "18" + ] + ] + ] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] ] ] ], [ - [ - "y" - ], + "AsPattern", [ "Tuple", {}, @@ -109980,7 +123519,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -109988,58 +123527,42 @@ {}, [ "t", - "16" + "18" ] ] ] ], [ - "Variable", - {}, - [ - "t", - "1" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "6" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], + "WildcardPattern", [ + "Tuple", + {}, [ - "basics" + [ + "Variable", + {}, + [ + "t", + "19" + ] + ], + [ + "Variable", + {}, + [ + "t", + "18" + ] + ] ] - ], - [ - "bool" ] ], - [] + [ + "x" + ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -110052,7 +123575,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -110060,7 +123583,7 @@ {}, [ "t", - "16" + "18" ] ] ] @@ -110092,10 +123615,31 @@ ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Tuple", {}, + [ + [ + "Variable", + {}, + [ + "t", + "19" + ] + ], + [ + "Variable", + {}, + [ + "t", + "18" + ] + ] + ] + ], + [ + "WildcardPattern", [ "Tuple", {}, @@ -110105,7 +123649,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -110113,11 +123657,45 @@ {}, [ "t", - "16" + "18" ] ] ] + ] + ], + [ + "y" + ] + ], + [ + "Apply", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] ], + [] + ], + [ + "Apply", [ "Function", {}, @@ -110130,7 +123708,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -110138,7 +123716,7 @@ {}, [ "t", - "16" + "18" ] ] ] @@ -110168,87 +123746,167 @@ ], [] ] - ] - ], - [ + ], [ + "Reference", [ - "morphir" + "Function", + {}, + [ + "Tuple", + {}, + [ + [ + "Variable", + {}, + [ + "t", + "19" + ] + ], + [ + "Variable", + {}, + [ + "t", + "18" + ] + ] + ] + ], + [ + "Function", + {}, + [ + "Tuple", + {}, + [ + [ + "Variable", + {}, + [ + "t", + "19" + ] + ], + [ + "Variable", + {}, + [ + "t", + "18" + ] + ] + ] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ] + ] ], [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "greater", + "than", + "or", + "equal" + ] ] ], [ - "greater", - "than", - "or", - "equal" - ] - ] - ], - [ - "Variable", - [ - "Tuple", - {}, - [ + "Variable", [ - "Variable", + "Tuple", {}, [ - "t", - "17" + [ + "Variable", + {}, + [ + "t", + "19" + ] + ], + [ + "Variable", + {}, + [ + "t", + "18" + ] + ] ] ], [ - "Variable", - {}, - [ - "t", - "16" - ] + "x" ] ] ], [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Tuple", - {}, - [ + "Variable", [ - "Variable", + "Tuple", {}, [ - "t", - "17" + [ + "Variable", + {}, + [ + "t", + "19" + ] + ], + [ + "Variable", + {}, + [ + "t", + "18" + ] + ] ] ], [ - "Variable", - {}, - [ - "t", - "16" - ] + "y" ] ] - ], - [ - "y" ] ] ] @@ -110294,7 +123952,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -110302,7 +123960,7 @@ {}, [ "t", - "16" + "18" ] ] ] @@ -110347,7 +124005,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -110355,7 +124013,7 @@ {}, [ "t", - "16" + "18" ] ] ] @@ -110372,7 +124030,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -110380,7 +124038,7 @@ {}, [ "t", - "16" + "18" ] ] ] @@ -110427,7 +124085,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -110435,7 +124093,7 @@ {}, [ "t", - "16" + "18" ] ] ] @@ -110448,7 +124106,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -110463,7 +124121,7 @@ {}, [ "t", - "16" + "18" ] ], [ @@ -110485,7 +124143,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -110493,7 +124151,7 @@ {}, [ "t", - "16" + "18" ] ] ] @@ -110506,7 +124164,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -110521,7 +124179,7 @@ {}, [ "t", - "16" + "18" ] ], [ @@ -110658,11 +124316,44 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" + "t", + "0" + ] + ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "1" + ] ], + [ + "Variable", + {}, + [ + "t", + "4" + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -110689,18 +124380,62 @@ [] ], [ - "Variable", + "Function", {}, [ - "t", - "0" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "char" + ] + ], + [ + "char" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] ] ] ], [ - [ - "y" - ], + "AsPattern", [ "Reference", {}, @@ -110727,52 +124462,39 @@ [] ], [ - "Variable", - {}, - [ - "t", - "1" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "6" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ + "WildcardPattern", [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "char" + ] + ], + [ + "char" + ] ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "bool" + [] ] ], - [] + [ + "x" + ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -110828,10 +124550,34 @@ ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "char" + ] + ], + [ + "char" + ] + ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -110856,7 +124602,41 @@ ] ], [] + ] + ], + [ + "y" + ] + ], + [ + "Apply", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] ], + [] + ], + [ + "Apply", [ "Function", {}, @@ -110910,91 +124690,177 @@ ], [] ] - ] - ], - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] ], [ + "Reference", [ - "basics" - ] - ], - [ - "greater", - "than" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ - [ + "Function", + {}, [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "char" + ] + ], + [ + "char" + ] + ], + [] ], [ - "s", - "d", - "k" + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "char" + ] + ], + [ + "char" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ] ] ], [ [ - "char" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "greater", + "than" ] - ], - [ - "char" ] ], - [] - ], - [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ [ + "Variable", [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "char" + ] + ], + [ + "char" + ] + ], + [] ], [ - "s", - "d", - "k" + "x" ] - ], + ] + ], + [ + "Variable", [ + "Reference", + {}, [ - "char" - ] + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "char" + ] + ], + [ + "char" + ] + ], + [] ], [ - "char" + "y" ] - ], - [] - ], - [ - "y" + ] ] ] ] @@ -111363,49 +125229,126 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" + "t", + "0" + ] + ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "1" + ] ], + [ + "Variable", + {}, + [ + "t", + "4" + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, [ [ [ - "morphir" + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] ], [ - "s", - "d", - "k" + "float" ] ], + [] + ], + [ + "Reference", + {}, [ [ - "basics" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" ] ], - [ - "float" - ] - ], - [] - ], - [ - "Variable", - {}, - [ - "t", - "0" + [] ] ] ], [ - [ - "y" - ], + "AsPattern", [ "Reference", {}, @@ -111432,52 +125375,39 @@ [] ], [ - "Variable", - {}, - [ - "t", - "1" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "6" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ + "WildcardPattern", [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "bool" + [] ] ], - [] + [ + "x" + ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -111533,10 +125463,34 @@ ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -111561,7 +125515,41 @@ ] ], [] + ] + ], + [ + "y" + ] + ], + [ + "Apply", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] ], + [] + ], + [ + "Apply", [ "Function", {}, @@ -111615,91 +125603,177 @@ ], [] ] - ] - ], - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] ], [ - "greater", - "than" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ + "Reference", [ + "Function", + {}, [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] ], [ - "s", - "d", - "k" + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ] ] ], [ [ - "basics" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "greater", + "than" ] - ], - [ - "float" ] ], - [] - ], - [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ [ + "Variable", [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] ], [ - "s", - "d", - "k" + "x" ] - ], + ] + ], + [ + "Variable", [ + "Reference", + {}, [ - "basics" - ] + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] ], [ - "float" + "y" ] - ], - [] - ], - [ - "y" + ] ] ] ] @@ -112068,17 +126142,27 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" - ], + "t", + "0" + ] + ], + [ + "Function", + {}, [ "Variable", {}, [ "t", - "2" + "1" ] ], [ @@ -112086,14 +126170,16 @@ {}, [ "t", - "0" + "4" ] ] - ], + ] + ], + "body": [ + "Lambda", [ - [ - "y" - ], + "Function", + {}, [ "Variable", {}, @@ -112103,52 +126189,70 @@ ] ], [ - "Variable", + "Function", {}, [ - "t", - "1" + "Variable", + {}, + [ + "t", + "2" + ] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] ] ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "6" - ] - ], - "body": [ - "Apply", + ], [ - "Reference", - {}, + "AsPattern", [ + "Variable", + {}, [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], + "t", + "2" + ] + ], + [ + "WildcardPattern", [ + "Variable", + {}, [ - "basics" + "t", + "2" ] - ], - [ - "bool" ] ], - [] + [ + "x" + ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -112187,10 +126291,17 @@ ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Variable", {}, + [ + "t", + "2" + ] + ], + [ + "WildcardPattern", [ "Variable", {}, @@ -112198,7 +126309,41 @@ "t", "2" ] + ] + ], + [ + "y" + ] + ], + [ + "Apply", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] ], + [] + ], + [ + "Apply", [ "Function", {}, @@ -112235,57 +126380,109 @@ ], [] ] - ] - ], - [ + ], [ + "Reference", [ - "morphir" + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "2" + ] + ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "2" + ] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ] + ] ], [ - "s", - "d", - "k" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "greater", + "than" + ] ] ], [ + "Variable", [ - "basics" + "Variable", + {}, + [ + "t", + "2" + ] + ], + [ + "x" ] - ], - [ - "greater", - "than" ] - ] - ], - [ - "Variable", + ], [ "Variable", - {}, [ - "t", - "2" + "Variable", + {}, + [ + "t", + "2" + ] + ], + [ + "y" ] - ], - [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Variable", - {}, - [ - "t", - "2" ] - ], - [ - "y" ] ] ] @@ -112569,11 +126766,44 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" + "t", + "0" + ] + ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "1" + ] ], + [ + "Variable", + {}, + [ + "t", + "4" + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -112603,24 +126833,77 @@ {}, [ "t", - "17" + "19" ] ] ] ], [ - "Variable", + "Function", {}, [ - "t", - "0" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Variable", + {}, + [ + "t", + "19" + ] + ] + ] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] ] ] ], [ - [ - "y" - ], + "AsPattern", [ "Reference", {}, @@ -112650,61 +126933,119 @@ {}, [ "t", - "17" + "19" ] ] ] ], [ - "Variable", - {}, + "WildcardPattern", [ - "t", - "1" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Variable", + {}, + [ + "t", + "19" + ] + ] + ] ] + ], + [ + "x" ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "6" - ] - ], - "body": [ - "Apply", + ], [ - "Reference", - {}, + "Lambda", [ + "Function", + {}, [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] ], [ - "s", - "d", - "k" + [ + "Variable", + {}, + [ + "t", + "19" + ] + ] ] ], [ + "Reference", + {}, [ - "basics" - ] - ], - [ - "bool" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] ] ], - [] - ], - [ - "Apply", [ - "Function", - {}, + "AsPattern", [ "Reference", {}, @@ -112734,11 +127075,54 @@ {}, [ "t", - "17" + "19" + ] + ] + ] + ], + [ + "WildcardPattern", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Variable", + {}, + [ + "t", + "19" + ] ] ] ] ], + [ + "y" + ] + ], + [ + "Apply", [ "Reference", {}, @@ -112755,24 +127139,183 @@ ], [ [ - "basics" + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ], + [ + "Apply", + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Variable", + {}, + [ + "t", + "19" + ] + ] + ] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ] + ], + [ + "Reference", + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Variable", + {}, + [ + "t", + "19" + ] + ] + ] + ], + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Variable", + {}, + [ + "t", + "19" + ] + ] + ] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ] ] ], - [ - "bool" - ] - ], - [] - ] - ], - [ - "Reference", - [ - "Function", - {}, - [ - "Reference", - {}, [ [ [ @@ -112786,27 +127329,17 @@ ], [ [ - "list" + "basics" ] ], [ - "list" - ] - ], - [ - [ - "Variable", - {}, - [ - "t", - "17" - ] + "greater", + "than" ] ] ], [ - "Function", - {}, + "Variable", [ "Reference", {}, @@ -112836,139 +127369,56 @@ {}, [ "t", - "17" + "19" ] ] ] ], [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "bool" - ] - ], - [] + "x" ] ] ], [ + "Variable", [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "greater", - "than" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "list" + ] + ], [ "list" ] ], [ - "list" - ] - ], - [ - [ - "Variable", - {}, [ - "t", - "17" + "Variable", + {}, + [ + "t", + "19" + ] ] ] - ] - ], - [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] ], [ - [ - "list" - ] - ], - [ - "list" - ] - ], - [ - [ - "Variable", - {}, - [ - "t", - "17" - ] + "y" ] ] - ], - [ - "y" ] ] ] @@ -113034,7 +127484,7 @@ {}, [ "t", - "17" + "19" ] ] ] @@ -113099,7 +127549,7 @@ {}, [ "t", - "17" + "19" ] ] ] @@ -113136,7 +127586,7 @@ {}, [ "t", - "17" + "19" ] ] ] @@ -113203,7 +127653,7 @@ {}, [ "t", - "17" + "19" ] ] ] @@ -113216,7 +127666,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -113231,7 +127681,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -113273,7 +127723,7 @@ {}, [ "t", - "17" + "19" ] ] ] @@ -113286,7 +127736,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -113301,7 +127751,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -113438,11 +127888,44 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "0" + ] + ], [ + "Function", + {}, [ - "x" + "Variable", + {}, + [ + "t", + "1" + ] ], + [ + "Variable", + {}, + [ + "t", + "4" + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -113469,18 +127952,62 @@ [] ], [ - "Variable", + "Function", {}, [ - "t", - "0" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] ] ] ], [ - [ - "y" - ], + "AsPattern", [ "Reference", {}, @@ -113507,52 +128034,39 @@ [] ], [ - "Variable", - {}, - [ - "t", - "1" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "6" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ + "WildcardPattern", [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "bool" + [] ] ], - [] + [ + "x" + ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -113608,10 +128122,34 @@ ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -113636,7 +128174,41 @@ ] ], [] + ] + ], + [ + "y" + ] + ], + [ + "Apply", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] ], + [] + ], + [ + "Apply", [ "Function", {}, @@ -113690,91 +128262,177 @@ ], [] ] - ] - ], - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] ], [ + "Reference", [ - "basics" - ] - ], - [ - "greater", - "than" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ - [ + "Function", + {}, [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] ], [ - "s", - "d", - "k" + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ] ] ], [ [ - "string" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "greater", + "than" ] - ], - [ - "string" ] ], - [] - ], - [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ [ + "Variable", [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] ], [ - "s", - "d", - "k" + "x" ] - ], + ] + ], + [ + "Variable", [ + "Reference", + {}, [ - "string" - ] + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] ], [ - "string" + "y" ] - ], - [] - ], - [ - "y" + ] ] ] ] @@ -114143,11 +128801,44 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" + "t", + "0" + ] + ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "1" + ] ], + [ + "Variable", + {}, + [ + "t", + "4" + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Tuple", {}, @@ -114157,7 +128848,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -114165,24 +128856,65 @@ {}, [ "t", - "16" + "18" ] ] ] ], [ - "Variable", + "Function", {}, [ - "t", - "0" + "Tuple", + {}, + [ + [ + "Variable", + {}, + [ + "t", + "19" + ] + ], + [ + "Variable", + {}, + [ + "t", + "18" + ] + ] + ] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] ] ] ], [ - [ - "y" - ], + "AsPattern", [ "Tuple", {}, @@ -114192,7 +128924,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -114200,58 +128932,42 @@ {}, [ "t", - "16" + "18" ] ] ] ], [ - "Variable", - {}, - [ - "t", - "1" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "6" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], + "WildcardPattern", [ + "Tuple", + {}, [ - "basics" + [ + "Variable", + {}, + [ + "t", + "19" + ] + ], + [ + "Variable", + {}, + [ + "t", + "18" + ] + ] ] - ], - [ - "bool" ] ], - [] + [ + "x" + ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -114264,7 +128980,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -114272,7 +128988,7 @@ {}, [ "t", - "16" + "18" ] ] ] @@ -114304,10 +129020,31 @@ ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Tuple", {}, + [ + [ + "Variable", + {}, + [ + "t", + "19" + ] + ], + [ + "Variable", + {}, + [ + "t", + "18" + ] + ] + ] + ], + [ + "WildcardPattern", [ "Tuple", {}, @@ -114317,7 +129054,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -114325,11 +129062,45 @@ {}, [ "t", - "16" + "18" ] ] ] + ] + ], + [ + "y" + ] + ], + [ + "Apply", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] ], + [] + ], + [ + "Apply", [ "Function", {}, @@ -114342,7 +129113,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -114350,7 +129121,7 @@ {}, [ "t", - "16" + "18" ] ] ] @@ -114380,85 +129151,165 @@ ], [] ] - ] - ], - [ + ], [ + "Reference", [ - "morphir" + "Function", + {}, + [ + "Tuple", + {}, + [ + [ + "Variable", + {}, + [ + "t", + "19" + ] + ], + [ + "Variable", + {}, + [ + "t", + "18" + ] + ] + ] + ], + [ + "Function", + {}, + [ + "Tuple", + {}, + [ + [ + "Variable", + {}, + [ + "t", + "19" + ] + ], + [ + "Variable", + {}, + [ + "t", + "18" + ] + ] + ] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ] + ] ], [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "greater", + "than" + ] ] ], [ - "greater", - "than" - ] - ] - ], - [ - "Variable", - [ - "Tuple", - {}, - [ + "Variable", [ - "Variable", + "Tuple", {}, [ - "t", - "17" + [ + "Variable", + {}, + [ + "t", + "19" + ] + ], + [ + "Variable", + {}, + [ + "t", + "18" + ] + ] ] ], [ - "Variable", - {}, - [ - "t", - "16" - ] + "x" ] ] ], [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Tuple", - {}, - [ + "Variable", [ - "Variable", + "Tuple", {}, [ - "t", - "17" + [ + "Variable", + {}, + [ + "t", + "19" + ] + ], + [ + "Variable", + {}, + [ + "t", + "18" + ] + ] ] ], [ - "Variable", - {}, - [ - "t", - "16" - ] + "y" ] ] - ], - [ - "y" ] ] ] @@ -114504,7 +129355,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -114512,7 +129363,7 @@ {}, [ "t", - "16" + "18" ] ] ] @@ -114557,7 +129408,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -114565,7 +129416,7 @@ {}, [ "t", - "16" + "18" ] ] ] @@ -114582,7 +129433,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -114590,7 +129441,7 @@ {}, [ "t", - "16" + "18" ] ] ] @@ -114637,7 +129488,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -114645,7 +129496,7 @@ {}, [ "t", - "16" + "18" ] ] ] @@ -114658,7 +129509,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -114673,7 +129524,7 @@ {}, [ "t", - "16" + "18" ] ], [ @@ -114695,7 +129546,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -114703,7 +129554,7 @@ {}, [ "t", - "16" + "18" ] ] ] @@ -114716,7 +129567,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -114731,7 +129582,7 @@ {}, [ "t", - "16" + "18" ] ], [ @@ -114867,11 +129718,32 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" - ], + "t", + "0" + ] + ], + [ + "Variable", + {}, + [ + "t", + "2" + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -114898,80 +129770,60 @@ [] ], [ - "Variable", + "Reference", {}, - [ - "t", - "0" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "3" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "char" + ] + ], [ "char" ] ], - [ - "char" - ] - ], - [] + [] + ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "char" - ] - ], + "s", + "d", + "k" + ] + ], + [ [ "char" ] ], - [] + [ + "char" + ] ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -114999,28 +129851,11 @@ ] ], [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "identity" - ] + "x" ] ], [ - "Variable", + "Apply", [ "Reference", {}, @@ -115047,7 +129882,112 @@ [] ], [ - "x" + "Reference", + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "char" + ] + ], + [ + "char" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "char" + ] + ], + [ + "char" + ] + ], + [] + ] + ], + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "identity" + ] + ] + ], + [ + "Variable", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "char" + ] + ], + [ + "char" + ] + ], + [] + ], + [ + "x" + ] ] ] ] @@ -115297,11 +130237,32 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" - ], + "t", + "0" + ] + ], + [ + "Variable", + {}, + [ + "t", + "2" + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -115328,80 +130289,60 @@ [] ], [ - "Variable", + "Reference", {}, - [ - "t", - "0" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "3" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "float" ] ], - [ - "float" - ] - ], - [] + [] + ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "basics" - ] - ], + "s", + "d", + "k" + ] + ], + [ [ - "float" + "basics" ] ], - [] + [ + "float" + ] ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -115429,31 +130370,92 @@ ] ], [ + "x" + ] + ], + [ + "Apply", + [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "basics" + ] + ], + [ + "float" ] ], + [] + ], + [ + "Reference", [ + "Function", + {}, [ - "basics" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] ] ], - [ - "identity" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, [ [ [ @@ -115471,13 +130473,40 @@ ] ], [ - "float" + "identity" ] - ], - [] + ] ], [ - "x" + "Variable", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "x" + ] ] ] ] @@ -115727,11 +130756,32 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" - ], + "t", + "0" + ] + ], + [ + "Variable", + {}, + [ + "t", + "2" + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -115758,80 +130808,60 @@ [] ], [ - "Variable", + "Reference", {}, - [ - "t", - "0" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "3" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "int" ] ], - [ - "int" - ] - ], - [] + [] + ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "basics" - ] - ], + "s", + "d", + "k" + ] + ], + [ [ - "int" + "basics" ] ], - [] + [ + "int" + ] ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -115859,31 +130889,92 @@ ] ], [ + "x" + ] + ], + [ + "Apply", + [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "basics" + ] + ], + [ + "int" ] ], + [] + ], + [ + "Reference", [ + "Function", + {}, [ - "basics" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ] ], - [ - "identity" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, [ [ [ @@ -115901,13 +130992,40 @@ ] ], [ - "int" + "identity" ] - ], - [] + ] ], [ - "x" + "Variable", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "x" + ] ] ] ] @@ -116181,11 +131299,32 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" - ], + "t", + "0" + ] + ], + [ + "Variable", + {}, + [ + "t", + "2" + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -116220,96 +131359,76 @@ ] ], [ - "Variable", + "Reference", {}, - [ - "t", - "0" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "3" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "list" + ] + ], [ "list" ] ], [ - "list" - ] - ], - [ - [ - "Variable", - {}, [ - "number" + "Variable", + {}, + [ + "number" + ] ] ] ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "list" - ] - ], + "s", + "d", + "k" + ] + ], + [ [ "list" ] ], [ + "list" + ] + ], + [ + [ + "Variable", + {}, [ - "Variable", - {}, - [ - "number" - ] + "number" ] ] - ], + ] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -116345,28 +131464,11 @@ ] ], [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "identity" - ] + "x" ] ], [ - "Variable", + "Apply", [ "Reference", {}, @@ -116401,7 +131503,136 @@ ] ], [ - "x" + "Reference", + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Variable", + {}, + [ + "number" + ] + ] + ] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Variable", + {}, + [ + "number" + ] + ] + ] + ] + ], + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "identity" + ] + ] + ], + [ + "Variable", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Variable", + {}, + [ + "number" + ] + ] + ] + ], + [ + "x" + ] ] ] ] @@ -116709,11 +131940,32 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" - ], + "t", + "0" + ] + ], + [ + "Variable", + {}, + [ + "t", + "2" + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -116740,80 +131992,60 @@ [] ], [ - "Variable", + "Reference", {}, - [ - "t", - "0" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "3" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "string" + ] + ], [ "string" ] ], - [ - "string" - ] - ], - [] + [] + ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "string" - ] - ], + "s", + "d", + "k" + ] + ], + [ [ "string" ] ], - [] + [ + "string" + ] ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -116841,28 +132073,11 @@ ] ], [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "identity" - ] + "x" ] ], [ - "Variable", + "Apply", [ "Reference", {}, @@ -116889,7 +132104,112 @@ [] ], [ - "x" + "Reference", + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ] + ], + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "identity" + ] + ] + ], + [ + "Variable", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ], + [ + "x" + ] ] ] ] @@ -117127,11 +132447,32 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" - ], + "t", + "0" + ] + ], + [ + "Variable", + {}, + [ + "t", + "2" + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Tuple", {}, @@ -117154,72 +132495,52 @@ ] ], [ - "Variable", + "Tuple", {}, [ - "t", - "0" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "3" - ] - ], - "body": [ - "Apply", - [ - "Tuple", - {}, - [ - [ - "Variable", - {}, [ - "number" - ] - ], - [ - "Variable", - {}, + "Variable", + {}, + [ + "number" + ] + ], [ - "number", - "1" + "Variable", + {}, + [ + "number", + "1" + ] ] ] ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Tuple", {}, [ - "Tuple", - {}, [ + "Variable", + {}, [ - "Variable", - {}, - [ - "number" - ] - ], + "number" + ] + ], + [ + "Variable", + {}, [ - "Variable", - {}, - [ - "number", - "1" - ] + "number", + "1" ] ] - ], + ] + ], + [ + "WildcardPattern", [ "Tuple", {}, @@ -117243,28 +132564,11 @@ ] ], [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "identity" - ] + "x" ] ], [ - "Variable", + "Apply", [ "Tuple", {}, @@ -117287,7 +132591,100 @@ ] ], [ - "x" + "Reference", + [ + "Function", + {}, + [ + "Tuple", + {}, + [ + [ + "Variable", + {}, + [ + "number" + ] + ], + [ + "Variable", + {}, + [ + "number", + "1" + ] + ] + ] + ], + [ + "Tuple", + {}, + [ + [ + "Variable", + {}, + [ + "number" + ] + ], + [ + "Variable", + {}, + [ + "number", + "1" + ] + ] + ] + ] + ], + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "identity" + ] + ] + ], + [ + "Variable", + [ + "Tuple", + {}, + [ + [ + "Variable", + {}, + [ + "number" + ] + ], + [ + "Variable", + {}, + [ + "number", + "1" + ] + ] + ] + ], + [ + "x" + ] ] ] ] @@ -117548,11 +132945,44 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" + "t", + "0" + ] + ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "1" + ] ], + [ + "Variable", + {}, + [ + "t", + "4" + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -117579,18 +133009,62 @@ [] ], [ - "Variable", + "Function", {}, [ - "t", - "0" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ] ] ], [ - [ - "y" - ], + "AsPattern", [ "Reference", {}, @@ -117617,52 +133091,39 @@ [] ], [ - "Variable", - {}, - [ - "t", - "1" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "6" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ + "WildcardPattern", [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "int" + [] ] ], - [] + [ + "x" + ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -117718,10 +133179,34 @@ ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -117746,7 +133231,41 @@ ] ], [] + ] + ], + [ + "y" + ] + ], + [ + "Apply", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] ], + [] + ], + [ + "Apply", [ "Function", {}, @@ -117800,90 +133319,176 @@ ], [] ] - ] - ], - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] ], [ - "add" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ + "Reference", [ + "Function", + {}, [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ], [ - "s", - "d", - "k" + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] ] ], [ [ - "basics" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "add" ] - ], - [ - "int" ] ], - [] - ], - [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ [ + "Variable", [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ], [ - "s", - "d", - "k" + "x" ] - ], + ] + ], + [ + "Variable", [ + "Reference", + {}, [ - "basics" - ] + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ], [ - "int" + "y" ] - ], - [] - ], - [ - "y" + ] ] ] ] @@ -118697,11 +134302,44 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" + "t", + "0" + ] + ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "1" + ] ], + [ + "Variable", + {}, + [ + "t", + "4" + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -118728,18 +134366,62 @@ [] ], [ - "Variable", + "Function", {}, [ - "t", - "0" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ] ] ], [ - [ - "y" - ], + "AsPattern", [ "Reference", {}, @@ -118766,52 +134448,39 @@ [] ], [ - "Variable", - {}, - [ - "t", - "1" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "6" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ + "WildcardPattern", [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "int" + [] ] ], - [] + [ + "x" + ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -118867,10 +134536,34 @@ ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -118895,7 +134588,41 @@ ] ], [] + ] + ], + [ + "y" + ] + ], + [ + "Apply", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] ], + [] + ], + [ + "Apply", [ "Function", {}, @@ -118949,91 +134676,177 @@ ], [] ] - ] - ], - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] ], [ - "integer", - "divide" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ + "Reference", [ + "Function", + {}, [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ], [ - "s", - "d", - "k" + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] ] ], [ [ - "basics" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "integer", + "divide" ] - ], - [ - "int" ] ], - [] - ], - [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ [ + "Variable", [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ], [ - "s", - "d", - "k" + "x" ] - ], + ] + ], + [ + "Variable", [ + "Reference", + {}, [ - "basics" - ] + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ], [ - "int" + "y" ] - ], - [] - ], - [ - "y" + ] ] ] ] @@ -119401,11 +135214,32 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" - ], + "t", + "0" + ] + ], + [ + "Variable", + {}, + [ + "t", + "2" + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -119432,55 +135266,197 @@ [] ], [ - "Variable", + "Reference", {}, [ - "t", - "0" - ] + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] ] - ] - ], - "outputType": [ - "Variable", - {}, + ], [ - "t", - "3" - ] - ], - "body": [ - "Apply", + "AsPattern", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "WildcardPattern", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ] + ], + [ + "x" + ] + ], [ - "Reference", - {}, + "Apply", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "basics" + ] + ], + [ + "bool" ] ], + [] + ], + [ + "Reference", [ + "Function", + {}, [ - "basics" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] ] ], [ - "bool" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "is", + "infinite" + ] ] ], - [] - ], - [ - "Reference", [ - "Function", - {}, + "Variable", [ "Reference", {}, @@ -119507,83 +135483,9 @@ [] ], [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "bool" - ] - ], - [] - ] - ], - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "is", - "infinite" + "x" ] ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "float" - ] - ], - [] - ], - [ - "x" - ] ] ] }, @@ -120056,11 +135958,32 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" - ], + "t", + "0" + ] + ], + [ + "Variable", + {}, + [ + "t", + "2" + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -120087,80 +136010,60 @@ [] ], [ - "Variable", + "Reference", {}, - [ - "t", - "0" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "3" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "bool" ] ], - [ - "bool" - ] - ], - [] + [] + ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "basics" - ] - ], + "s", + "d", + "k" + ] + ], + [ [ - "float" + "basics" ] ], - [] + [ + "float" + ] ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -120181,40 +136084,99 @@ ] ], [ - "bool" + "float" ] ], [] ] ], [ + "x" + ] + ], + [ + "Apply", + [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "basics" + ] + ], + [ + "bool" ] ], + [] + ], + [ + "Reference", [ + "Function", + {}, [ - "basics" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] ] ], - [ - "is", - "na", - "n" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, [ [ [ @@ -120232,13 +136194,42 @@ ] ], [ - "float" + "is", + "na", + "n" ] - ], - [] + ] ], [ - "x" + "Variable", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "x" + ] ] ] ] @@ -120714,11 +136705,44 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" + "t", + "0" + ] + ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "1" + ] ], + [ + "Variable", + {}, + [ + "t", + "4" + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -120745,18 +136769,62 @@ [] ], [ - "Variable", + "Function", {}, [ - "t", - "0" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "char" + ] + ], + [ + "char" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] ] ] ], [ - [ - "y" - ], + "AsPattern", [ "Reference", {}, @@ -120783,52 +136851,39 @@ [] ], [ - "Variable", - {}, - [ - "t", - "1" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "6" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ + "WildcardPattern", [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "char" + ] + ], + [ + "char" + ] ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "bool" + [] ] ], - [] + [ + "x" + ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -120884,10 +136939,34 @@ ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "char" + ] + ], + [ + "char" + ] + ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -120912,7 +136991,41 @@ ] ], [] + ] + ], + [ + "y" + ] + ], + [ + "Apply", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] ], + [] + ], + [ + "Apply", [ "Function", {}, @@ -120966,93 +137079,179 @@ ], [] ] - ] - ], - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] ], [ - "less", - "than", - "or", - "equal" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ + "Reference", [ + "Function", + {}, [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "char" + ] + ], + [ + "char" + ] + ], + [] ], [ - "s", - "d", - "k" + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "char" + ] + ], + [ + "char" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ] ] ], [ [ - "char" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "less", + "than", + "or", + "equal" ] - ], - [ - "char" ] ], - [] - ], - [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ [ + "Variable", [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "char" + ] + ], + [ + "char" + ] + ], + [] ], [ - "s", - "d", - "k" + "x" ] - ], + ] + ], + [ + "Variable", [ + "Reference", + {}, [ - "char" - ] + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "char" + ] + ], + [ + "char" + ] + ], + [] ], [ - "char" + "y" ] - ], - [] - ], - [ - "y" + ] ] ] ] @@ -121423,49 +137622,126 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" + "t", + "0" + ] + ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "1" + ] ], + [ + "Variable", + {}, + [ + "t", + "4" + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, [ [ [ - "morphir" + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] ], [ - "s", - "d", - "k" + "float" ] ], + [] + ], + [ + "Reference", + {}, [ [ - "basics" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" ] ], - [ - "float" - ] - ], - [] - ], - [ - "Variable", - {}, - [ - "t", - "0" + [] ] ] ], [ - [ - "y" - ], + "AsPattern", [ "Reference", {}, @@ -121492,52 +137768,39 @@ [] ], [ - "Variable", - {}, - [ - "t", - "1" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "6" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ + "WildcardPattern", [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "bool" + [] ] ], - [] + [ + "x" + ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -121593,10 +137856,34 @@ ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -121621,7 +137908,41 @@ ] ], [] + ] + ], + [ + "y" + ] + ], + [ + "Apply", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] ], + [] + ], + [ + "Apply", [ "Function", {}, @@ -121675,93 +137996,179 @@ ], [] ] - ] - ], - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] ], [ - "less", - "than", - "or", - "equal" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ + "Reference", [ + "Function", + {}, [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] ], [ - "s", - "d", - "k" + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ] ] ], [ [ - "basics" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "less", + "than", + "or", + "equal" ] - ], - [ - "float" ] ], - [] - ], - [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ [ + "Variable", [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] ], [ - "s", - "d", - "k" + "x" ] - ], + ] + ], + [ + "Variable", [ + "Reference", + {}, [ - "basics" - ] + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] ], [ - "float" + "y" ] - ], - [] - ], - [ - "y" + ] ] ] ] @@ -122132,17 +138539,27 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" - ], + "t", + "0" + ] + ], + [ + "Function", + {}, [ "Variable", {}, [ "t", - "2" + "1" ] ], [ @@ -122150,14 +138567,16 @@ {}, [ "t", - "0" + "4" ] ] - ], + ] + ], + "body": [ + "Lambda", [ - [ - "y" - ], + "Function", + {}, [ "Variable", {}, @@ -122167,52 +138586,70 @@ ] ], [ - "Variable", + "Function", {}, [ - "t", - "1" + "Variable", + {}, + [ + "t", + "2" + ] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] ] ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "6" - ] - ], - "body": [ - "Apply", + ], [ - "Reference", - {}, + "AsPattern", [ + "Variable", + {}, [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], + "t", + "2" + ] + ], + [ + "WildcardPattern", [ + "Variable", + {}, [ - "basics" + "t", + "2" ] - ], - [ - "bool" ] ], - [] + [ + "x" + ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -122251,10 +138688,17 @@ ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Variable", {}, + [ + "t", + "2" + ] + ], + [ + "WildcardPattern", [ "Variable", {}, @@ -122262,7 +138706,41 @@ "t", "2" ] + ] + ], + [ + "y" + ] + ], + [ + "Apply", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] ], + [] + ], + [ + "Apply", [ "Function", {}, @@ -122299,60 +138777,112 @@ ], [] ] - ] - ], - [ + ], [ + "Reference", [ - "morphir" + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "2" + ] + ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "2" + ] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ] + ] ], [ - "s", - "d", - "k" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "less", + "than", + "or", + "equal" + ] ] ], [ + "Variable", [ - "basics" + "Variable", + {}, + [ + "t", + "2" + ] + ], + [ + "x" ] - ], - [ - "less", - "than", - "or", - "equal" ] - ] - ], - [ - "Variable", + ], [ "Variable", - {}, [ - "t", - "2" + "Variable", + {}, + [ + "t", + "2" + ] + ], + [ + "y" ] - ], - [ - "x" ] ] - ], - [ - "Variable", - [ - "Variable", - {}, - [ - "t", - "2" - ] - ], - [ - "y" - ] ] ] }, @@ -122637,11 +139167,44 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" + "t", + "0" + ] + ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "1" + ] ], + [ + "Variable", + {}, + [ + "t", + "4" + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -122671,24 +139234,77 @@ {}, [ "t", - "17" + "19" ] ] ] ], [ - "Variable", + "Function", {}, [ - "t", - "0" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Variable", + {}, + [ + "t", + "19" + ] + ] + ] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] ] ] ], [ - [ - "y" - ], + "AsPattern", [ "Reference", {}, @@ -122718,61 +139334,119 @@ {}, [ "t", - "17" + "19" ] ] ] ], [ - "Variable", - {}, + "WildcardPattern", [ - "t", - "1" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Variable", + {}, + [ + "t", + "19" + ] + ] + ] ] + ], + [ + "x" ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "6" - ] - ], - "body": [ - "Apply", + ], [ - "Reference", - {}, + "Lambda", [ + "Function", + {}, [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] ], [ - "s", - "d", - "k" + [ + "Variable", + {}, + [ + "t", + "19" + ] + ] ] ], [ + "Reference", + {}, [ - "basics" - ] - ], - [ - "bool" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] ] ], - [] - ], - [ - "Apply", [ - "Function", - {}, + "AsPattern", [ "Reference", {}, @@ -122802,11 +139476,54 @@ {}, [ "t", - "17" + "19" + ] + ] + ] + ], + [ + "WildcardPattern", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Variable", + {}, + [ + "t", + "19" + ] ] ] ] ], + [ + "y" + ] + ], + [ + "Apply", [ "Reference", {}, @@ -122823,24 +139540,183 @@ ], [ [ - "basics" + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ], + [ + "Apply", + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Variable", + {}, + [ + "t", + "19" + ] + ] + ] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ] + ], + [ + "Reference", + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Variable", + {}, + [ + "t", + "19" + ] + ] + ] + ], + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Variable", + {}, + [ + "t", + "19" + ] + ] + ] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ] ] ], - [ - "bool" - ] - ], - [] - ] - ], - [ - "Reference", - [ - "Function", - {}, - [ - "Reference", - {}, [ [ [ @@ -122854,27 +139730,19 @@ ], [ [ - "list" + "basics" ] ], [ - "list" - ] - ], - [ - [ - "Variable", - {}, - [ - "t", - "17" - ] + "less", + "than", + "or", + "equal" ] ] ], [ - "Function", - {}, + "Variable", [ "Reference", {}, @@ -122904,141 +139772,56 @@ {}, [ "t", - "17" + "19" ] ] ] ], [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "bool" - ] - ], - [] + "x" ] ] ], [ + "Variable", [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "less", - "than", - "or", - "equal" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "list" + ] + ], [ "list" ] ], [ - "list" - ] - ], - [ - [ - "Variable", - {}, [ - "t", - "17" + "Variable", + {}, + [ + "t", + "19" + ] ] ] - ] - ], - [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "list" - ] ], [ - "list" - ] - ], - [ - [ - "Variable", - {}, - [ - "t", - "17" - ] + "y" ] ] - ], - [ - "y" ] ] ] @@ -123104,7 +139887,7 @@ {}, [ "t", - "17" + "19" ] ] ] @@ -123169,7 +139952,7 @@ {}, [ "t", - "17" + "19" ] ] ] @@ -123206,7 +139989,7 @@ {}, [ "t", - "17" + "19" ] ] ] @@ -123273,7 +140056,7 @@ {}, [ "t", - "17" + "19" ] ] ] @@ -123286,7 +140069,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -123301,7 +140084,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -123343,7 +140126,7 @@ {}, [ "t", - "17" + "19" ] ] ] @@ -123356,7 +140139,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -123371,7 +140154,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -123510,11 +140293,44 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "0" + ] + ], [ + "Function", + {}, [ - "x" + "Variable", + {}, + [ + "t", + "1" + ] ], + [ + "Variable", + {}, + [ + "t", + "4" + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -123541,18 +140357,62 @@ [] ], [ - "Variable", + "Function", {}, [ - "t", - "0" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] ] ] ], [ - [ - "y" - ], + "AsPattern", [ "Reference", {}, @@ -123579,52 +140439,39 @@ [] ], [ - "Variable", - {}, - [ - "t", - "1" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "6" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ + "WildcardPattern", [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "bool" + [] ] ], - [] + [ + "x" + ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -123680,10 +140527,34 @@ ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -123708,7 +140579,41 @@ ] ], [] + ] + ], + [ + "y" + ] + ], + [ + "Apply", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] ], + [] + ], + [ + "Apply", [ "Function", {}, @@ -123762,93 +140667,179 @@ ], [] ] - ] - ], - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] ], [ - "less", - "than", - "or", - "equal" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ + "Reference", [ + "Function", + {}, [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] ], [ - "s", - "d", - "k" + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ] ] ], [ [ - "string" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "less", + "than", + "or", + "equal" ] - ], - [ - "string" ] ], - [] - ], - [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ [ + "Variable", [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] ], [ - "s", - "d", - "k" + "x" ] - ], + ] + ], + [ + "Variable", [ + "Reference", + {}, [ - "string" - ] + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] ], [ - "string" + "y" ] - ], - [] - ], - [ - "y" + ] ] ] ] @@ -124219,11 +141210,44 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" + "t", + "0" + ] + ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "1" + ] ], + [ + "Variable", + {}, + [ + "t", + "4" + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Tuple", {}, @@ -124233,7 +141257,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -124241,24 +141265,65 @@ {}, [ "t", - "16" + "18" ] ] ] ], [ - "Variable", + "Function", {}, [ - "t", - "0" + "Tuple", + {}, + [ + [ + "Variable", + {}, + [ + "t", + "19" + ] + ], + [ + "Variable", + {}, + [ + "t", + "18" + ] + ] + ] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] ] ] ], [ - [ - "y" - ], + "AsPattern", [ "Tuple", {}, @@ -124268,7 +141333,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -124276,58 +141341,42 @@ {}, [ "t", - "16" + "18" ] ] ] ], [ - "Variable", - {}, - [ - "t", - "1" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "6" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], + "WildcardPattern", [ + "Tuple", + {}, [ - "basics" + [ + "Variable", + {}, + [ + "t", + "19" + ] + ], + [ + "Variable", + {}, + [ + "t", + "18" + ] + ] ] - ], - [ - "bool" ] ], - [] + [ + "x" + ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -124340,7 +141389,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -124348,7 +141397,7 @@ {}, [ "t", - "16" + "18" ] ] ] @@ -124380,10 +141429,31 @@ ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Tuple", {}, + [ + [ + "Variable", + {}, + [ + "t", + "19" + ] + ], + [ + "Variable", + {}, + [ + "t", + "18" + ] + ] + ] + ], + [ + "WildcardPattern", [ "Tuple", {}, @@ -124393,7 +141463,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -124401,11 +141471,45 @@ {}, [ "t", - "16" + "18" ] ] ] + ] + ], + [ + "y" + ] + ], + [ + "Apply", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] ], + [] + ], + [ + "Apply", [ "Function", {}, @@ -124418,7 +141522,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -124426,7 +141530,7 @@ {}, [ "t", - "16" + "18" ] ] ] @@ -124456,87 +141560,167 @@ ], [] ] - ] - ], - [ + ], [ + "Reference", [ - "morphir" + "Function", + {}, + [ + "Tuple", + {}, + [ + [ + "Variable", + {}, + [ + "t", + "19" + ] + ], + [ + "Variable", + {}, + [ + "t", + "18" + ] + ] + ] + ], + [ + "Function", + {}, + [ + "Tuple", + {}, + [ + [ + "Variable", + {}, + [ + "t", + "19" + ] + ], + [ + "Variable", + {}, + [ + "t", + "18" + ] + ] + ] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ] + ] ], [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "less", + "than", + "or", + "equal" + ] ] ], [ - "less", - "than", - "or", - "equal" - ] - ] - ], - [ - "Variable", - [ - "Tuple", - {}, - [ + "Variable", [ - "Variable", + "Tuple", {}, [ - "t", - "17" + [ + "Variable", + {}, + [ + "t", + "19" + ] + ], + [ + "Variable", + {}, + [ + "t", + "18" + ] + ] ] ], [ - "Variable", - {}, - [ - "t", - "16" - ] + "x" ] ] ], [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Tuple", - {}, - [ + "Variable", [ - "Variable", + "Tuple", {}, [ - "t", - "17" + [ + "Variable", + {}, + [ + "t", + "19" + ] + ], + [ + "Variable", + {}, + [ + "t", + "18" + ] + ] ] ], [ - "Variable", - {}, - [ - "t", - "16" - ] + "y" ] ] - ], - [ - "y" ] ] ] @@ -124582,7 +141766,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -124590,7 +141774,7 @@ {}, [ "t", - "16" + "18" ] ] ] @@ -124635,7 +141819,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -124643,7 +141827,7 @@ {}, [ "t", - "16" + "18" ] ] ] @@ -124660,7 +141844,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -124668,7 +141852,7 @@ {}, [ "t", - "16" + "18" ] ] ] @@ -124715,7 +141899,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -124723,7 +141907,7 @@ {}, [ "t", - "16" + "18" ] ] ] @@ -124736,7 +141920,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -124751,7 +141935,7 @@ {}, [ "t", - "16" + "18" ] ], [ @@ -124773,7 +141957,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -124781,7 +141965,7 @@ {}, [ "t", - "16" + "18" ] ] ] @@ -124794,7 +141978,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -124809,7 +141993,7 @@ {}, [ "t", - "16" + "18" ] ], [ @@ -124946,11 +142130,44 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" + "t", + "0" + ] + ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "1" + ] ], + [ + "Variable", + {}, + [ + "t", + "4" + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -124977,18 +142194,62 @@ [] ], [ - "Variable", + "Function", {}, [ - "t", - "0" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "char" + ] + ], + [ + "char" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] ] ] ], [ - [ - "y" - ], + "AsPattern", [ "Reference", {}, @@ -125015,52 +142276,39 @@ [] ], [ - "Variable", - {}, - [ - "t", - "1" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "6" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ + "WildcardPattern", [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "char" + ] + ], + [ + "char" + ] ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "bool" + [] ] ], - [] + [ + "x" + ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -125116,10 +142364,34 @@ ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "char" + ] + ], + [ + "char" + ] + ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -125144,7 +142416,41 @@ ] ], [] + ] + ], + [ + "y" + ] + ], + [ + "Apply", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] ], + [] + ], + [ + "Apply", [ "Function", {}, @@ -125198,91 +142504,177 @@ ], [] ] - ] - ], - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] ], [ - "less", - "than" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ + "Reference", [ + "Function", + {}, [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "char" + ] + ], + [ + "char" + ] + ], + [] ], [ - "s", - "d", - "k" + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "char" + ] + ], + [ + "char" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ] ] ], [ [ - "char" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "less", + "than" ] - ], - [ - "char" ] ], - [] - ], - [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ [ + "Variable", [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "char" + ] + ], + [ + "char" + ] + ], + [] ], [ - "s", - "d", - "k" + "x" ] - ], + ] + ], + [ + "Variable", [ + "Reference", + {}, [ - "char" - ] + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "char" + ] + ], + [ + "char" + ] + ], + [] ], [ - "char" + "y" ] - ], - [] - ], - [ - "y" + ] ] ] ] @@ -125651,11 +143043,44 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" + "t", + "0" + ] + ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "1" + ] ], + [ + "Variable", + {}, + [ + "t", + "4" + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -125682,18 +143107,62 @@ [] ], [ - "Variable", + "Function", {}, [ - "t", - "0" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] ] ] ], [ - [ - "y" - ], + "AsPattern", [ "Reference", {}, @@ -125720,52 +143189,39 @@ [] ], [ - "Variable", - {}, - [ - "t", - "1" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "6" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ + "WildcardPattern", [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "bool" + [] ] ], - [] + [ + "x" + ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -125821,10 +143277,34 @@ ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -125849,7 +143329,41 @@ ] ], [] + ] + ], + [ + "y" + ] + ], + [ + "Apply", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] ], + [] + ], + [ + "Apply", [ "Function", {}, @@ -125903,91 +143417,177 @@ ], [] ] - ] - ], - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] ], [ - "less", - "than" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ + "Reference", [ + "Function", + {}, [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] ], [ - "s", - "d", - "k" + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ] ] ], [ [ - "basics" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "less", + "than" ] - ], - [ - "float" ] ], - [] - ], - [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ [ + "Variable", [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] ], [ - "s", - "d", - "k" + "x" ] - ], + ] + ], + [ + "Variable", [ + "Reference", + {}, [ - "basics" - ] + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] ], [ - "float" + "y" ] - ], - [] - ], - [ - "y" + ] ] ] ] @@ -126356,17 +143956,27 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" - ], + "t", + "0" + ] + ], + [ + "Function", + {}, [ "Variable", {}, [ "t", - "2" + "1" ] ], [ @@ -126374,14 +143984,16 @@ {}, [ "t", - "0" + "4" ] ] - ], + ] + ], + "body": [ + "Lambda", [ - [ - "y" - ], + "Function", + {}, [ "Variable", {}, @@ -126391,52 +144003,70 @@ ] ], [ - "Variable", + "Function", {}, [ - "t", - "1" + "Variable", + {}, + [ + "t", + "2" + ] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] ] ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "6" - ] - ], - "body": [ - "Apply", + ], [ - "Reference", - {}, + "AsPattern", [ + "Variable", + {}, [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], + "t", + "2" + ] + ], + [ + "WildcardPattern", [ + "Variable", + {}, [ - "basics" + "t", + "2" ] - ], - [ - "bool" ] ], - [] + [ + "x" + ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -126475,10 +144105,17 @@ ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Variable", {}, + [ + "t", + "2" + ] + ], + [ + "WildcardPattern", [ "Variable", {}, @@ -126486,7 +144123,41 @@ "t", "2" ] + ] + ], + [ + "y" + ] + ], + [ + "Apply", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] ], + [] + ], + [ + "Apply", [ "Function", {}, @@ -126523,58 +144194,110 @@ ], [] ] - ] - ], - [ + ], [ + "Reference", [ - "morphir" + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "2" + ] + ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "2" + ] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ] + ] ], [ - "s", - "d", - "k" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "less", + "than" + ] ] ], [ + "Variable", [ - "basics" + "Variable", + {}, + [ + "t", + "2" + ] + ], + [ + "x" ] - ], - [ - "less", - "than" ] - ] - ], - [ - "Variable", + ], [ "Variable", - {}, [ - "t", - "2" + "Variable", + {}, + [ + "t", + "2" + ] + ], + [ + "y" ] - ], - [ - "x" ] ] - ], - [ - "Variable", - [ - "Variable", - {}, - [ - "t", - "2" - ] - ], - [ - "y" - ] ] ] }, @@ -126857,11 +144580,44 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" + "t", + "0" + ] + ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "1" + ] ], + [ + "Variable", + {}, + [ + "t", + "4" + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -126891,24 +144647,77 @@ {}, [ "t", - "17" + "19" ] ] ] ], [ - "Variable", + "Function", {}, [ - "t", - "0" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Variable", + {}, + [ + "t", + "19" + ] + ] + ] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] ] ] ], [ - [ - "y" - ], + "AsPattern", [ "Reference", {}, @@ -126938,58 +144747,54 @@ {}, [ "t", - "17" + "19" ] ] ] ], [ - "Variable", - {}, - [ - "t", - "1" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "6" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ + "WildcardPattern", [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] ], [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" + [ + "Variable", + {}, + [ + "t", + "19" + ] + ] ] - ], - [ - "bool" ] ], - [] + [ + "x" + ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -127022,7 +144827,7 @@ {}, [ "t", - "17" + "19" ] ] ] @@ -127054,10 +144859,43 @@ ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Variable", + {}, + [ + "t", + "19" + ] + ] + ] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -127087,11 +144925,45 @@ {}, [ "t", - "17" + "19" ] ] ] + ] + ], + [ + "y" + ] + ], + [ + "Apply", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] ], + [] + ], + [ + "Apply", [ "Function", {}, @@ -127124,139 +144996,243 @@ {}, [ "t", - "17" + "19" + ] + ] + ] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ] + ], + [ + "Reference", + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Variable", + {}, + [ + "t", + "19" + ] + ] + ] + ], + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Variable", + {}, + [ + "t", + "19" + ] + ] + ] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ] + ] + ], + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "less", + "than" + ] + ] + ], + [ + "Variable", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Variable", + {}, + [ + "t", + "19" ] ] ] ], [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "bool" - ] - ], - [] + "x" ] ] ], [ + "Variable", [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "less", - "than" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "list" + ] + ], [ "list" ] ], [ - "list" - ] - ], - [ - [ - "Variable", - {}, [ - "t", - "17" + "Variable", + {}, + [ + "t", + "19" + ] ] ] - ] - ], - [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] ], [ - [ - "list" - ] - ], - [ - "list" - ] - ], - [ - [ - "Variable", - {}, - [ - "t", - "17" - ] + "y" ] ] - ], - [ - "y" ] ] ] @@ -127322,7 +145298,7 @@ {}, [ "t", - "17" + "19" ] ] ] @@ -127387,7 +145363,7 @@ {}, [ "t", - "17" + "19" ] ] ] @@ -127424,7 +145400,7 @@ {}, [ "t", - "17" + "19" ] ] ] @@ -127491,7 +145467,7 @@ {}, [ "t", - "17" + "19" ] ] ] @@ -127504,7 +145480,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -127519,7 +145495,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -127561,7 +145537,7 @@ {}, [ "t", - "17" + "19" ] ] ] @@ -127574,7 +145550,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -127589,7 +145565,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -127726,11 +145702,44 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" + "t", + "0" + ] + ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "1" + ] ], + [ + "Variable", + {}, + [ + "t", + "4" + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -127757,18 +145766,62 @@ [] ], [ - "Variable", + "Function", {}, [ - "t", - "0" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] ] ] ], [ - [ - "y" - ], + "AsPattern", [ "Reference", {}, @@ -127795,52 +145848,39 @@ [] ], [ - "Variable", - {}, - [ - "t", - "1" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "6" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], + "WildcardPattern", [ + "Reference", + {}, [ - "basics" - ] - ], - [ - "bool" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] ] ], - [] + [ + "x" + ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -127896,10 +145936,34 @@ ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -127924,7 +145988,41 @@ ] ], [] + ] + ], + [ + "y" + ] + ], + [ + "Apply", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] ], + [] + ], + [ + "Apply", [ "Function", {}, @@ -127978,91 +146076,177 @@ ], [] ] - ] - ], - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] ], [ - "less", - "than" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ + "Reference", [ + "Function", + {}, [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] ], [ - "s", - "d", - "k" + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ] ] ], [ [ - "string" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "less", + "than" ] - ], - [ - "string" ] ], - [] - ], - [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ [ + "Variable", [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] ], [ - "s", - "d", - "k" + "x" ] - ], + ] + ], + [ + "Variable", [ + "Reference", + {}, [ - "string" - ] + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] ], [ - "string" + "y" ] - ], - [] - ], - [ - "y" + ] ] ] ] @@ -128431,11 +146615,44 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" + "t", + "0" + ] + ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "1" + ] ], + [ + "Variable", + {}, + [ + "t", + "4" + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Tuple", {}, @@ -128445,7 +146662,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -128453,24 +146670,65 @@ {}, [ "t", - "16" + "18" ] ] ] ], [ - "Variable", + "Function", {}, [ - "t", - "0" + "Tuple", + {}, + [ + [ + "Variable", + {}, + [ + "t", + "19" + ] + ], + [ + "Variable", + {}, + [ + "t", + "18" + ] + ] + ] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] ] ] ], [ - [ - "y" - ], + "AsPattern", [ "Tuple", {}, @@ -128480,7 +146738,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -128488,58 +146746,42 @@ {}, [ "t", - "16" + "18" ] ] ] ], [ - "Variable", - {}, - [ - "t", - "1" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "6" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], + "WildcardPattern", [ + "Tuple", + {}, [ - "basics" + [ + "Variable", + {}, + [ + "t", + "19" + ] + ], + [ + "Variable", + {}, + [ + "t", + "18" + ] + ] ] - ], - [ - "bool" ] ], - [] + [ + "x" + ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -128552,7 +146794,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -128560,7 +146802,7 @@ {}, [ "t", - "16" + "18" ] ] ] @@ -128592,10 +146834,31 @@ ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Tuple", {}, + [ + [ + "Variable", + {}, + [ + "t", + "19" + ] + ], + [ + "Variable", + {}, + [ + "t", + "18" + ] + ] + ] + ], + [ + "WildcardPattern", [ "Tuple", {}, @@ -128605,7 +146868,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -128613,11 +146876,45 @@ {}, [ "t", - "16" + "18" ] ] ] + ] + ], + [ + "y" + ] + ], + [ + "Apply", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] ], + [] + ], + [ + "Apply", [ "Function", {}, @@ -128630,7 +146927,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -128638,7 +146935,7 @@ {}, [ "t", - "16" + "18" ] ] ] @@ -128668,85 +146965,165 @@ ], [] ] - ] - ], - [ + ], [ + "Reference", [ - "morphir" + "Function", + {}, + [ + "Tuple", + {}, + [ + [ + "Variable", + {}, + [ + "t", + "19" + ] + ], + [ + "Variable", + {}, + [ + "t", + "18" + ] + ] + ] + ], + [ + "Function", + {}, + [ + "Tuple", + {}, + [ + [ + "Variable", + {}, + [ + "t", + "19" + ] + ], + [ + "Variable", + {}, + [ + "t", + "18" + ] + ] + ] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ] + ] ], [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "less", + "than" + ] ] ], [ - "less", - "than" - ] - ] - ], - [ - "Variable", - [ - "Tuple", - {}, - [ + "Variable", [ - "Variable", + "Tuple", {}, [ - "t", - "17" + [ + "Variable", + {}, + [ + "t", + "19" + ] + ], + [ + "Variable", + {}, + [ + "t", + "18" + ] + ] ] ], [ - "Variable", - {}, - [ - "t", - "16" - ] + "x" ] ] ], [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Tuple", - {}, - [ + "Variable", [ - "Variable", + "Tuple", {}, [ - "t", - "17" + [ + "Variable", + {}, + [ + "t", + "19" + ] + ], + [ + "Variable", + {}, + [ + "t", + "18" + ] + ] ] ], [ - "Variable", - {}, - [ - "t", - "16" - ] + "y" ] ] - ], - [ - "y" ] ] ] @@ -128792,7 +147169,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -128800,7 +147177,7 @@ {}, [ "t", - "16" + "18" ] ] ] @@ -128845,7 +147222,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -128853,7 +147230,7 @@ {}, [ "t", - "16" + "18" ] ] ] @@ -128870,7 +147247,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -128878,7 +147255,7 @@ {}, [ "t", - "16" + "18" ] ] ] @@ -128925,7 +147302,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -128933,7 +147310,7 @@ {}, [ "t", - "16" + "18" ] ] ] @@ -128946,7 +147323,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -128961,7 +147338,7 @@ {}, [ "t", - "16" + "18" ] ], [ @@ -128983,7 +147360,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -128991,7 +147368,7 @@ {}, [ "t", - "16" + "18" ] ] ] @@ -129004,7 +147381,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -129019,7 +147396,7 @@ {}, [ "t", - "16" + "18" ] ], [ @@ -129155,11 +147532,44 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" + "t", + "0" + ] + ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "1" + ] ], + [ + "Variable", + {}, + [ + "t", + "4" + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -129186,18 +147596,62 @@ [] ], [ - "Variable", + "Function", {}, [ - "t", - "0" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] ] ] ], [ - [ - "y" - ], + "AsPattern", [ "Reference", {}, @@ -129224,52 +147678,39 @@ [] ], [ - "Variable", - {}, - [ - "t", - "1" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "6" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ + "WildcardPattern", [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "float" + [] ] ], - [] + [ + "x" + ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -129325,10 +147766,34 @@ ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -129353,7 +147818,41 @@ ] ], [] + ] + ], + [ + "y" + ] + ], + [ + "Apply", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] ], + [] + ], + [ + "Apply", [ "Function", {}, @@ -129406,92 +147905,178 @@ ] ], [] - ] - ] - ], - [ - [ - [ - "morphir" + ] + ], + [ + "Reference", + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ] + ] + ], + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "log", + "base" + ] + ] + ], + [ + "Variable", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] ], [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" + "x" ] - ], - [ - "log", - "base" ] - ] - ], - [ - "Variable", + ], [ - "Reference", - {}, + "Variable", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "float" ] ], - [ - "float" - ] - ], - [] - ], - [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] + [] ], [ - "float" + "y" ] - ], - [] - ], - [ - "y" + ] ] ] ] @@ -129860,11 +148445,44 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" + "t", + "0" + ] + ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "1" + ] ], + [ + "Variable", + {}, + [ + "t", + "4" + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -129891,18 +148509,62 @@ [] ], [ - "Variable", + "Function", {}, [ - "t", - "0" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] ] ] ], [ - [ - "y" - ], + "AsPattern", [ "Reference", {}, @@ -129929,52 +148591,39 @@ [] ], [ - "Variable", - {}, - [ - "t", - "1" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "6" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ + "WildcardPattern", [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "float" + [] ] ], - [] + [ + "x" + ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -130002,7 +148651,35 @@ ] ], [] - ], + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ] + ], + [ + "AsPattern", [ "Reference", {}, @@ -130027,13 +148704,9 @@ ] ], [] - ] - ], - [ - "Reference", + ], [ - "Function", - {}, + "WildcardPattern", [ "Reference", {}, @@ -130058,7 +148731,41 @@ ] ], [] + ] + ], + [ + "y" + ] + ], + [ + "Apply", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] ], + [] + ], + [ + "Apply", [ "Function", {}, @@ -130112,91 +148819,177 @@ ], [] ] - ] - ], - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] ], [ - "log", - "base" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ + "Reference", [ + "Function", + {}, [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] ], [ - "s", - "d", - "k" + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ] ] ], [ [ - "basics" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "log", + "base" ] - ], - [ - "float" ] ], - [] - ], - [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ [ + "Variable", [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] ], [ - "s", - "d", - "k" + "x" ] - ], + ] + ], + [ + "Variable", [ + "Reference", + {}, [ - "basics" - ] + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] ], [ - "float" + "y" ] - ], - [] - ], - [ - "y" + ] ] ] ] @@ -130564,11 +149357,44 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" + "t", + "0" + ] + ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "1" + ] ], + [ + "Variable", + {}, + [ + "t", + "4" + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -130595,18 +149421,62 @@ [] ], [ - "Variable", + "Function", {}, [ - "t", - "0" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "char" + ] + ], + [ + "char" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "char" + ] + ], + [ + "char" + ] + ], + [] ] ] ], [ - [ - "y" - ], + "AsPattern", [ "Reference", {}, @@ -130633,52 +149503,39 @@ [] ], [ - "Variable", - {}, - [ - "t", - "1" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "6" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ + "WildcardPattern", [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "char" + ] + ], + [ + "char" + ] ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "char" - ] - ], - [ - "char" + [] ] ], - [] + [ + "x" + ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -130734,10 +149591,34 @@ ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "char" + ] + ], + [ + "char" + ] + ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -130762,7 +149643,41 @@ ] ], [] + ] + ], + [ + "y" + ] + ], + [ + "Apply", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "char" + ] + ], + [ + "char" + ] ], + [] + ], + [ + "Apply", [ "Function", {}, @@ -130816,90 +149731,176 @@ ], [] ] - ] - ], - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] ], [ - "max" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ + "Reference", [ + "Function", + {}, [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "char" + ] + ], + [ + "char" + ] + ], + [] ], [ - "s", - "d", - "k" + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "char" + ] + ], + [ + "char" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "char" + ] + ], + [ + "char" + ] + ], + [] + ] ] ], [ [ - "char" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "max" ] - ], - [ - "char" ] ], - [] - ], - [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ [ + "Variable", [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "char" + ] + ], + [ + "char" + ] + ], + [] ], [ - "s", - "d", - "k" + "x" ] - ], + ] + ], + [ + "Variable", [ + "Reference", + {}, [ - "char" - ] + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "char" + ] + ], + [ + "char" + ] + ], + [] ], [ - "char" + "y" ] - ], - [] - ], - [ - "y" + ] ] ] ] @@ -131267,11 +150268,44 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" + "t", + "0" + ] + ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "1" + ] ], + [ + "Variable", + {}, + [ + "t", + "4" + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -131298,18 +150332,62 @@ [] ], [ - "Variable", + "Function", {}, [ - "t", - "0" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] ] ] ], [ - [ - "y" - ], + "AsPattern", [ "Reference", {}, @@ -131336,52 +150414,39 @@ [] ], [ - "Variable", - {}, - [ - "t", - "1" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "6" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ + "WildcardPattern", [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "float" + [] ] ], - [] + [ + "x" + ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -131437,10 +150502,34 @@ ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -131465,7 +150554,41 @@ ] ], [] + ] + ], + [ + "y" + ] + ], + [ + "Apply", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] ], + [] + ], + [ + "Apply", [ "Function", {}, @@ -131492,8 +150615,142 @@ "float" ] ], - [] - ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ] + ], + [ + "Reference", + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ] + ] + ], + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "max" + ] + ] + ], + [ + "Variable", [ "Reference", {}, @@ -131518,91 +150775,43 @@ ] ], [] - ] - ] - ], - [ - [ - [ - "morphir" ], [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" + "x" ] - ], - [ - "max" ] - ] - ], - [ - "Variable", + ], [ - "Reference", - {}, + "Variable", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "float" ] ], - [ - "float" - ] - ], - [] - ], - [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] + [] ], [ - "float" + "y" ] - ], - [] - ], - [ - "y" + ] ] ] ] @@ -131970,11 +151179,44 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" + "t", + "0" + ] + ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "1" + ] ], + [ + "Variable", + {}, + [ + "t", + "4" + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -132001,18 +151243,62 @@ [] ], [ - "Variable", + "Function", {}, [ - "t", - "0" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ] ] ], [ - [ - "y" - ], + "AsPattern", [ "Reference", {}, @@ -132039,52 +151325,39 @@ [] ], [ - "Variable", - {}, - [ - "t", - "1" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "6" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ + "WildcardPattern", [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "int" + [] ] ], - [] + [ + "x" + ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -132140,10 +151413,34 @@ ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -132168,7 +151465,41 @@ ] ], [] + ] + ], + [ + "y" + ] + ], + [ + "Apply", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] ], + [] + ], + [ + "Apply", [ "Function", {}, @@ -132222,90 +151553,176 @@ ], [] ] - ] - ], - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] ], [ - "max" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ + "Reference", [ + "Function", + {}, [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ], [ - "s", - "d", - "k" + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] ] ], [ [ - "basics" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "max" ] - ], - [ - "int" ] ], - [] - ], - [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ [ + "Variable", [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ], [ - "s", - "d", - "k" + "x" ] - ], + ] + ], + [ + "Variable", [ + "Reference", + {}, [ - "basics" - ] + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ], [ - "int" + "y" ] - ], - [] - ], - [ - "y" + ] ] ] ] @@ -132697,11 +152114,44 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" + "t", + "0" + ] + ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "1" + ] ], + [ + "Variable", + {}, + [ + "t", + "4" + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -132736,18 +152186,78 @@ ] ], [ - "Variable", + "Function", {}, [ - "t", - "0" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Variable", + {}, + [ + "number" + ] + ] + ] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Variable", + {}, + [ + "number" + ] + ] + ] ] ] ], [ - [ - "y" - ], + "AsPattern", [ "Reference", {}, @@ -132782,60 +152292,47 @@ ] ], [ - "Variable", - {}, - [ - "t", - "1" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "6" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ + "WildcardPattern", [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] ], [ - "s", - "d", - "k" - ] - ], - [ - [ - "list" + [ + "Variable", + {}, + [ + "number" + ] + ] ] - ], - [ - "list" ] ], [ - [ - "Variable", - {}, - [ - "number" - ] - ] + "x" ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -132907,10 +152404,42 @@ ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Variable", + {}, + [ + "number" + ] + ] + ] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -132943,7 +152472,49 @@ ] ] ] + ] + ], + [ + "y" + ] + ], + [ + "Apply", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] ], + [ + [ + "Variable", + {}, + [ + "number" + ] + ] + ] + ], + [ + "Apply", [ "Function", {}, @@ -133013,106 +152584,216 @@ ] ] ] - ] - ], - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] ], [ - "max" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ + "Reference", [ + "Function", + {}, [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Variable", + {}, + [ + "number" + ] + ] + ] ], [ - "s", - "d", - "k" + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Variable", + {}, + [ + "number" + ] + ] + ] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Variable", + {}, + [ + "number" + ] + ] + ] + ] ] ], [ [ - "list" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "max" ] - ], - [ - "list" ] ], [ + "Variable", [ - "Variable", + "Reference", {}, [ - "number" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Variable", + {}, + [ + "number" + ] + ] ] + ], + [ + "x" ] ] ], [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ + "Variable", [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] ], [ - "s", - "d", - "k" - ] - ], - [ - [ - "list" + [ + "Variable", + {}, + [ + "number" + ] + ] ] ], [ - "list" - ] - ], - [ - [ - "Variable", - {}, - [ - "number" - ] + "y" ] ] - ], - [ - "y" ] ] ] @@ -133596,11 +153277,44 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" + "t", + "0" + ] + ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "1" + ] ], + [ + "Variable", + {}, + [ + "t", + "4" + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -133627,18 +153341,62 @@ [] ], [ - "Variable", + "Function", {}, [ - "t", - "0" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] ] ] ], [ - [ - "y" - ], + "AsPattern", [ "Reference", {}, @@ -133665,52 +153423,39 @@ [] ], [ - "Variable", - {}, - [ - "t", - "1" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "6" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ + "WildcardPattern", [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "string" - ] - ], - [ - "string" + [] ] ], - [] + [ + "x" + ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -133766,10 +153511,34 @@ ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -133794,7 +153563,41 @@ ] ], [] + ] + ], + [ + "y" + ] + ], + [ + "Apply", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] ], + [] + ], + [ + "Apply", [ "Function", {}, @@ -133848,90 +153651,176 @@ ], [] ] - ] - ], - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] ], [ + "Reference", [ - "basics" - ] - ], - [ - "max" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ - [ + "Function", + {}, [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] ], [ - "s", - "d", - "k" + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ] ] ], [ [ - "string" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "max" ] - ], - [ - "string" ] ], - [] - ], - [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ [ + "Variable", [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] ], [ - "s", - "d", - "k" + "x" ] - ], + ] + ], + [ + "Variable", [ + "Reference", + {}, [ - "string" - ] + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] ], [ - "string" + "y" ] - ], - [] - ], - [ - "y" + ] ] ] ] @@ -134287,11 +154176,44 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" + "t", + "0" + ] + ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "1" + ] ], + [ + "Variable", + {}, + [ + "t", + "4" + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Tuple", {}, @@ -134314,18 +154236,54 @@ ] ], [ - "Variable", + "Function", {}, [ - "t", - "0" + "Tuple", + {}, + [ + [ + "Variable", + {}, + [ + "number" + ] + ], + [ + "Variable", + {}, + [ + "number", + "1" + ] + ] + ] + ], + [ + "Tuple", + {}, + [ + [ + "Variable", + {}, + [ + "number" + ] + ], + [ + "Variable", + {}, + [ + "number", + "1" + ] + ] + ] ] ] ], [ - [ - "y" - ], + "AsPattern", [ "Tuple", {}, @@ -134348,48 +154306,35 @@ ] ], [ - "Variable", - {}, - [ - "t", - "1" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "6" - ] - ], - "body": [ - "Apply", - [ - "Tuple", - {}, - [ - [ - "Variable", - {}, - [ - "number" - ] - ], + "WildcardPattern", [ - "Variable", + "Tuple", {}, [ - "number", - "1" + [ + "Variable", + {}, + [ + "number" + ] + ], + [ + "Variable", + {}, + [ + "number", + "1" + ] + ] ] ] + ], + [ + "x" ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -134437,10 +154382,30 @@ ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Tuple", {}, + [ + [ + "Variable", + {}, + [ + "number" + ] + ], + [ + "Variable", + {}, + [ + "number", + "1" + ] + ] + ] + ], + [ + "WildcardPattern", [ "Tuple", {}, @@ -134461,7 +154426,37 @@ ] ] ] - ], + ] + ], + [ + "y" + ] + ], + [ + "Apply", + [ + "Tuple", + {}, + [ + [ + "Variable", + {}, + [ + "number" + ] + ], + [ + "Variable", + {}, + [ + "number", + "1" + ] + ] + ] + ], + [ + "Apply", [ "Function", {}, @@ -134507,82 +154502,156 @@ ] ] ] - ] - ], - [ + ], [ + "Reference", [ - "morphir" + "Function", + {}, + [ + "Tuple", + {}, + [ + [ + "Variable", + {}, + [ + "number" + ] + ], + [ + "Variable", + {}, + [ + "number", + "1" + ] + ] + ] + ], + [ + "Function", + {}, + [ + "Tuple", + {}, + [ + [ + "Variable", + {}, + [ + "number" + ] + ], + [ + "Variable", + {}, + [ + "number", + "1" + ] + ] + ] + ], + [ + "Tuple", + {}, + [ + [ + "Variable", + {}, + [ + "number" + ] + ], + [ + "Variable", + {}, + [ + "number", + "1" + ] + ] + ] + ] + ] ], [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "max" + ] ] ], [ - "max" - ] - ] - ], - [ - "Variable", - [ - "Tuple", - {}, - [ + "Variable", [ - "Variable", + "Tuple", {}, [ - "number" + [ + "Variable", + {}, + [ + "number" + ] + ], + [ + "Variable", + {}, + [ + "number", + "1" + ] + ] ] ], [ - "Variable", - {}, - [ - "number", - "1" - ] + "x" ] ] ], [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Tuple", - {}, - [ + "Variable", [ - "Variable", + "Tuple", {}, [ - "number" + [ + "Variable", + {}, + [ + "number" + ] + ], + [ + "Variable", + {}, + [ + "number", + "1" + ] + ] ] ], [ - "Variable", - {}, - [ - "number", - "1" - ] + "y" ] ] - ], - [ - "y" ] ] ] @@ -134972,11 +155041,44 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" + "t", + "0" + ] + ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "1" + ] ], + [ + "Variable", + {}, + [ + "t", + "4" + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -135003,18 +155105,62 @@ [] ], [ - "Variable", + "Function", {}, [ - "t", - "0" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "char" + ] + ], + [ + "char" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "char" + ] + ], + [ + "char" + ] + ], + [] ] ] ], [ - [ - "y" - ], + "AsPattern", [ "Reference", {}, @@ -135041,52 +155187,39 @@ [] ], [ - "Variable", - {}, - [ - "t", - "1" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "6" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ + "WildcardPattern", [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "char" + ] + ], + [ + "char" + ] ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "char" - ] - ], - [ - "char" + [] ] ], - [] + [ + "x" + ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -135142,10 +155275,34 @@ ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "char" + ] + ], + [ + "char" + ] + ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -135170,7 +155327,41 @@ ] ], [] + ] + ], + [ + "y" + ] + ], + [ + "Apply", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "char" + ] + ], + [ + "char" + ] ], + [] + ], + [ + "Apply", [ "Function", {}, @@ -135224,90 +155415,176 @@ ], [] ] - ] - ], - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] ], [ - "min" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ + "Reference", [ + "Function", + {}, [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "char" + ] + ], + [ + "char" + ] + ], + [] ], [ - "s", - "d", - "k" + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "char" + ] + ], + [ + "char" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "char" + ] + ], + [ + "char" + ] + ], + [] + ] ] ], [ [ - "char" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "min" ] - ], - [ - "char" ] ], - [] - ], - [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ [ + "Variable", [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "char" + ] + ], + [ + "char" + ] + ], + [] ], [ - "s", - "d", - "k" + "x" ] - ], + ] + ], + [ + "Variable", [ + "Reference", + {}, [ - "char" - ] + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "char" + ] + ], + [ + "char" + ] + ], + [] ], [ - "char" + "y" ] - ], - [] - ], - [ - "y" + ] ] ] ] @@ -135675,11 +155952,44 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "0" + ] + ], [ + "Function", + {}, [ - "x" + "Variable", + {}, + [ + "t", + "1" + ] ], + [ + "Variable", + {}, + [ + "t", + "4" + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -135706,18 +156016,62 @@ [] ], [ - "Variable", + "Function", {}, [ - "t", - "0" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] ] ] ], [ - [ - "y" - ], + "AsPattern", [ "Reference", {}, @@ -135744,52 +156098,39 @@ [] ], [ - "Variable", - {}, - [ - "t", - "1" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "6" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ + "WildcardPattern", [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "float" + [] ] ], - [] + [ + "x" + ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -135845,10 +156186,34 @@ ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -135873,7 +156238,41 @@ ] ], [] + ] + ], + [ + "y" + ] + ], + [ + "Apply", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] ], + [] + ], + [ + "Apply", [ "Function", {}, @@ -135927,90 +156326,176 @@ ], [] ] - ] - ], - [ + ], [ + "Reference", [ - "morphir" + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ] + ] ], [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "min" + ] ] ], [ - "min" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ + "Variable", [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] + [] ], [ - "float" + "x" ] - ], - [] + ] ], [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ + "Variable", [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] + [] ], [ - "float" + "y" ] - ], - [] - ], - [ - "y" + ] ] ] ] @@ -136378,11 +156863,44 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" + "t", + "0" + ] + ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "1" + ] ], + [ + "Variable", + {}, + [ + "t", + "4" + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -136409,18 +156927,62 @@ [] ], [ - "Variable", + "Function", {}, [ - "t", - "0" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ] ] ], [ - [ - "y" - ], + "AsPattern", [ "Reference", {}, @@ -136447,52 +157009,39 @@ [] ], [ - "Variable", - {}, - [ - "t", - "1" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "6" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ + "WildcardPattern", [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "int" + [] ] ], - [] + [ + "x" + ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -136548,10 +157097,34 @@ ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -136576,7 +157149,41 @@ ] ], [] + ] + ], + [ + "y" + ] + ], + [ + "Apply", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] ], + [] + ], + [ + "Apply", [ "Function", {}, @@ -136630,90 +157237,176 @@ ], [] ] - ] - ], - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] ], [ - "min" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ + "Reference", [ + "Function", + {}, [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ], [ - "s", - "d", - "k" + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] ] ], [ [ - "basics" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "min" ] - ], - [ - "int" ] ], - [] - ], - [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ [ + "Variable", [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ], [ - "s", - "d", - "k" + "x" ] - ], + ] + ], + [ + "Variable", [ + "Reference", + {}, [ - "basics" - ] + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ], [ - "int" + "y" ] - ], - [] - ], - [ - "y" + ] ] ] ] @@ -137105,11 +157798,44 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" + "t", + "0" + ] + ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "1" + ] ], + [ + "Variable", + {}, + [ + "t", + "4" + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -137144,18 +157870,78 @@ ] ], [ - "Variable", + "Function", {}, [ - "t", - "0" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Variable", + {}, + [ + "number" + ] + ] + ] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Variable", + {}, + [ + "number" + ] + ] + ] ] ] ], [ - [ - "y" - ], + "AsPattern", [ "Reference", {}, @@ -137190,60 +157976,47 @@ ] ], [ - "Variable", - {}, - [ - "t", - "1" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "6" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ + "WildcardPattern", [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] ], [ - "s", - "d", - "k" - ] - ], - [ - [ - "list" + [ + "Variable", + {}, + [ + "number" + ] + ] ] - ], - [ - "list" ] ], [ - [ - "Variable", - {}, - [ - "number" - ] - ] + "x" ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -137315,10 +158088,359 @@ ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Variable", + {}, + [ + "number" + ] + ] + ] + ], + [ + "WildcardPattern", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Variable", + {}, + [ + "number" + ] + ] + ] + ] + ], + [ + "y" + ] + ], + [ + "Apply", + [ + "Reference", {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Variable", + {}, + [ + "number" + ] + ] + ] + ], + [ + "Apply", + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Variable", + {}, + [ + "number" + ] + ] + ] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Variable", + {}, + [ + "number" + ] + ] + ] + ] + ], + [ + "Reference", + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Variable", + {}, + [ + "number" + ] + ] + ] + ], + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Variable", + {}, + [ + "number" + ] + ] + ] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Variable", + {}, + [ + "number" + ] + ] + ] + ] + ] + ], + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "min" + ] + ] + ], + [ + "Variable", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Variable", + {}, + [ + "number" + ] + ] + ] + ], + [ + "x" + ] + ] + ], + [ + "Variable", [ "Reference", {}, @@ -137353,174 +158475,9 @@ ] ], [ - "Function", - {}, - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "list" - ] - ], - [ - "list" - ] - ], - [ - [ - "Variable", - {}, - [ - "number" - ] - ] - ] - ], - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "list" - ] - ], - [ - "list" - ] - ], - [ - [ - "Variable", - {}, - [ - "number" - ] - ] - ] - ] - ] - ], - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "min" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "list" - ] - ], - [ - "list" - ] - ], - [ - [ - "Variable", - {}, - [ - "number" - ] - ] - ] - ], - [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "list" - ] - ], - [ - "list" - ] - ], - [ - [ - "Variable", - {}, - [ - "number" - ] + "y" ] ] - ], - [ - "y" ] ] ] @@ -138004,49 +158961,44 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" - ], + "t", + "0" + ] + ], + [ + "Function", + {}, [ - "Reference", + "Variable", {}, [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "string" - ] - ], - [ - "string" - ] - ], - [] + "t", + "1" + ] ], [ "Variable", {}, [ "t", - "0" + "4" ] ] - ], + ] + ], + "body": [ + "Lambda", [ - [ - "y" - ], + "Function", + {}, [ "Reference", {}, @@ -138073,52 +159025,121 @@ [] ], [ - "Variable", + "Function", {}, [ - "t", - "1" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] ] ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "6" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, + ], + [ + "AsPattern", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "string" + ] + ], [ "string" ] ], + [] + ], + [ + "WildcardPattern", [ - "string" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] ] ], - [] + [ + "x" + ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -138174,10 +159195,34 @@ ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -138202,7 +159247,41 @@ ] ], [] + ] + ], + [ + "y" + ] + ], + [ + "Apply", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] ], + [] + ], + [ + "Apply", [ "Function", {}, @@ -138256,90 +159335,176 @@ ], [] ] - ] - ], - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] ], [ - "min" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ + "Reference", [ + "Function", + {}, [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] ], [ - "s", - "d", - "k" + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ] ] ], [ [ - "string" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "min" ] - ], - [ - "string" ] ], - [] - ], - [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ [ + "Variable", [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] ], [ - "s", - "d", - "k" + "x" ] - ], + ] + ], + [ + "Variable", [ + "Reference", + {}, [ - "string" - ] + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] ], [ - "string" + "y" ] - ], - [] - ], - [ - "y" + ] ] ] ] @@ -138695,11 +159860,44 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" + "t", + "0" + ] + ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "1" + ] ], + [ + "Variable", + {}, + [ + "t", + "4" + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Tuple", {}, @@ -138722,18 +159920,54 @@ ] ], [ - "Variable", + "Function", {}, [ - "t", - "0" + "Tuple", + {}, + [ + [ + "Variable", + {}, + [ + "number" + ] + ], + [ + "Variable", + {}, + [ + "number", + "1" + ] + ] + ] + ], + [ + "Tuple", + {}, + [ + [ + "Variable", + {}, + [ + "number" + ] + ], + [ + "Variable", + {}, + [ + "number", + "1" + ] + ] + ] ] ] ], [ - [ - "y" - ], + "AsPattern", [ "Tuple", {}, @@ -138756,48 +159990,35 @@ ] ], [ - "Variable", - {}, - [ - "t", - "1" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "6" - ] - ], - "body": [ - "Apply", - [ - "Tuple", - {}, - [ - [ - "Variable", - {}, - [ - "number" - ] - ], + "WildcardPattern", [ - "Variable", + "Tuple", {}, [ - "number", - "1" + [ + "Variable", + {}, + [ + "number" + ] + ], + [ + "Variable", + {}, + [ + "number", + "1" + ] + ] ] ] + ], + [ + "x" ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -138845,10 +160066,30 @@ ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Tuple", {}, + [ + [ + "Variable", + {}, + [ + "number" + ] + ], + [ + "Variable", + {}, + [ + "number", + "1" + ] + ] + ] + ], + [ + "WildcardPattern", [ "Tuple", {}, @@ -138869,7 +160110,37 @@ ] ] ] - ], + ] + ], + [ + "y" + ] + ], + [ + "Apply", + [ + "Tuple", + {}, + [ + [ + "Variable", + {}, + [ + "number" + ] + ], + [ + "Variable", + {}, + [ + "number", + "1" + ] + ] + ] + ], + [ + "Apply", [ "Function", {}, @@ -138915,82 +160186,156 @@ ] ] ] - ] - ], - [ + ], [ + "Reference", [ - "morphir" + "Function", + {}, + [ + "Tuple", + {}, + [ + [ + "Variable", + {}, + [ + "number" + ] + ], + [ + "Variable", + {}, + [ + "number", + "1" + ] + ] + ] + ], + [ + "Function", + {}, + [ + "Tuple", + {}, + [ + [ + "Variable", + {}, + [ + "number" + ] + ], + [ + "Variable", + {}, + [ + "number", + "1" + ] + ] + ] + ], + [ + "Tuple", + {}, + [ + [ + "Variable", + {}, + [ + "number" + ] + ], + [ + "Variable", + {}, + [ + "number", + "1" + ] + ] + ] + ] + ] ], [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "min" + ] ] ], [ - "min" - ] - ] - ], - [ - "Variable", - [ - "Tuple", - {}, - [ + "Variable", [ - "Variable", + "Tuple", {}, [ - "number" + [ + "Variable", + {}, + [ + "number" + ] + ], + [ + "Variable", + {}, + [ + "number", + "1" + ] + ] ] ], [ - "Variable", - {}, - [ - "number", - "1" - ] + "x" ] ] ], [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Tuple", - {}, - [ + "Variable", [ - "Variable", + "Tuple", {}, [ - "number" + [ + "Variable", + {}, + [ + "number" + ] + ], + [ + "Variable", + {}, + [ + "number", + "1" + ] + ] ] ], [ - "Variable", - {}, - [ - "number", - "1" - ] + "y" ] ] - ], - [ - "y" ] ] ] @@ -139380,11 +160725,44 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" + "t", + "0" + ] + ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "1" + ] ], + [ + "Variable", + {}, + [ + "t", + "4" + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -139411,18 +160789,62 @@ [] ], [ - "Variable", + "Function", {}, [ - "t", - "0" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ] ] ], [ - [ - "y" - ], + "AsPattern", [ "Reference", {}, @@ -139449,55 +160871,95 @@ [] ], [ - "Variable", - {}, + "WildcardPattern", [ - "t", - "1" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ] + ], + [ + "x" ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "6" - ] - ], - "body": [ - "Apply", + ], [ - "Reference", - {}, + "Lambda", [ + "Function", + {}, [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] ], - [ - "s", - "d", - "k" - ] + [] ], [ + "Reference", + {}, [ - "basics" - ] - ], - [ - "int" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ] ], - [] - ], - [ - "Apply", [ - "Function", - {}, + "AsPattern", [ "Reference", {}, @@ -139523,6 +160985,40 @@ ], [] ], + [ + "WildcardPattern", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ], + [ + "y" + ] + ], + [ + "Apply", [ "Reference", {}, @@ -139542,21 +161038,153 @@ "basics" ] ], - [ - "int" - ] - ], - [] - ] - ], - [ - "Reference", - [ - "Function", - {}, - [ - "Reference", - {}, + [ + "int" + ] + ], + [] + ], + [ + "Apply", + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ], + [ + "Reference", + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ] + ], [ [ [ @@ -139574,14 +161202,13 @@ ] ], [ - "int" + "mod", + "by" ] - ], - [] + ] ], [ - "Function", - {}, + "Variable", [ "Reference", {}, @@ -139608,115 +161235,41 @@ [] ], [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "int" - ] - ], - [] + "x" ] ] ], [ + "Variable", [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "mod", - "by" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "int" ] ], - [ - "int" - ] - ], - [] - ], - [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] + [] ], [ - "int" + "y" ] - ], - [] - ], - [ - "y" + ] ] ] ] @@ -140084,11 +161637,44 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" + "t", + "0" + ] + ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "1" + ] ], + [ + "Variable", + {}, + [ + "t", + "4" + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -140115,18 +161701,62 @@ [] ], [ - "Variable", + "Function", {}, [ - "t", - "0" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] ] ] ], [ - [ - "y" - ], + "AsPattern", [ "Reference", {}, @@ -140153,52 +161783,39 @@ [] ], [ - "Variable", - {}, - [ - "t", - "1" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "6" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ + "WildcardPattern", [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "float" + [] ] ], - [] + [ + "x" + ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -140254,10 +161871,34 @@ ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -140282,7 +161923,41 @@ ] ], [] + ] + ], + [ + "y" + ] + ], + [ + "Apply", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] ], + [] + ], + [ + "Apply", [ "Function", {}, @@ -140336,90 +162011,176 @@ ], [] ] - ] - ], - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] ], [ - "multiply" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ + "Reference", [ + "Function", + {}, [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] ], [ - "s", - "d", - "k" + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ] ] ], [ [ - "basics" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "multiply" ] - ], - [ - "float" ] ], - [] - ], - [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ [ + "Variable", [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] ], [ - "s", - "d", - "k" + "x" ] - ], + ] + ], + [ + "Variable", [ + "Reference", + {}, [ - "basics" - ] + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] ], [ - "float" + "y" ] - ], - [] - ], - [ - "y" + ] ] ] ] @@ -140786,11 +162547,44 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" + "t", + "0" + ] + ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "1" + ] ], + [ + "Variable", + {}, + [ + "t", + "4" + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -140817,18 +162611,62 @@ [] ], [ - "Variable", + "Function", {}, [ - "t", - "0" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ] ] ], [ - [ - "y" - ], + "AsPattern", [ "Reference", {}, @@ -140855,52 +162693,39 @@ [] ], [ - "Variable", - {}, - [ - "t", - "1" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "6" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ + "WildcardPattern", [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "int" + [] ] ], - [] + [ + "x" + ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -140956,10 +162781,34 @@ ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -140984,7 +162833,41 @@ ] ], [] + ] + ], + [ + "y" + ] + ], + [ + "Apply", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] ], + [] + ], + [ + "Apply", [ "Function", {}, @@ -141038,90 +162921,176 @@ ], [] ] - ] - ], - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] ], [ - "multiply" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ + "Reference", [ + "Function", + {}, [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ], [ - "s", - "d", - "k" + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] ] ], [ [ - "basics" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "multiply" ] - ], - [ - "int" ] ], - [] - ], - [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ [ + "Variable", [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ], [ - "s", - "d", - "k" + "x" ] - ], + ] + ], + [ + "Variable", [ + "Reference", + {}, [ - "basics" - ] + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ], [ - "int" + "y" ] - ], - [] - ], - [ - "y" + ] ] ] ] @@ -141488,11 +163457,32 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" - ], + "t", + "0" + ] + ], + [ + "Variable", + {}, + [ + "t", + "2" + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -141519,80 +163509,60 @@ [] ], [ - "Variable", + "Reference", {}, - [ - "t", - "0" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "3" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "int" ] ], - [ - "int" - ] - ], - [] + [] + ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "basics" - ] - ], + "s", + "d", + "k" + ] + ], + [ [ - "int" + "basics" ] ], - [] + [ + "int" + ] ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -141620,31 +163590,92 @@ ] ], [ + "x" + ] + ], + [ + "Apply", + [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "basics" + ] + ], + [ + "int" ] ], + [] + ], + [ + "Reference", [ + "Function", + {}, [ - "basics" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ] ], - [ - "negate" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, [ [ [ @@ -141662,13 +163693,40 @@ ] ], [ - "int" + "negate" ] - ], - [] + ] ], [ - "x" + "Variable", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "x" + ] ] ] ] @@ -141918,11 +163976,32 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" - ], + "t", + "0" + ] + ], + [ + "Variable", + {}, + [ + "t", + "2" + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -141949,80 +164028,60 @@ [] ], [ - "Variable", + "Reference", {}, - [ - "t", - "0" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "3" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "int" ] ], - [ - "int" - ] - ], - [] + [] + ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "basics" - ] - ], + "s", + "d", + "k" + ] + ], + [ [ - "int" + "basics" ] ], - [] + [ + "int" + ] ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -142050,31 +164109,92 @@ ] ], [ + "x" + ] + ], + [ + "Apply", + [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "basics" + ] + ], + [ + "int" ] ], + [] + ], + [ + "Reference", [ + "Function", + {}, [ - "basics" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ] ], - [ - "negate" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, [ [ [ @@ -142092,13 +164212,40 @@ ] ], [ - "int" + "negate" ] - ], - [] + ] ], [ - "x" + "Variable", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "x" + ] ] ] ] @@ -142453,17 +164600,27 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" - ], + "t", + "0" + ] + ], + [ + "Function", + {}, [ "Variable", {}, [ "t", - "2" + "1" ] ], [ @@ -142471,14 +164628,16 @@ {}, [ "t", - "0" + "4" ] ] - ], + ] + ], + "body": [ + "Lambda", [ - [ - "y" - ], + "Function", + {}, [ "Variable", {}, @@ -142488,52 +164647,70 @@ ] ], [ - "Variable", + "Function", {}, [ - "t", - "1" + "Variable", + {}, + [ + "t", + "2" + ] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] ] ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "6" - ] - ], - "body": [ - "Apply", + ], [ - "Reference", - {}, + "AsPattern", [ + "Variable", + {}, [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], + "t", + "2" + ] + ], + [ + "WildcardPattern", [ + "Variable", + {}, [ - "basics" + "t", + "2" ] - ], - [ - "bool" ] ], - [] + [ + "x" + ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -142572,10 +164749,17 @@ ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Variable", {}, + [ + "t", + "2" + ] + ], + [ + "WildcardPattern", [ "Variable", {}, @@ -142583,7 +164767,41 @@ "t", "2" ] + ] + ], + [ + "y" + ] + ], + [ + "Apply", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] ], + [] + ], + [ + "Apply", [ "Function", {}, @@ -142620,57 +164838,109 @@ ], [] ] - ] - ], - [ + ], [ + "Reference", [ - "morphir" + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "2" + ] + ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "2" + ] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ] + ] ], [ - "s", - "d", - "k" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "not", + "equal" + ] ] ], [ + "Variable", [ - "basics" + "Variable", + {}, + [ + "t", + "2" + ] + ], + [ + "x" ] - ], - [ - "not", - "equal" ] - ] - ], - [ - "Variable", + ], [ "Variable", - {}, [ - "t", - "2" + "Variable", + {}, + [ + "t", + "2" + ] + ], + [ + "y" ] - ], - [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Variable", - {}, - [ - "t", - "2" ] - ], - [ - "y" ] ] ] @@ -142954,11 +165224,44 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" + "t", + "0" + ] + ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "1" + ] ], + [ + "Variable", + {}, + [ + "t", + "4" + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -142985,18 +165288,62 @@ [] ], [ - "Variable", + "Function", {}, [ - "t", - "0" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] ] ] ], [ - [ - "y" - ], + "AsPattern", [ "Reference", {}, @@ -143023,52 +165370,39 @@ [] ], [ - "Variable", - {}, - [ - "t", - "1" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "6" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ + "WildcardPattern", [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "bool" + [] ] ], - [] + [ + "x" + ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -143092,11 +165426,39 @@ ] ], [ - "float" + "float" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" ] ], [] - ], + ] + ], + [ + "AsPattern", [ "Reference", {}, @@ -143117,17 +165479,13 @@ ] ], [ - "bool" + "float" ] ], [] - ] - ], - [ - "Reference", + ], [ - "Function", - {}, + "WildcardPattern", [ "Reference", {}, @@ -143152,7 +165510,41 @@ ] ], [] + ] + ], + [ + "y" + ] + ], + [ + "Apply", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] ], + [] + ], + [ + "Apply", [ "Function", {}, @@ -143206,91 +165598,177 @@ ], [] ] - ] - ], - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] ], [ - "not", - "equal" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ + "Reference", [ + "Function", + {}, [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] ], [ - "s", - "d", - "k" + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ] ] ], [ [ - "basics" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "not", + "equal" ] - ], - [ - "float" ] ], - [] - ], - [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ [ + "Variable", [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] ], [ - "s", - "d", - "k" + "x" ] - ], + ] + ], + [ + "Variable", [ + "Reference", + {}, [ - "basics" - ] + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] ], [ - "float" + "y" ] - ], - [] - ], - [ - "y" + ] ] ] ] @@ -143659,11 +166137,44 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" + "t", + "0" + ] + ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "1" + ] ], + [ + "Variable", + {}, + [ + "t", + "4" + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -143690,18 +166201,62 @@ [] ], [ - "Variable", + "Function", {}, [ - "t", - "0" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] ] ] ], [ - [ - "y" - ], + "AsPattern", [ "Reference", {}, @@ -143728,52 +166283,39 @@ [] ], [ - "Variable", - {}, - [ - "t", - "1" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "6" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ + "WildcardPattern", [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "bool" + [] ] ], - [] + [ + "x" + ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -143829,10 +166371,34 @@ ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -143857,7 +166423,41 @@ ] ], [] + ] + ], + [ + "y" + ] + ], + [ + "Apply", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] ], + [] + ], + [ + "Apply", [ "Function", {}, @@ -143911,91 +166511,177 @@ ], [] ] - ] - ], - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] ], [ - "not", - "equal" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ + "Reference", [ + "Function", + {}, [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] ], [ - "s", - "d", - "k" + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ] ] ], [ [ - "basics" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "not", + "equal" ] - ], - [ - "bool" ] ], - [] - ], - [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ [ + "Variable", [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] ], [ - "s", - "d", - "k" + "x" ] - ], + ] + ], + [ + "Variable", [ + "Reference", + {}, [ - "basics" - ] + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] ], [ - "bool" + "y" ] - ], - [] - ], - [ - "y" + ] ] ] ] @@ -144364,11 +167050,44 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" + "t", + "0" + ] + ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "1" + ] ], + [ + "Variable", + {}, + [ + "t", + "4" + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -144395,18 +167114,62 @@ [] ], [ - "Variable", + "Function", {}, [ - "t", - "0" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "char" + ] + ], + [ + "char" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] ] ] ], [ - [ - "y" - ], + "AsPattern", [ "Reference", {}, @@ -144433,52 +167196,39 @@ [] ], [ - "Variable", - {}, - [ - "t", - "1" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "6" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ + "WildcardPattern", [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "char" + ] + ], + [ + "char" + ] ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "bool" + [] ] ], - [] + [ + "x" + ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -144534,10 +167284,34 @@ ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "char" + ] + ], + [ + "char" + ] + ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -144562,7 +167336,41 @@ ] ], [] + ] + ], + [ + "y" + ] + ], + [ + "Apply", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] ], + [] + ], + [ + "Apply", [ "Function", {}, @@ -144586,11 +167394,146 @@ ] ], [ - "char" + "char" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ] + ], + [ + "Reference", + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "char" + ] + ], + [ + "char" + ] + ], + [] + ], + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "char" + ] + ], + [ + "char" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ] + ] + ], + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" ] ], - [] - ], + [ + "not", + "equal" + ] + ] + ], + [ + "Variable", [ "Reference", {}, @@ -144607,100 +167550,51 @@ ], [ [ - "basics" + "char" ] ], [ - "bool" + "char" ] ], [] - ] - ] - ], - [ - [ - [ - "morphir" ], [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" + "x" ] - ], - [ - "not", - "equal" ] - ] - ], - [ - "Variable", + ], [ - "Reference", - {}, + "Variable", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "char" + ] + ], [ "char" ] ], - [ - "char" - ] - ], - [] - ], - [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "char" - ] + [] ], [ - "char" + "y" ] - ], - [] - ], - [ - "y" + ] ] ] ] @@ -145069,11 +167963,44 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "0" + ] + ], [ + "Function", + {}, [ - "x" + "Variable", + {}, + [ + "t", + "1" + ] ], + [ + "Variable", + {}, + [ + "t", + "4" + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -145100,18 +168027,62 @@ [] ], [ - "Variable", + "Function", {}, [ - "t", - "0" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] ] ] ], [ - [ - "y" - ], + "AsPattern", [ "Reference", {}, @@ -145138,52 +168109,39 @@ [] ], [ - "Variable", - {}, - [ - "t", - "1" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "6" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ + "WildcardPattern", [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "bool" + [] ] ], - [] + [ + "x" + ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -145239,10 +168197,34 @@ ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -145267,7 +168249,41 @@ ] ], [] + ] + ], + [ + "y" + ] + ], + [ + "Apply", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] ], + [] + ], + [ + "Apply", [ "Function", {}, @@ -145321,91 +168337,177 @@ ], [] ] - ] - ], - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] ], [ + "Reference", [ - "basics" - ] - ], - [ - "not", - "equal" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ - [ + "Function", + {}, [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] ], [ - "s", - "d", - "k" + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ] ] ], [ [ - "string" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "not", + "equal" ] - ], - [ - "string" ] ], - [] - ], - [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ [ + "Variable", [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] ], [ - "s", - "d", - "k" + "x" ] - ], + ] + ], + [ + "Variable", [ + "Reference", + {}, [ - "string" - ] + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] ], [ - "string" + "y" ] - ], - [] - ], - [ - "y" + ] ] ] ] @@ -145774,11 +168876,44 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" + "t", + "0" + ] + ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "1" + ] ], + [ + "Variable", + {}, + [ + "t", + "4" + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -145808,24 +168943,77 @@ {}, [ "t", - "17" + "19" ] ] ] ], [ - "Variable", + "Function", {}, [ - "t", - "0" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Variable", + {}, + [ + "t", + "19" + ] + ] + ] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] ] ] ], [ - [ - "y" - ], + "AsPattern", [ "Reference", {}, @@ -145855,58 +169043,54 @@ {}, [ "t", - "17" + "19" ] ] ] ], [ - "Variable", - {}, - [ - "t", - "1" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "6" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ + "WildcardPattern", [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] ], [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" + [ + "Variable", + {}, + [ + "t", + "19" + ] + ] ] - ], - [ - "bool" ] ], - [] + [ + "x" + ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -145939,7 +169123,7 @@ {}, [ "t", - "17" + "19" ] ] ] @@ -145971,10 +169155,342 @@ ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Variable", + {}, + [ + "t", + "19" + ] + ] + ] + ], + [ + "WildcardPattern", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Variable", + {}, + [ + "t", + "19" + ] + ] + ] + ] + ], + [ + "y" + ] + ], + [ + "Apply", + [ + "Reference", {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ], + [ + "Apply", + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Variable", + {}, + [ + "t", + "19" + ] + ] + ] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ] + ], + [ + "Reference", + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Variable", + {}, + [ + "t", + "19" + ] + ] + ] + ], + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Variable", + {}, + [ + "t", + "19" + ] + ] + ] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ] + ] + ], + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "not", + "equal" + ] + ] + ], + [ + "Variable", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "list" + ] + ], + [ + "list" + ] + ], + [ + [ + "Variable", + {}, + [ + "t", + "19" + ] + ] + ] + ], + [ + "x" + ] + ] + ], + [ + "Variable", [ "Reference", {}, @@ -146004,176 +169520,15 @@ {}, [ "t", - "17" + "19" ] ] ] ], [ - "Function", - {}, - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "list" - ] - ], - [ - "list" - ] - ], - [ - [ - "Variable", - {}, - [ - "t", - "17" - ] - ] - ] - ], - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "bool" - ] - ], - [] - ] - ] - ], - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "not", - "equal" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "list" - ] - ], - [ - "list" - ] - ], - [ - [ - "Variable", - {}, - [ - "t", - "17" - ] - ] - ] - ], - [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "list" - ] - ], - [ - "list" - ] - ], - [ - [ - "Variable", - {}, - [ - "t", - "17" - ] + "y" ] ] - ], - [ - "y" ] ] ] @@ -146239,7 +169594,7 @@ {}, [ "t", - "17" + "19" ] ] ] @@ -146304,7 +169659,7 @@ {}, [ "t", - "17" + "19" ] ] ] @@ -146341,7 +169696,7 @@ {}, [ "t", - "17" + "19" ] ] ] @@ -146408,7 +169763,7 @@ {}, [ "t", - "17" + "19" ] ] ] @@ -146421,7 +169776,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -146436,7 +169791,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -146478,7 +169833,7 @@ {}, [ "t", - "17" + "19" ] ] ] @@ -146491,7 +169846,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -146506,7 +169861,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -146521,7 +169876,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -146658,39 +170013,27 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" - ], + "t", + "0" + ] + ], + [ + "Function", + {}, [ - "Tuple", + "Variable", {}, [ - [ - "Variable", - {}, - [ - "t", - "18" - ] - ], - [ - "Variable", - {}, - [ - "t", - "17" - ] - ], - [ - "Variable", - {}, - [ - "t", - "16" - ] - ] + "t", + "1" ] ], [ @@ -146698,14 +170041,16 @@ {}, [ "t", - "0" + "4" ] ] - ], + ] + ], + "body": [ + "Lambda", [ - [ - "y" - ], + "Function", + {}, [ "Tuple", {}, @@ -146715,7 +170060,7 @@ {}, [ "t", - "18" + "20" ] ], [ @@ -146723,7 +170068,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -146731,58 +170076,142 @@ {}, [ "t", - "16" + "18" ] ] ] ], [ - "Variable", + "Function", {}, [ - "t", - "1" + "Tuple", + {}, + [ + [ + "Variable", + {}, + [ + "t", + "20" + ] + ], + [ + "Variable", + {}, + [ + "t", + "19" + ] + ], + [ + "Variable", + {}, + [ + "t", + "18" + ] + ] + ] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] ] ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "6" - ] - ], - "body": [ - "Apply", + ], [ - "Reference", - {}, + "AsPattern", [ + "Tuple", + {}, [ [ - "morphir" + "Variable", + {}, + [ + "t", + "20" + ] ], [ - "s", - "d", - "k" + "Variable", + {}, + [ + "t", + "19" + ] + ], + [ + "Variable", + {}, + [ + "t", + "18" + ] ] - ], + ] + ], + [ + "WildcardPattern", [ + "Tuple", + {}, [ - "basics" + [ + "Variable", + {}, + [ + "t", + "20" + ] + ], + [ + "Variable", + {}, + [ + "t", + "19" + ] + ], + [ + "Variable", + {}, + [ + "t", + "18" + ] + ] ] - ], - [ - "bool" ] ], - [] + [ + "x" + ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -146795,7 +170224,7 @@ {}, [ "t", - "18" + "20" ] ], [ @@ -146803,7 +170232,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -146811,7 +170240,7 @@ {}, [ "t", - "16" + "18" ] ] ] @@ -146843,10 +170272,39 @@ ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Tuple", {}, + [ + [ + "Variable", + {}, + [ + "t", + "20" + ] + ], + [ + "Variable", + {}, + [ + "t", + "19" + ] + ], + [ + "Variable", + {}, + [ + "t", + "18" + ] + ] + ] + ], + [ + "WildcardPattern", [ "Tuple", {}, @@ -146856,7 +170314,7 @@ {}, [ "t", - "18" + "20" ] ], [ @@ -146864,7 +170322,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -146872,11 +170330,45 @@ {}, [ "t", - "16" + "18" ] ] ] + ] + ], + [ + "y" + ] + ], + [ + "Apply", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] ], + [] + ], + [ + "Apply", [ "Function", {}, @@ -146889,7 +170381,7 @@ {}, [ "t", - "18" + "20" ] ], [ @@ -146897,7 +170389,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -146905,7 +170397,7 @@ {}, [ "t", - "16" + "18" ] ] ] @@ -146935,101 +170427,197 @@ ], [] ] - ] - ], - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] ], [ - "not", - "equal" - ] - ] - ], - [ - "Variable", - [ - "Tuple", - {}, - [ + "Reference", [ - "Variable", + "Function", {}, [ - "t", - "18" + "Tuple", + {}, + [ + [ + "Variable", + {}, + [ + "t", + "20" + ] + ], + [ + "Variable", + {}, + [ + "t", + "19" + ] + ], + [ + "Variable", + {}, + [ + "t", + "18" + ] + ] + ] + ], + [ + "Function", + {}, + [ + "Tuple", + {}, + [ + [ + "Variable", + {}, + [ + "t", + "20" + ] + ], + [ + "Variable", + {}, + [ + "t", + "19" + ] + ], + [ + "Variable", + {}, + [ + "t", + "18" + ] + ] + ] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ] ] ], [ - "Variable", - {}, [ - "t", - "17" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "not", + "equal" ] - ], + ] + ], + [ + "Variable", [ - "Variable", + "Tuple", {}, [ - "t", - "16" + [ + "Variable", + {}, + [ + "t", + "20" + ] + ], + [ + "Variable", + {}, + [ + "t", + "19" + ] + ], + [ + "Variable", + {}, + [ + "t", + "18" + ] + ] ] + ], + [ + "x" ] ] ], [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Tuple", - {}, - [ - [ - "Variable", - {}, - [ - "t", - "18" - ] - ], + "Variable", [ - "Variable", + "Tuple", {}, [ - "t", - "17" + [ + "Variable", + {}, + [ + "t", + "20" + ] + ], + [ + "Variable", + {}, + [ + "t", + "19" + ] + ], + [ + "Variable", + {}, + [ + "t", + "18" + ] + ] ] ], [ - "Variable", - {}, - [ - "t", - "16" - ] + "y" ] ] - ], - [ - "y" ] ] ] @@ -147075,7 +170663,7 @@ {}, [ "t", - "18" + "20" ] ], [ @@ -147083,7 +170671,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -147091,7 +170679,7 @@ {}, [ "t", - "16" + "18" ] ] ] @@ -147136,7 +170724,7 @@ {}, [ "t", - "18" + "20" ] ], [ @@ -147144,7 +170732,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -147152,7 +170740,7 @@ {}, [ "t", - "16" + "18" ] ] ] @@ -147169,7 +170757,7 @@ {}, [ "t", - "18" + "20" ] ], [ @@ -147177,7 +170765,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -147185,7 +170773,7 @@ {}, [ "t", - "16" + "18" ] ] ] @@ -147232,7 +170820,7 @@ {}, [ "t", - "18" + "20" ] ], [ @@ -147240,7 +170828,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -147248,7 +170836,7 @@ {}, [ "t", - "16" + "18" ] ] ] @@ -147261,7 +170849,7 @@ {}, [ "t", - "18" + "20" ] ], [ @@ -147276,7 +170864,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -147291,7 +170879,7 @@ {}, [ "t", - "16" + "18" ] ], [ @@ -147313,7 +170901,7 @@ {}, [ "t", - "18" + "20" ] ], [ @@ -147321,7 +170909,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -147329,7 +170917,7 @@ {}, [ "t", - "16" + "18" ] ] ] @@ -147342,7 +170930,7 @@ {}, [ "t", - "18" + "20" ] ], [ @@ -147357,7 +170945,7 @@ {}, [ "t", - "17" + "19" ] ], [ @@ -147372,7 +170960,7 @@ {}, [ "t", - "16" + "18" ] ], [ @@ -147507,11 +171095,32 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" - ], + "t", + "0" + ] + ], + [ + "Variable", + {}, + [ + "t", + "2" + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -147538,80 +171147,60 @@ [] ], [ - "Variable", + "Reference", {}, - [ - "t", - "0" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "3" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "bool" ] ], - [ - "bool" - ] - ], - [] + [] + ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "basics" - ] - ], + "s", + "d", + "k" + ] + ], + [ [ - "bool" + "basics" ] ], - [] + [ + "bool" + ] ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -147639,31 +171228,92 @@ ] ], [ + "x" + ] + ], + [ + "Apply", + [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "basics" + ] + ], + [ + "bool" ] ], + [] + ], + [ + "Reference", [ + "Function", + {}, [ - "basics" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] ] ], - [ - "not" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, [ [ [ @@ -147681,13 +171331,40 @@ ] ], [ - "bool" + "not" ] - ], - [] + ] ], [ - "x" + "Variable", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ], + [ + "x" + ] ] ] ] @@ -147936,11 +171613,44 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" + "t", + "0" + ] + ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "1" + ] ], + [ + "Variable", + {}, + [ + "t", + "4" + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -147967,18 +171677,62 @@ [] ], [ - "Variable", + "Function", {}, [ - "t", - "0" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] ] ] ], [ - [ - "y" - ], + "AsPattern", [ "Reference", {}, @@ -148005,52 +171759,39 @@ [] ], [ - "Variable", - {}, - [ - "t", - "1" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "6" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ + "WildcardPattern", [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "bool" + [] ] ], - [] + [ + "x" + ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -148106,10 +171847,34 @@ ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -148134,7 +171899,41 @@ ] ], [] + ] + ], + [ + "y" + ] + ], + [ + "Apply", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] ], + [] + ], + [ + "Apply", [ "Function", {}, @@ -148188,90 +171987,176 @@ ], [] ] - ] - ], - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] ], [ - "or" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ + "Reference", [ + "Function", + {}, [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] ], [ - "s", - "d", - "k" + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ] ] ], [ [ - "basics" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "or" ] - ], - [ - "bool" ] ], - [] - ], - [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ [ + "Variable", [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] ], [ - "s", - "d", - "k" + "x" ] - ], + ] + ], + [ + "Variable", [ + "Reference", + {}, [ - "basics" - ] + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] ], [ - "bool" + "y" ] - ], - [] - ], - [ - "y" + ] ] ] ] @@ -148852,11 +172737,44 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" + "t", + "0" + ] + ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "1" + ] ], + [ + "Variable", + {}, + [ + "t", + "4" + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -148883,18 +172801,62 @@ [] ], [ - "Variable", + "Function", {}, [ - "t", - "0" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] ] ] ], [ - [ - "y" - ], + "AsPattern", [ "Reference", {}, @@ -148921,52 +172883,39 @@ [] ], [ - "Variable", - {}, - [ - "t", - "1" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "6" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ + "WildcardPattern", [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "float" + [] ] ], - [] + [ + "x" + ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -149022,10 +172971,34 @@ ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -149050,7 +173023,41 @@ ] ], [] + ] + ], + [ + "y" + ] + ], + [ + "Apply", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] ], + [] + ], + [ + "Apply", [ "Function", {}, @@ -149104,90 +173111,176 @@ ], [] ] - ] - ], - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] ], [ - "power" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ + "Reference", [ + "Function", + {}, [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] ], [ - "s", - "d", - "k" + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ] ] ], [ [ - "basics" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "power" ] - ], - [ - "float" ] ], - [] - ], - [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ [ + "Variable", [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] ], [ - "s", - "d", - "k" + "x" ] - ], + ] + ], + [ + "Variable", [ + "Reference", + {}, [ - "basics" - ] + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] ], [ - "float" + "y" ] - ], - [] - ], - [ - "y" + ] ] ] ] @@ -149554,11 +173647,44 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" + "t", + "0" + ] + ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "1" + ] ], + [ + "Variable", + {}, + [ + "t", + "4" + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -149568,35 +173694,79 @@ "morphir" ], [ - "s", - "d", - "k" - ] - ], - [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], [ - "basics" + "int" ] ], - [ - "int" - ] - ], - [] - ], - [ - "Variable", - {}, - [ - "t", - "0" + [] ] ] ], [ - [ - "y" - ], + "AsPattern", [ "Reference", {}, @@ -149623,52 +173793,39 @@ [] ], [ - "Variable", - {}, - [ - "t", - "1" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "6" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ + "WildcardPattern", [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "int" + [] ] ], - [] + [ + "x" + ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -149724,10 +173881,34 @@ ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -149752,7 +173933,41 @@ ] ], [] + ] + ], + [ + "y" + ] + ], + [ + "Apply", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] ], + [] + ], + [ + "Apply", [ "Function", {}, @@ -149806,90 +174021,176 @@ ], [] ] - ] - ], - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] ], [ - "power" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ + "Reference", [ + "Function", + {}, [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ], [ - "s", - "d", - "k" + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] ] ], [ [ - "basics" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "power" ] - ], - [ - "int" ] ], - [] - ], - [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ [ + "Variable", [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ], [ - "s", - "d", - "k" + "x" ] - ], + ] + ], + [ + "Variable", [ + "Reference", + {}, [ - "basics" - ] + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ], [ - "int" + "y" ] - ], - [] - ], - [ - "y" + ] ] ] ] @@ -150256,11 +174557,32 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" - ], + "t", + "0" + ] + ], + [ + "Variable", + {}, + [ + "t", + "2" + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -150287,80 +174609,60 @@ [] ], [ - "Variable", + "Reference", {}, - [ - "t", - "0" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "3" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "float" ] ], - [ - "float" - ] - ], - [] + [] + ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "basics" - ] - ], + "s", + "d", + "k" + ] + ], + [ [ - "float" + "basics" ] ], - [] + [ + "float" + ] ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -150388,31 +174690,92 @@ ] ], [ + "x" + ] + ], + [ + "Apply", + [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "basics" + ] + ], + [ + "float" ] ], + [] + ], + [ + "Reference", [ + "Function", + {}, [ - "basics" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] ] ], - [ - "radians" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, [ [ [ @@ -150430,13 +174793,40 @@ ] ], [ - "float" + "radians" ] - ], - [] + ] ], [ - "x" + "Variable", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "x" + ] ] ] ] @@ -150702,11 +175092,44 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" + "t", + "0" + ] + ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "1" + ] ], + [ + "Variable", + {}, + [ + "t", + "4" + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -150733,18 +175156,62 @@ [] ], [ - "Variable", + "Function", {}, [ - "t", - "0" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ] ] ], [ - [ - "y" - ], + "AsPattern", [ "Reference", {}, @@ -150771,52 +175238,39 @@ [] ], [ - "Variable", - {}, - [ - "t", - "1" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "6" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ + "WildcardPattern", [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "int" + [] ] ], - [] + [ + "x" + ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -150872,10 +175326,34 @@ ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -150900,7 +175378,41 @@ ] ], [] + ] + ], + [ + "y" + ] + ], + [ + "Apply", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] ], + [] + ], + [ + "Apply", [ "Function", {}, @@ -150954,91 +175466,177 @@ ], [] ] - ] - ], - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] ], [ - "remainder", - "by" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ + "Reference", [ + "Function", + {}, [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ], [ - "s", - "d", - "k" + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] ] ], [ [ - "basics" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "remainder", + "by" ] - ], - [ - "int" ] ], - [] - ], - [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ [ + "Variable", [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ], [ - "s", - "d", - "k" + "x" ] - ], + ] + ], + [ + "Variable", [ + "Reference", + {}, [ - "basics" - ] + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ], [ - "int" + "y" ] - ], - [] - ], - [ - "y" + ] ] ] ] @@ -151405,11 +176003,32 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" - ], + "t", + "0" + ] + ], + [ + "Variable", + {}, + [ + "t", + "2" + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -151436,80 +176055,60 @@ [] ], [ - "Variable", + "Reference", {}, - [ - "t", - "0" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "3" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "int" ] ], - [ - "int" - ] - ], - [] + [] + ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "basics" - ] - ], + "s", + "d", + "k" + ] + ], + [ [ - "float" + "basics" ] ], - [] + [ + "float" + ] ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -151530,38 +176129,99 @@ ] ], [ - "int" + "float" ] ], [] ] ], [ + "x" + ] + ], + [ + "Apply", + [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "basics" + ] + ], + [ + "int" ] ], + [] + ], + [ + "Reference", [ + "Function", + {}, [ - "basics" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ] ], - [ - "round" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, [ [ [ @@ -151579,13 +176239,40 @@ ] ], [ - "float" + "round" ] - ], - [] + ] ], [ - "x" + "Variable", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "x" + ] ] ] ] @@ -151835,10 +176522,56 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" + "t", + "0" + ] + ], + [ + "Variable", + {}, + [ + "t", + "2" + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] ], [ "Reference", @@ -151860,61 +176593,41 @@ ] ], [ - "float" + "int" ] ], [] - ], - [ - "Variable", - {}, - [ - "t", - "0" - ] ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "3" - ] - ], - "body": [ - "Apply", + ], [ - "Reference", - {}, + "AsPattern", [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "float" ] ], - [ - "int" - ] + [] ], - [] - ], - [ - "Reference", [ - "Function", - {}, + "WildcardPattern", [ "Reference", {}, @@ -151939,59 +176652,95 @@ ] ], [] - ], + ] + ], + [ + "x" + ] + ], + [ + "Apply", + [ + "Reference", + {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] + "morphir" ], [ - "int" + "s", + "d", + "k" ] ], - [] - ] - ], - [ - [ [ - "morphir" + [ + "basics" + ] ], [ - "s", - "d", - "k" + "int" ] ], + [] + ], + [ + "Reference", [ + "Function", + {}, [ - "basics" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ] ], - [ - "round" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, [ [ [ @@ -152009,13 +176758,40 @@ ] ], [ - "float" + "round" ] - ], - [] + ] ], [ - "x" + "Variable", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "x" + ] ] ] ] @@ -152264,11 +177040,32 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" - ], + "t", + "0" + ] + ], + [ + "Variable", + {}, + [ + "t", + "2" + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -152295,80 +177092,60 @@ [] ], [ - "Variable", + "Reference", {}, - [ - "t", - "0" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "3" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "float" ] ], - [ - "float" - ] - ], - [] + [] + ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "basics" - ] - ], + "s", + "d", + "k" + ] + ], + [ [ - "float" + "basics" ] ], - [] + [ + "float" + ] ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -152396,31 +177173,92 @@ ] ], [ + "x" + ] + ], + [ + "Apply", + [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "basics" + ] + ], + [ + "float" ] ], + [] + ], + [ + "Reference", [ + "Function", + {}, [ - "basics" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] ] ], - [ - "sin" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, [ [ [ @@ -152438,13 +177276,40 @@ ] ], [ - "float" + "sin" ] - ], - [] + ] ], [ - "x" + "Variable", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "x" + ] ] ] ] @@ -152798,11 +177663,32 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" - ], + "t", + "0" + ] + ], + [ + "Variable", + {}, + [ + "t", + "2" + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -152829,80 +177715,60 @@ [] ], [ - "Variable", + "Reference", {}, - [ - "t", - "0" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "3" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "float" ] ], - [ - "float" - ] - ], - [] + [] + ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "basics" - ] - ], + "s", + "d", + "k" + ] + ], + [ [ - "float" + "basics" ] ], - [] + [ + "float" + ] ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -152930,31 +177796,92 @@ ] ], [ + "x" + ] + ], + [ + "Apply", + [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "basics" + ] + ], + [ + "float" ] ], + [] + ], + [ + "Reference", [ + "Function", + {}, [ - "basics" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] ] ], - [ - "sqrt" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, [ [ [ @@ -152972,13 +177899,40 @@ ] ], [ - "float" + "sqrt" ] - ], - [] + ] ], [ - "x" + "Variable", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "x" + ] ] ] ] @@ -153228,11 +178182,44 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" + "t", + "0" + ] + ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "1" + ] ], + [ + "Variable", + {}, + [ + "t", + "4" + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -153259,18 +178246,62 @@ [] ], [ - "Variable", + "Function", {}, [ - "t", - "0" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] ] ] ], [ - [ - "y" - ], + "AsPattern", [ "Reference", {}, @@ -153297,55 +178328,95 @@ [] ], [ - "Variable", - {}, + "WildcardPattern", [ - "t", - "1" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] ] + ], + [ + "x" ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "6" - ] - ], - "body": [ - "Apply", + ], [ - "Reference", - {}, + "Lambda", [ + "Function", + {}, [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] ], - [ - "s", - "d", - "k" - ] + [] ], [ + "Reference", + {}, [ - "basics" - ] - ], - [ - "float" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] ] ], - [] - ], - [ - "Apply", [ - "Function", - {}, + "AsPattern", [ "Reference", {}, @@ -153371,6 +178442,40 @@ ], [] ], + [ + "WildcardPattern", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ] + ], + [ + "y" + ] + ], + [ + "Apply", [ "Reference", {}, @@ -153390,21 +178495,153 @@ "basics" ] ], - [ - "float" - ] - ], - [] - ] - ], - [ - "Reference", - [ - "Function", - {}, - [ - "Reference", - {}, + [ + "float" + ] + ], + [] + ], + [ + "Apply", + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ] + ], + [ + "Reference", + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ] + ] + ], [ [ [ @@ -153422,14 +178659,12 @@ ] ], [ - "float" + "subtract" ] - ], - [] + ] ], [ - "Function", - {}, + "Variable", [ "Reference", {}, @@ -153456,114 +178691,41 @@ [] ], [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "float" - ] - ], - [] + "x" ] ] ], [ + "Variable", [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "subtract" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "float" ] ], - [ - "float" - ] - ], - [] - ], - [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] + [] ], [ - "float" + "y" ] - ], - [] - ], - [ - "y" + ] ] ] ] @@ -153930,11 +179092,44 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "0" + ] + ], [ + "Function", + {}, [ - "x" + "Variable", + {}, + [ + "t", + "1" + ] ], + [ + "Variable", + {}, + [ + "t", + "4" + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -153961,18 +179156,62 @@ [] ], [ - "Variable", + "Function", {}, [ - "t", - "0" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ] ] ], [ - [ - "y" - ], + "AsPattern", [ "Reference", {}, @@ -153999,52 +179238,39 @@ [] ], [ - "Variable", - {}, - [ - "t", - "1" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "6" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ + "WildcardPattern", [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "int" + [] ] ], - [] + [ + "x" + ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -154100,10 +179326,34 @@ ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -154128,7 +179378,41 @@ ] ], [] + ] + ], + [ + "y" + ] + ], + [ + "Apply", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] ], + [] + ], + [ + "Apply", [ "Function", {}, @@ -154182,90 +179466,176 @@ ], [] ] - ] - ], - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] ], [ - "subtract" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ + "Reference", [ + "Function", + {}, [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ], [ - "s", - "d", - "k" + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] ] ], [ [ - "basics" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "subtract" ] - ], - [ - "int" ] ], - [] - ], - [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ [ + "Variable", [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ], [ - "s", - "d", - "k" + "x" ] - ], + ] + ], + [ + "Variable", [ + "Reference", + {}, [ - "basics" - ] + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ], [ - "int" + "y" ] - ], - [] - ], - [ - "y" + ] ] ] ] @@ -154727,11 +180097,44 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" + "t", + "0" + ] + ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "1" + ] ], + [ + "Variable", + {}, + [ + "t", + "4" + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -154759,18 +180162,64 @@ [] ], [ - "Variable", + "Function", {}, [ - "t", - "0" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "int" + ] + ], + [ + "int", + "64" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "int" + ] + ], + [ + "int", + "64" + ] + ], + [] ] ] ], [ - [ - "y" - ], + "AsPattern", [ "Reference", {}, @@ -154798,53 +180247,40 @@ [] ], [ - "Variable", - {}, - [ - "t", - "1" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "6" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ + "WildcardPattern", [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "int" + ] + ], + [ + "int", + "64" + ] ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "int" - ] - ], - [ - "int", - "64" + [] ] ], - [] + [ + "x" + ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -154902,10 +180338,35 @@ ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "int" + ] + ], + [ + "int", + "64" + ] + ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -154931,7 +180392,42 @@ ] ], [] + ] + ], + [ + "y" + ] + ], + [ + "Apply", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "int" + ] + ], + [ + "int", + "64" + ] ], + [] + ], + [ + "Apply", [ "Function", {}, @@ -154987,92 +180483,181 @@ ], [] ] - ] - ], - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] ], [ - "subtract" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ + "Reference", [ + "Function", + {}, [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "int" + ] + ], + [ + "int", + "64" + ] + ], + [] ], [ - "s", - "d", - "k" + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "int" + ] + ], + [ + "int", + "64" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "int" + ] + ], + [ + "int", + "64" + ] + ], + [] + ] ] ], [ [ - "int" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "subtract" ] - ], - [ - "int", - "64" ] ], - [] - ], - [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ [ + "Variable", [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "int" + ] + ], + [ + "int", + "64" + ] + ], + [] ], [ - "s", - "d", - "k" + "x" ] - ], + ] + ], + [ + "Variable", [ + "Reference", + {}, [ - "int" - ] + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "int" + ] + ], + [ + "int", + "64" + ] + ], + [] ], [ - "int", - "64" + "y" ] - ], - [] - ], - [ - "y" + ] ] ] ] @@ -155592,11 +181177,32 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" - ], + "t", + "0" + ] + ], + [ + "Variable", + {}, + [ + "t", + "2" + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -155623,80 +181229,60 @@ [] ], [ - "Variable", + "Reference", {}, - [ - "t", - "0" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "3" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "float" ] ], - [ - "float" - ] - ], - [] + [] + ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "basics" - ] - ], + "s", + "d", + "k" + ] + ], + [ [ - "float" + "basics" ] ], - [] + [ + "float" + ] ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -155724,31 +181310,92 @@ ] ], [ + "x" + ] + ], + [ + "Apply", + [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "basics" + ] + ], + [ + "float" ] ], + [] + ], + [ + "Reference", [ + "Function", + {}, [ - "basics" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] ] ], - [ - "tan" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, [ [ [ @@ -155766,13 +181413,40 @@ ] ], [ - "float" + "tan" ] - ], - [] + ] ], [ - "x" + "Variable", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "x" + ] ] ] ] @@ -156220,11 +181894,32 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "0" + ] + ], [ + "Variable", + {}, [ - "x" - ], + "t", + "2" + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Tuple", {}, @@ -156282,142 +181977,122 @@ ] ], [ - "Variable", + "Tuple", {}, [ - "t", - "0" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "3" - ] - ], - "body": [ - "Apply", - [ - "Tuple", - {}, - [ - [ - "Reference", - {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "float" ] ], - [ - "float" - ] + [] ], - [] - ], - [ - "Reference", - {}, [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "float" ] ], - [ - "float" - ] - ], - [] + [] + ] ] ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Tuple", {}, [ - "Tuple", - {}, [ + "Reference", + {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "basics" - ] - ], + "s", + "d", + "k" + ] + ], + [ [ - "float" + "basics" ] ], - [] + [ + "float" + ] ], + [] + ], + [ + "Reference", + {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "basics" - ] - ], + "s", + "d", + "k" + ] + ], + [ [ - "float" + "basics" ] ], - [] - ] + [ + "float" + ] + ], + [] ] - ], + ] + ], + [ + "WildcardPattern", [ "Tuple", {}, @@ -156476,29 +182151,11 @@ ] ], [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "to", - "polar" - ] + "x" ] ], [ - "Variable", + "Apply", [ "Tuple", {}, @@ -156556,7 +182213,206 @@ ] ], [ - "x" + "Reference", + [ + "Function", + {}, + [ + "Tuple", + {}, + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ] + ] + ], + [ + "Tuple", + {}, + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ] + ] + ] + ], + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "to", + "polar" + ] + ] + ], + [ + "Variable", + [ + "Tuple", + {}, + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ] + ] + ], + [ + "x" + ] ] ] ] @@ -156991,11 +182847,32 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" - ], + "t", + "0" + ] + ], + [ + "Variable", + {}, + [ + "t", + "2" + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -157022,80 +182899,60 @@ [] ], [ - "Variable", + "Reference", {}, - [ - "t", - "0" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "3" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "int" ] ], - [ - "int" - ] - ], - [] + [] + ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "basics" - ] - ], + "s", + "d", + "k" + ] + ], + [ [ - "float" + "basics" ] ], - [] + [ + "float" + ] ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -157116,38 +182973,99 @@ ] ], [ - "int" + "float" ] ], [] ] ], [ + "x" + ] + ], + [ + "Apply", + [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "basics" + ] + ], + [ + "int" ] ], + [] + ], + [ + "Reference", [ + "Function", + {}, [ - "basics" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ] ], - [ - "truncate" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, [ [ [ @@ -157165,13 +183083,40 @@ ] ], [ - "float" + "truncate" ] - ], - [] + ] ], [ - "x" + "Variable", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "x" + ] ] ] ] @@ -157421,11 +183366,32 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" - ], + "t", + "0" + ] + ], + [ + "Variable", + {}, + [ + "t", + "2" + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -157452,80 +183418,60 @@ [] ], [ - "Variable", + "Reference", {}, - [ - "t", - "0" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "3" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "int" ] ], - [ - "int" - ] - ], - [] + [] + ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "basics" - ] - ], + "s", + "d", + "k" + ] + ], + [ [ - "float" + "basics" ] ], - [] + [ + "float" + ] ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -157546,38 +183492,99 @@ ] ], [ - "int" + "float" ] ], [] ] ], [ + "x" + ] + ], + [ + "Apply", + [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "basics" + ] + ], + [ + "int" ] ], + [] + ], + [ + "Reference", [ + "Function", + {}, [ - "basics" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] ] ], - [ - "truncate" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, [ [ [ @@ -157595,13 +183602,40 @@ ] ], [ - "float" + "truncate" ] - ], - [] + ] ], [ - "x" + "Variable", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "x" + ] ] ] ] @@ -157850,11 +183884,32 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" - ], + "t", + "0" + ] + ], + [ + "Variable", + {}, + [ + "t", + "2" + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -157881,80 +183936,60 @@ [] ], [ - "Variable", + "Reference", {}, - [ - "t", - "0" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "3" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "float" ] ], - [ - "float" - ] - ], - [] + [] + ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "basics" - ] - ], + "s", + "d", + "k" + ] + ], + [ [ - "float" + "basics" ] ], - [] + [ + "float" + ] ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -157982,31 +184017,92 @@ ] ], [ + "x" + ] + ], + [ + "Apply", + [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "basics" + ] + ], + [ + "float" ] ], + [] + ], + [ + "Reference", [ + "Function", + {}, [ - "basics" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] ] ], - [ - "turns" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, [ [ [ @@ -158024,13 +184120,40 @@ ] ], [ - "float" + "turns" ] - ], - [] + ] ], [ - "x" + "Variable", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] + ], + [ + "x" + ] ] ] ] @@ -158502,11 +184625,44 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" + "t", + "0" + ] + ], + [ + "Function", + {}, + [ + "Variable", + {}, + [ + "t", + "1" + ] ], + [ + "Variable", + {}, + [ + "t", + "4" + ] + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -158533,18 +184689,62 @@ [] ], [ - "Variable", + "Function", {}, [ - "t", - "0" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] ] ] ], [ - [ - "y" - ], + "AsPattern", [ "Reference", {}, @@ -158571,52 +184771,39 @@ [] ], [ - "Variable", - {}, - [ - "t", - "1" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "6" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ + "WildcardPattern", [ + "Reference", + {}, [ - "morphir" + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] ], - [ - "s", - "d", - "k" - ] - ], - [ - [ - "basics" - ] - ], - [ - "bool" + [] ] ], - [] + [ + "x" + ] ], [ - "Apply", + "Lambda", [ "Function", {}, @@ -158672,10 +184859,34 @@ ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -158700,7 +184911,41 @@ ] ], [] + ] + ], + [ + "y" + ] + ], + [ + "Apply", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] ], + [] + ], + [ + "Apply", [ "Function", {}, @@ -158754,90 +184999,176 @@ ], [] ] - ] - ], - [ - [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] ], [ + "Reference", [ - "basics" - ] - ], - [ - "xor" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ - [ + "Function", + {}, [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] ], [ - "s", - "d", - "k" + "Function", + {}, + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] + ] ] ], [ [ - "basics" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "xor" ] - ], - [ - "bool" ] ], - [] - ], - [ - "x" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, - [ [ + "Variable", [ - "morphir" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] ], [ - "s", - "d", - "k" + "x" ] - ], + ] + ], + [ + "Variable", [ + "Reference", + {}, [ - "basics" - ] + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "bool" + ] + ], + [] ], [ - "bool" + "y" ] - ], - [] - ], - [ - "y" + ] ] ] ] @@ -159204,11 +185535,32 @@ "f" ], { - "inputTypes": [ + "inputTypes": [], + "outputType": [ + "Function", + {}, [ + "Variable", + {}, [ - "x" - ], + "t", + "0" + ] + ], + [ + "Variable", + {}, + [ + "t", + "2" + ] + ] + ], + "body": [ + "Lambda", + [ + "Function", + {}, [ "Reference", {}, @@ -159235,80 +185587,60 @@ [] ], [ - "Variable", + "Reference", {}, - [ - "t", - "0" - ] - ] - ] - ], - "outputType": [ - "Variable", - {}, - [ - "t", - "3" - ] - ], - "body": [ - "Apply", - [ - "Reference", - {}, - [ [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" - ] - ], - [ + [ + "basics" + ] + ], [ - "basics" + "float" ] ], - [ - "float" - ] - ], - [] + [] + ] ], [ - "Reference", + "AsPattern", [ - "Function", + "Reference", {}, [ - "Reference", - {}, [ [ - [ - "morphir" - ], - [ - "s", - "d", - "k" - ] + "morphir" ], [ - [ - "basics" - ] - ], + "s", + "d", + "k" + ] + ], + [ [ - "int" + "basics" ] ], - [] + [ + "int" + ] ], + [] + ], + [ + "WildcardPattern", [ "Reference", {}, @@ -159329,39 +185661,99 @@ ] ], [ - "float" + "int" ] ], [] ] ], [ + "x" + ] + ], + [ + "Apply", + [ + "Reference", + {}, [ [ - "morphir" + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] ], [ - "s", - "d", - "k" + [ + "basics" + ] + ], + [ + "float" ] ], + [] + ], + [ + "Reference", [ + "Function", + {}, [ - "basics" + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "float" + ] + ], + [] ] ], - [ - "to", - "float" - ] - ] - ], - [ - "Variable", - [ - "Reference", - {}, [ [ [ @@ -159379,13 +185771,41 @@ ] ], [ - "int" + "to", + "float" ] - ], - [] + ] ], [ - "x" + "Variable", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "x" + ] ] ] ] @@ -161566,6 +187986,565 @@ "value": { "types": [], "values": [ + [ + [ + "int", + "to", + "int" + ], + { + "access": "Public", + "value": { + "doc": "", + "value": { + "inputTypes": [ + [ + [ + "x" + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ] + ], + "outputType": [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + "body": [ + "Variable", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "x" + ] + ] + } + } + } + ], + [ + [ + "tuple", + "up" + ], + { + "access": "Public", + "value": { + "doc": "", + "value": { + "inputTypes": [ + [ + [ + "x" + ], + [ + "Variable", + {}, + [ + "t" + ] + ], + [ + "Variable", + {}, + [ + "t" + ] + ] + ], + [ + [ + "y" + ], + [ + "Variable", + {}, + [ + "t" + ] + ], + [ + "Variable", + {}, + [ + "t" + ] + ] + ] + ], + "outputType": [ + "Tuple", + {}, + [ + [ + "Variable", + {}, + [ + "t" + ] + ], + [ + "Variable", + {}, + [ + "t" + ] + ] + ] + ], + "body": [ + "Tuple", + [ + "Tuple", + {}, + [ + [ + "Variable", + {}, + [ + "t" + ] + ], + [ + "Variable", + {}, + [ + "t" + ] + ] + ] + ], + [ + [ + "Variable", + [ + "Variable", + {}, + [ + "t" + ] + ], + [ + "x" + ] + ], + [ + "Variable", + [ + "Variable", + {}, + [ + "t" + ] + ], + [ + "y" + ] + ] + ] + ] + } + } + } + ], + [ + [ + "two", + "arg", + "entry" + ], + { + "access": "Public", + "value": { + "doc": "", + "value": { + "inputTypes": [ + [ + [ + "i" + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ] + ], + [ + [ + "s" + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ] + ] + ], + "outputType": [ + "Tuple", + {}, + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ] + ] + ], + "body": [ + "Tuple", + [ + "Tuple", + {}, + [ + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ] + ] + ], + [ + [ + "Variable", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "basics" + ] + ], + [ + "int" + ] + ], + [] + ], + [ + "i" + ] + ], + [ + "Variable", + [ + "Reference", + {}, + [ + [ + [ + "morphir" + ], + [ + "s", + "d", + "k" + ] + ], + [ + [ + "string" + ] + ], + [ + "string" + ] + ], + [] + ], + [ + "s" + ] + ] + ] + ] + } + } + } + ], [ [ "with", From 69595d6bfba2cabb12e0ce1463bf73a4eff81d6d Mon Sep 17 00:00:00 2001 From: Edward Peters Date: Fri, 25 Aug 2023 12:48:18 -0700 Subject: [PATCH 323/323] Formatting --- .../runtime/src/org/finos/morphir/runtime/quick/Result.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/morphir/runtime/src/org/finos/morphir/runtime/quick/Result.scala b/morphir/runtime/src/org/finos/morphir/runtime/quick/Result.scala index b080b9643..9e884c1bf 100644 --- a/morphir/runtime/src/org/finos/morphir/runtime/quick/Result.scala +++ b/morphir/runtime/src/org/finos/morphir/runtime/quick/Result.scala @@ -73,7 +73,7 @@ object Result { } } - case class MapResult[TA, VA](elements: mutable.LinkedHashMap[Result[TA, VA], Result[TA, VA]]) extends Result[TA, VA]{ + case class MapResult[TA, VA](elements: mutable.LinkedHashMap[Result[TA, VA], Result[TA, VA]]) extends Result[TA, VA] { override def succinct(depth: Int) = if (depth == 0) "Dict(..)" else { s"Dict(${elements.map { case (key, value) => s"${key.succinct(depth - 1)} -> ${value.succinct(depth - 1)}" }.mkString(", ")})"