packages feed

hydra-kernel-0.18.1: hydra-kernel-json/hydra/core/templates.json

{
  "name": "hydra.core.templates",
  "metadata": {
    "description": "A utility which instantiates a nonrecursive type with default values",
    "comments": [],
    "seeAlso": [],
    "provisions": []},
  "dependencies": [
    {"module": "hydra.core.decode.model"},
    {"module": "hydra.core.errors"},
    {"module": "hydra.core.lib.eithers"},
    {"module": "hydra.core.lib.logic"},
    {"module": "hydra.core.lib.maps"},
    {"module": "hydra.core.lib.optionals"},
    {"module": "hydra.core.lib.sets"},
    {"module": "hydra.core.lib.strings"},
    {"module": "hydra.core.model"}],
  "definitions": [
    {
      "term": {
        "name": "hydra.core.templates.graphToSchema",
        "signature": {
          "typeParameters": [{"name": "t0", "constraints": []}],
          "parameters": [
            {"name": "arg0", "type": {"variable": "t0"}, "isLazy": false},
            {"name": "arg1", "type": {"variable": "hydra.core.graph.Graph"}, "isLazy": false},
            {"name": "arg2", "type": {"list": {"variable": "hydra.core.model.Binding"}}, "isLazy": false}],
          "result": {
            "type": {
              "either": {
                "left": {"variable": "hydra.core.errors.DecodingError"},
                "right": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.Type"}}}}}}},
        "body": {
          "typeLambda": {
            "parameter": "t0",
            "body": {
              "annotated": {
                "body": {
                  "lambda": {
                    "parameter": "cx",
                    "domain": {"variable": "t0"},
                    "body": {
                      "lambda": {
                        "parameter": "graph",
                        "domain": {"variable": "hydra.core.graph.Graph"},
                        "body": {
                          "lambda": {
                            "parameter": "els",
                            "domain": {"list": {"variable": "hydra.core.model.Binding"}},
                            "body": {
                              "let": {
                                "bindings": [
                                  {
                                    "name": "toPair",
                                    "term": {
                                      "lambda": {
                                        "parameter": "el",
                                        "domain": {"variable": "hydra.core.model.Binding"},
                                        "body": {
                                          "let": {
                                            "bindings": [
                                              {
                                                "name": "name",
                                                "term": {
                                                  "application": {"function": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "name"}}, "argument": {"variable": "el"}}},
                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Name"}, "constraints": []}}],
                                            "body": {
                                              "application": {
                                                "function": {
                                                  "application": {
                                                    "function": {
                                                      "typeApplication": {
                                                        "body": {
                                                          "typeApplication": {
                                                            "body": {
                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.eithers.bind"}, "type": {"variable": "hydra.core.errors.DecodingError"}}},
                                                            "type": {"variable": "hydra.core.model.Type"}}},
                                                        "type": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.model.Type"}}}}},
                                                    "argument": {
                                                      "application": {
                                                        "function": {"application": {"function": {"variable": "hydra.core.decode.model.type"}, "argument": {"variable": "graph"}}},
                                                        "argument": {
                                                          "application": {"function": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "term"}}, "argument": {"variable": "el"}}}}}}},
                                                "argument": {
                                                  "lambda": {
                                                    "parameter": "t",
                                                    "domain": {"variable": "hydra.core.model.Type"},
                                                    "body": {
                                                      "typeApplication": {
                                                        "body": {
                                                          "typeApplication": {
                                                            "body": {
                                                              "either": {
                                                                "right": {
                                                                  "typeApplication": {
                                                                    "body": {
                                                                      "typeApplication": {
                                                                        "body": {"pair": {"first": {"variable": "name"}, "second": {"variable": "t"}}},
                                                                        "type": {"variable": "hydra.core.model.Name"}}},
                                                                    "type": {"variable": "hydra.core.model.Type"}}}}},
                                                            "type": {"variable": "hydra.core.errors.DecodingError"}}},
                                                        "type": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.model.Type"}}}}}}}}}}}}},
                                    "typeScheme": {
                                      "variables": [],
                                      "body": {
                                        "function": {
                                          "domain": {"variable": "hydra.core.model.Binding"},
                                          "codomain": {
                                            "either": {
                                              "left": {"variable": "hydra.core.errors.DecodingError"},
                                              "right": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.model.Type"}}}}}}},
                                      "constraints": []}}],
                                "body": {
                                  "application": {
                                    "function": {
                                      "application": {
                                        "function": {
                                          "typeApplication": {
                                            "body": {
                                              "typeApplication": {
                                                "body": {
                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.eithers.bind"}, "type": {"variable": "hydra.core.errors.DecodingError"}}},
                                                "type": {"list": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.model.Type"}}}}}},
                                            "type": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.Type"}}}}},
                                        "argument": {
                                          "application": {
                                            "function": {
                                              "application": {
                                                "function": {
                                                  "typeApplication": {
                                                    "body": {
                                                      "typeApplication": {
                                                        "body": {
                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.eithers.mapList"}, "type": {"variable": "hydra.core.model.Binding"}}},
                                                        "type": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.model.Type"}}}}},
                                                    "type": {"variable": "hydra.core.errors.DecodingError"}}},
                                                "argument": {"variable": "toPair"}}},
                                            "argument": {"variable": "els"}}}}},
                                    "argument": {
                                      "lambda": {
                                        "parameter": "pairs",
                                        "domain": {"list": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.model.Type"}}}},
                                        "body": {
                                          "typeApplication": {
                                            "body": {
                                              "typeApplication": {
                                                "body": {
                                                  "either": {
                                                    "right": {
                                                      "application": {
                                                        "function": {
                                                          "typeApplication": {
                                                            "body": {
                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.maps.fromList"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                            "type": {"variable": "hydra.core.model.Type"}}},
                                                        "argument": {"variable": "pairs"}}}}},
                                                "type": {"variable": "hydra.core.errors.DecodingError"}}},
                                            "type": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.Type"}}}}}}}}}}}}}}}}},
                "annotation": {
                  "map": [
                    {
                      "key": {"variable": "description"},
                      "value": {"literal": {"string": "Decode a list of type-encoding bindings into a map of named types"}}}]}}}}}}},
    {
      "term": {
        "name": "hydra.core.templates.instantiateTemplate",
        "signature": {
          "typeParameters": [{"name": "t0", "constraints": []}],
          "parameters": [
            {"name": "arg0", "type": {"variable": "t0"}, "isLazy": false},
            {"name": "arg1", "type": {"literal": "boolean"}, "isLazy": false},
            {
              "name": "arg2",
              "type": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.Type"}}},
              "isLazy": false},
            {"name": "arg3", "type": {"variable": "hydra.core.model.Name"}, "isLazy": false},
            {"name": "arg4", "type": {"variable": "hydra.core.model.Type"}, "isLazy": false}],
          "result": {"type": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.model.Term"}}}}},
        "body": {
          "typeLambda": {
            "parameter": "t0",
            "body": {
              "annotated": {
                "body": {
                  "lambda": {
                    "parameter": "cx",
                    "domain": {"variable": "t0"},
                    "body": {
                      "lambda": {
                        "parameter": "minimal",
                        "domain": {"literal": "boolean"},
                        "body": {
                          "lambda": {
                            "parameter": "schema",
                            "domain": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.Type"}}},
                            "body": {
                              "lambda": {
                                "parameter": "tname",
                                "domain": {"variable": "hydra.core.model.Name"},
                                "body": {
                                  "lambda": {
                                    "parameter": "t",
                                    "domain": {"variable": "hydra.core.model.Type"},
                                    "body": {
                                      "let": {
                                        "bindings": [
                                          {
                                            "name": "inst",
                                            "term": {
                                              "lambda": {
                                                "parameter": "tn",
                                                "domain": {"variable": "hydra.core.model.Name"},
                                                "body": {
                                                  "application": {
                                                    "function": {
                                                      "application": {
                                                        "function": {
                                                          "application": {
                                                            "function": {
                                                              "application": {
                                                                "function": {"typeApplication": {"body": {"variable": "hydra.core.templates.instantiateTemplate"}, "type": {"variable": "t0"}}},
                                                                "argument": {"variable": "cx"}}},
                                                            "argument": {"variable": "minimal"}}},
                                                        "argument": {"variable": "schema"}}},
                                                    "argument": {"variable": "tn"}}}}},
                                            "typeScheme": {
                                              "variables": [],
                                              "body": {
                                                "function": {
                                                  "domain": {"variable": "hydra.core.model.Name"},
                                                  "codomain": {
                                                    "function": {
                                                      "domain": {"variable": "hydra.core.model.Type"},
                                                      "codomain": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.model.Term"}}}}}}},
                                              "constraints": []}}],
                                        "body": {
                                          "let": {
                                            "bindings": [
                                              {
                                                "name": "noPoly",
                                                "term": {
                                                  "typeLambda": {
                                                    "parameter": "t1",
                                                    "body": {
                                                      "typeApplication": {
                                                        "body": {
                                                          "typeApplication": {
                                                            "body": {
                                                              "either": {
                                                                "left": {
                                                                  "inject": {
                                                                    "typeName": "hydra.core.errors.Error",
                                                                    "field": {
                                                                      "name": "extraction",
                                                                      "term": {
                                                                        "inject": {
                                                                          "typeName": "hydra.core.errors.ExtractionError",
                                                                          "field": {
                                                                            "name": "unexpectedShape",
                                                                            "term": {
                                                                              "record": {
                                                                                "typeName": "hydra.core.errors.UnexpectedShapeError",
                                                                                "fields": [
                                                                                  {"name": "expected", "term": {"literal": {"string": "non-polymorphic type"}}},
                                                                                  {"name": "actual", "term": {"literal": {"string": "polymorphic or function type"}}}]}}}}}}}}}},
                                                            "type": {"variable": "hydra.core.errors.Error"}}},
                                                        "type": {"variable": "t1"}}}}},
                                                "typeScheme": {
                                                  "variables": ["t1"],
                                                  "body": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "t1"}}},
                                                  "constraints": []}}],
                                            "body": {
                                              "let": {
                                                "bindings": [
                                                  {
                                                    "name": "forFloat",
                                                    "term": {
                                                      "lambda": {
                                                        "parameter": "ft",
                                                        "domain": {"variable": "hydra.core.model.FloatType"},
                                                        "body": {
                                                          "application": {
                                                            "function": {
                                                              "cases": {
                                                                "typeName": "hydra.core.model.FloatType",
                                                                "cases": [
                                                                  {
                                                                    "name": "float32",
                                                                    "handler": {
                                                                      "lambda": {
                                                                        "parameter": "_",
                                                                        "domain": "unit",
                                                                        "body": {
                                                                          "inject": {
                                                                            "typeName": "hydra.core.model.FloatValue",
                                                                            "field": {"name": "float32", "term": {"literal": {"float": {"float32": 0}}}}}}}}},
                                                                  {
                                                                    "name": "float64",
                                                                    "handler": {
                                                                      "lambda": {
                                                                        "parameter": "_",
                                                                        "domain": "unit",
                                                                        "body": {
                                                                          "inject": {
                                                                            "typeName": "hydra.core.model.FloatValue",
                                                                            "field": {"name": "float64", "term": {"literal": {"float": {"float64": 0}}}}}}}}}]}},
                                                            "argument": {"variable": "ft"}}}}},
                                                    "typeScheme": {
                                                      "variables": [],
                                                      "body": {
                                                        "function": {"domain": {"variable": "hydra.core.model.FloatType"}, "codomain": {"variable": "hydra.core.model.FloatValue"}}},
                                                      "constraints": []}}],
                                                "body": {
                                                  "let": {
                                                    "bindings": [
                                                      {
                                                        "name": "forInteger",
                                                        "term": {
                                                          "lambda": {
                                                            "parameter": "it",
                                                            "domain": {"variable": "hydra.core.model.IntegerType"},
                                                            "body": {
                                                              "application": {
                                                                "function": {
                                                                  "cases": {
                                                                    "typeName": "hydra.core.model.IntegerType",
                                                                    "cases": [
                                                                      {
                                                                        "name": "bigint",
                                                                        "handler": {
                                                                          "lambda": {
                                                                            "parameter": "_",
                                                                            "domain": "unit",
                                                                            "body": {
                                                                              "inject": {
                                                                                "typeName": "hydra.core.model.IntegerValue",
                                                                                "field": {"name": "bigint", "term": {"literal": {"integer": {"bigint": "0"}}}}}}}}},
                                                                      {
                                                                        "name": "int8",
                                                                        "handler": {
                                                                          "lambda": {
                                                                            "parameter": "_",
                                                                            "domain": "unit",
                                                                            "body": {
                                                                              "inject": {"typeName": "hydra.core.model.IntegerValue", "field": {"name": "int8", "term": {"literal": {"integer": {"int8": 0}}}}}}}}},
                                                                      {
                                                                        "name": "int16",
                                                                        "handler": {
                                                                          "lambda": {
                                                                            "parameter": "_",
                                                                            "domain": "unit",
                                                                            "body": {
                                                                              "inject": {
                                                                                "typeName": "hydra.core.model.IntegerValue",
                                                                                "field": {"name": "int16", "term": {"literal": {"integer": {"int16": 0}}}}}}}}},
                                                                      {
                                                                        "name": "int32",
                                                                        "handler": {
                                                                          "lambda": {
                                                                            "parameter": "_",
                                                                            "domain": "unit",
                                                                            "body": {
                                                                              "inject": {
                                                                                "typeName": "hydra.core.model.IntegerValue",
                                                                                "field": {"name": "int32", "term": {"literal": {"integer": {"int32": 0}}}}}}}}},
                                                                      {
                                                                        "name": "int64",
                                                                        "handler": {
                                                                          "lambda": {
                                                                            "parameter": "_",
                                                                            "domain": "unit",
                                                                            "body": {
                                                                              "inject": {
                                                                                "typeName": "hydra.core.model.IntegerValue",
                                                                                "field": {"name": "int64", "term": {"literal": {"integer": {"int64": "0"}}}}}}}}},
                                                                      {
                                                                        "name": "uint8",
                                                                        "handler": {
                                                                          "lambda": {
                                                                            "parameter": "_",
                                                                            "domain": "unit",
                                                                            "body": {
                                                                              "inject": {
                                                                                "typeName": "hydra.core.model.IntegerValue",
                                                                                "field": {"name": "uint8", "term": {"literal": {"integer": {"uint8": 0}}}}}}}}},
                                                                      {
                                                                        "name": "uint16",
                                                                        "handler": {
                                                                          "lambda": {
                                                                            "parameter": "_",
                                                                            "domain": "unit",
                                                                            "body": {
                                                                              "inject": {
                                                                                "typeName": "hydra.core.model.IntegerValue",
                                                                                "field": {"name": "uint16", "term": {"literal": {"integer": {"uint16": 0}}}}}}}}},
                                                                      {
                                                                        "name": "uint32",
                                                                        "handler": {
                                                                          "lambda": {
                                                                            "parameter": "_",
                                                                            "domain": "unit",
                                                                            "body": {
                                                                              "inject": {
                                                                                "typeName": "hydra.core.model.IntegerValue",
                                                                                "field": {"name": "uint32", "term": {"literal": {"integer": {"uint32": 0}}}}}}}}},
                                                                      {
                                                                        "name": "uint64",
                                                                        "handler": {
                                                                          "lambda": {
                                                                            "parameter": "_",
                                                                            "domain": "unit",
                                                                            "body": {
                                                                              "inject": {
                                                                                "typeName": "hydra.core.model.IntegerValue",
                                                                                "field": {"name": "uint64", "term": {"literal": {"integer": {"uint64": "0"}}}}}}}}}]}},
                                                                "argument": {"variable": "it"}}}}},
                                                        "typeScheme": {
                                                          "variables": [],
                                                          "body": {
                                                            "function": {"domain": {"variable": "hydra.core.model.IntegerType"}, "codomain": {"variable": "hydra.core.model.IntegerValue"}}},
                                                          "constraints": []}}],
                                                    "body": {
                                                      "let": {
                                                        "bindings": [
                                                          {
                                                            "name": "forLiteral",
                                                            "term": {
                                                              "lambda": {
                                                                "parameter": "lt",
                                                                "domain": {"variable": "hydra.core.model.LiteralType"},
                                                                "body": {
                                                                  "application": {
                                                                    "function": {
                                                                      "cases": {
                                                                        "typeName": "hydra.core.model.LiteralType",
                                                                        "cases": [
                                                                          {
                                                                            "name": "binary",
                                                                            "handler": {
                                                                              "lambda": {
                                                                                "parameter": "_",
                                                                                "domain": "unit",
                                                                                "body": {"inject": {"typeName": "hydra.core.model.Literal", "field": {"name": "string", "term": {"literal": {"string": ""}}}}}}}},
                                                                          {
                                                                            "name": "boolean",
                                                                            "handler": {
                                                                              "lambda": {
                                                                                "parameter": "_",
                                                                                "domain": "unit",
                                                                                "body": {
                                                                                  "inject": {"typeName": "hydra.core.model.Literal", "field": {"name": "boolean", "term": {"literal": {"boolean": false}}}}}}}},
                                                                          {
                                                                            "name": "decimal",
                                                                            "handler": {
                                                                              "lambda": {
                                                                                "parameter": "_",
                                                                                "domain": "unit",
                                                                                "body": {"inject": {"typeName": "hydra.core.model.Literal", "field": {"name": "decimal", "term": {"literal": {"decimal": 0}}}}}}}},
                                                                          {
                                                                            "name": "integer",
                                                                            "handler": {
                                                                              "lambda": {
                                                                                "parameter": "it",
                                                                                "domain": {"variable": "hydra.core.model.IntegerType"},
                                                                                "body": {
                                                                                  "inject": {
                                                                                    "typeName": "hydra.core.model.Literal",
                                                                                    "field": {"name": "integer", "term": {"application": {"function": {"variable": "forInteger"}, "argument": {"variable": "it"}}}}}}}}},
                                                                          {
                                                                            "name": "float",
                                                                            "handler": {
                                                                              "lambda": {
                                                                                "parameter": "ft",
                                                                                "domain": {"variable": "hydra.core.model.FloatType"},
                                                                                "body": {
                                                                                  "inject": {
                                                                                    "typeName": "hydra.core.model.Literal",
                                                                                    "field": {"name": "float", "term": {"application": {"function": {"variable": "forFloat"}, "argument": {"variable": "ft"}}}}}}}}},
                                                                          {
                                                                            "name": "string",
                                                                            "handler": {
                                                                              "lambda": {
                                                                                "parameter": "_",
                                                                                "domain": "unit",
                                                                                "body": {"inject": {"typeName": "hydra.core.model.Literal", "field": {"name": "string", "term": {"literal": {"string": ""}}}}}}}}]}},
                                                                    "argument": {"variable": "lt"}}}}},
                                                            "typeScheme": {
                                                              "variables": [],
                                                              "body": {
                                                                "function": {"domain": {"variable": "hydra.core.model.LiteralType"}, "codomain": {"variable": "hydra.core.model.Literal"}}},
                                                              "constraints": []}}],
                                                        "body": {
                                                          "application": {
                                                            "function": {
                                                              "cases": {
                                                                "typeName": "hydra.core.model.Type",
                                                                "cases": [
                                                                  {
                                                                    "name": "annotated",
                                                                    "handler": {
                                                                      "lambda": {
                                                                        "parameter": "at",
                                                                        "domain": {"variable": "hydra.core.model.AnnotatedType"},
                                                                        "body": {
                                                                          "application": {
                                                                            "function": {"application": {"function": {"variable": "inst"}, "argument": {"variable": "tname"}}},
                                                                            "argument": {
                                                                              "application": {
                                                                                "function": {"project": {"typeName": "hydra.core.model.AnnotatedType", "fieldName": "body"}},
                                                                                "argument": {"variable": "at"}}}}}}}},
                                                                  {
                                                                    "name": "application",
                                                                    "handler": {
                                                                      "lambda": {
                                                                        "parameter": "_",
                                                                        "domain": {"variable": "hydra.core.model.ApplicationType"},
                                                                        "body": {"typeApplication": {"body": {"variable": "noPoly"}, "type": {"variable": "hydra.core.model.Term"}}}}}},
                                                                  {
                                                                    "name": "function",
                                                                    "handler": {
                                                                      "lambda": {
                                                                        "parameter": "_",
                                                                        "domain": {"variable": "hydra.core.model.FunctionType"},
                                                                        "body": {"typeApplication": {"body": {"variable": "noPoly"}, "type": {"variable": "hydra.core.model.Term"}}}}}},
                                                                  {
                                                                    "name": "forall",
                                                                    "handler": {
                                                                      "lambda": {
                                                                        "parameter": "_",
                                                                        "domain": {"variable": "hydra.core.model.ForallType"},
                                                                        "body": {"typeApplication": {"body": {"variable": "noPoly"}, "type": {"variable": "hydra.core.model.Term"}}}}}},
                                                                  {
                                                                    "name": "list",
                                                                    "handler": {
                                                                      "lambda": {
                                                                        "parameter": "et",
                                                                        "domain": {"variable": "hydra.core.model.Type"},
                                                                        "body": {
                                                                          "application": {
                                                                            "function": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "application": {
                                                                                    "function": {
                                                                                      "typeApplication": {
                                                                                        "body": {"variable": "hydra.core.lib.logic.ifElse"},
                                                                                        "type": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.model.Term"}}}}},
                                                                                    "argument": {"variable": "minimal"}}},
                                                                                "argument": {
                                                                                  "typeApplication": {
                                                                                    "body": {
                                                                                      "typeApplication": {
                                                                                        "body": {
                                                                                          "either": {
                                                                                            "right": {
                                                                                              "inject": {
                                                                                                "typeName": "hydra.core.model.Term",
                                                                                                "field": {"name": "list", "term": {"typeApplication": {"body": {"list": []}, "type": {"variable": "hydra.core.model.Term"}}}}}}}},
                                                                                        "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                    "type": {"variable": "hydra.core.model.Term"}}}}},
                                                                            "argument": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "application": {
                                                                                    "function": {
                                                                                      "typeApplication": {
                                                                                        "body": {
                                                                                          "typeApplication": {
                                                                                            "body": {
                                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.eithers.bind"}, "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                            "type": {"variable": "hydra.core.model.Term"}}},
                                                                                        "type": {"variable": "hydra.core.model.Term"}}},
                                                                                    "argument": {
                                                                                      "application": {
                                                                                        "function": {"application": {"function": {"variable": "inst"}, "argument": {"variable": "tname"}}},
                                                                                        "argument": {"variable": "et"}}}}},
                                                                                "argument": {
                                                                                  "lambda": {
                                                                                    "parameter": "e",
                                                                                    "domain": {"variable": "hydra.core.model.Term"},
                                                                                    "body": {
                                                                                      "typeApplication": {
                                                                                        "body": {
                                                                                          "typeApplication": {
                                                                                            "body": {
                                                                                              "either": {
                                                                                                "right": {"inject": {"typeName": "hydra.core.model.Term", "field": {"name": "list", "term": {"list": [{"variable": "e"}]}}}}}},
                                                                                            "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                        "type": {"variable": "hydra.core.model.Term"}}}}}}}}}}}},
                                                                  {
                                                                    "name": "literal",
                                                                    "handler": {
                                                                      "lambda": {
                                                                        "parameter": "lt",
                                                                        "domain": {"variable": "hydra.core.model.LiteralType"},
                                                                        "body": {
                                                                          "typeApplication": {
                                                                            "body": {
                                                                              "typeApplication": {
                                                                                "body": {
                                                                                  "either": {
                                                                                    "right": {
                                                                                      "inject": {
                                                                                        "typeName": "hydra.core.model.Term",
                                                                                        "field": {"name": "literal", "term": {"application": {"function": {"variable": "forLiteral"}, "argument": {"variable": "lt"}}}}}}}},
                                                                                "type": {"variable": "hydra.core.errors.Error"}}},
                                                                            "type": {"variable": "hydra.core.model.Term"}}}}}},
                                                                  {
                                                                    "name": "map",
                                                                    "handler": {
                                                                      "lambda": {
                                                                        "parameter": "mt",
                                                                        "domain": {"variable": "hydra.core.model.MapType"},
                                                                        "body": {
                                                                          "let": {
                                                                            "bindings": [
                                                                              {
                                                                                "name": "kt",
                                                                                "term": {
                                                                                  "application": {"function": {"project": {"typeName": "hydra.core.model.MapType", "fieldName": "keys"}}, "argument": {"variable": "mt"}}},
                                                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
                                                                            "body": {
                                                                              "let": {
                                                                                "bindings": [
                                                                                  {
                                                                                    "name": "vt",
                                                                                    "term": {
                                                                                      "application": {
                                                                                        "function": {"project": {"typeName": "hydra.core.model.MapType", "fieldName": "values"}},
                                                                                        "argument": {"variable": "mt"}}},
                                                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
                                                                                "body": {
                                                                                  "application": {
                                                                                    "function": {
                                                                                      "application": {
                                                                                        "function": {
                                                                                          "application": {
                                                                                            "function": {
                                                                                              "typeApplication": {
                                                                                                "body": {"variable": "hydra.core.lib.logic.ifElse"},
                                                                                                "type": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.model.Term"}}}}},
                                                                                            "argument": {"variable": "minimal"}}},
                                                                                        "argument": {
                                                                                          "typeApplication": {
                                                                                            "body": {
                                                                                              "typeApplication": {
                                                                                                "body": {
                                                                                                  "either": {
                                                                                                    "right": {
                                                                                                      "inject": {
                                                                                                        "typeName": "hydra.core.model.Term",
                                                                                                        "field": {
                                                                                                          "name": "map",
                                                                                                          "term": {
                                                                                                            "typeApplication": {
                                                                                                              "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.empty"}, "type": {"variable": "hydra.core.model.Term"}}},
                                                                                                              "type": {"variable": "hydra.core.model.Term"}}}}}}}},
                                                                                                "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                            "type": {"variable": "hydra.core.model.Term"}}}}},
                                                                                    "argument": {
                                                                                      "application": {
                                                                                        "function": {
                                                                                          "application": {
                                                                                            "function": {
                                                                                              "typeApplication": {
                                                                                                "body": {
                                                                                                  "typeApplication": {
                                                                                                    "body": {
                                                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.eithers.bind"}, "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                                    "type": {"variable": "hydra.core.model.Term"}}},
                                                                                                "type": {"variable": "hydra.core.model.Term"}}},
                                                                                            "argument": {
                                                                                              "application": {
                                                                                                "function": {"application": {"function": {"variable": "inst"}, "argument": {"variable": "tname"}}},
                                                                                                "argument": {"variable": "kt"}}}}},
                                                                                        "argument": {
                                                                                          "lambda": {
                                                                                            "parameter": "ke",
                                                                                            "domain": {"variable": "hydra.core.model.Term"},
                                                                                            "body": {
                                                                                              "application": {
                                                                                                "function": {
                                                                                                  "application": {
                                                                                                    "function": {
                                                                                                      "typeApplication": {
                                                                                                        "body": {
                                                                                                          "typeApplication": {
                                                                                                            "body": {
                                                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.eithers.bind"}, "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                                            "type": {"variable": "hydra.core.model.Term"}}},
                                                                                                        "type": {"variable": "hydra.core.model.Term"}}},
                                                                                                    "argument": {
                                                                                                      "application": {
                                                                                                        "function": {"application": {"function": {"variable": "inst"}, "argument": {"variable": "tname"}}},
                                                                                                        "argument": {"variable": "vt"}}}}},
                                                                                                "argument": {
                                                                                                  "lambda": {
                                                                                                    "parameter": "ve",
                                                                                                    "domain": {"variable": "hydra.core.model.Term"},
                                                                                                    "body": {
                                                                                                      "typeApplication": {
                                                                                                        "body": {
                                                                                                          "typeApplication": {
                                                                                                            "body": {
                                                                                                              "either": {
                                                                                                                "right": {
                                                                                                                  "inject": {
                                                                                                                    "typeName": "hydra.core.model.Term",
                                                                                                                    "field": {
                                                                                                                      "name": "map",
                                                                                                                      "term": {
                                                                                                                        "application": {
                                                                                                                          "function": {
                                                                                                                            "application": {
                                                                                                                              "function": {
                                                                                                                                "typeApplication": {
                                                                                                                                  "body": {
                                                                                                                                    "typeApplication": {"body": {"variable": "hydra.core.lib.maps.singleton"}, "type": {"variable": "hydra.core.model.Term"}}},
                                                                                                                                  "type": {"variable": "hydra.core.model.Term"}}},
                                                                                                                              "argument": {"variable": "ke"}}},
                                                                                                                          "argument": {"variable": "ve"}}}}}}}},
                                                                                                            "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                                        "type": {"variable": "hydra.core.model.Term"}}}}}}}}}}}}}}}}}}}},
                                                                  {
                                                                    "name": "optional",
                                                                    "handler": {
                                                                      "lambda": {
                                                                        "parameter": "ot",
                                                                        "domain": {"variable": "hydra.core.model.Type"},
                                                                        "body": {
                                                                          "application": {
                                                                            "function": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "application": {
                                                                                    "function": {
                                                                                      "typeApplication": {
                                                                                        "body": {"variable": "hydra.core.lib.logic.ifElse"},
                                                                                        "type": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.model.Term"}}}}},
                                                                                    "argument": {"variable": "minimal"}}},
                                                                                "argument": {
                                                                                  "typeApplication": {
                                                                                    "body": {
                                                                                      "typeApplication": {
                                                                                        "body": {
                                                                                          "either": {
                                                                                            "right": {
                                                                                              "inject": {
                                                                                                "typeName": "hydra.core.model.Term",
                                                                                                "field": {
                                                                                                  "name": "optional",
                                                                                                  "term": {"typeApplication": {"body": {"optional": null}, "type": {"variable": "hydra.core.model.Term"}}}}}}}},
                                                                                        "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                    "type": {"variable": "hydra.core.model.Term"}}}}},
                                                                            "argument": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "application": {
                                                                                    "function": {
                                                                                      "typeApplication": {
                                                                                        "body": {
                                                                                          "typeApplication": {
                                                                                            "body": {
                                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.eithers.bind"}, "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                            "type": {"variable": "hydra.core.model.Term"}}},
                                                                                        "type": {"variable": "hydra.core.model.Term"}}},
                                                                                    "argument": {
                                                                                      "application": {
                                                                                        "function": {"application": {"function": {"variable": "inst"}, "argument": {"variable": "tname"}}},
                                                                                        "argument": {"variable": "ot"}}}}},
                                                                                "argument": {
                                                                                  "lambda": {
                                                                                    "parameter": "e",
                                                                                    "domain": {"variable": "hydra.core.model.Term"},
                                                                                    "body": {
                                                                                      "typeApplication": {
                                                                                        "body": {
                                                                                          "typeApplication": {
                                                                                            "body": {
                                                                                              "either": {
                                                                                                "right": {
                                                                                                  "inject": {"typeName": "hydra.core.model.Term", "field": {"name": "optional", "term": {"optional": {"variable": "e"}}}}}}},
                                                                                            "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                        "type": {"variable": "hydra.core.model.Term"}}}}}}}}}}}},
                                                                  {
                                                                    "name": "record",
                                                                    "handler": {
                                                                      "lambda": {
                                                                        "parameter": "rt",
                                                                        "domain": {"list": {"variable": "hydra.core.model.FieldType"}},
                                                                        "body": {
                                                                          "let": {
                                                                            "bindings": [
                                                                              {
                                                                                "name": "toField",
                                                                                "term": {
                                                                                  "lambda": {
                                                                                    "parameter": "ft",
                                                                                    "domain": {"variable": "hydra.core.model.FieldType"},
                                                                                    "body": {
                                                                                      "application": {
                                                                                        "function": {
                                                                                          "application": {
                                                                                            "function": {
                                                                                              "typeApplication": {
                                                                                                "body": {
                                                                                                  "typeApplication": {
                                                                                                    "body": {
                                                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.eithers.bind"}, "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                                    "type": {"variable": "hydra.core.model.Term"}}},
                                                                                                "type": {"variable": "hydra.core.model.Field"}}},
                                                                                            "argument": {
                                                                                              "application": {
                                                                                                "function": {"application": {"function": {"variable": "inst"}, "argument": {"variable": "tname"}}},
                                                                                                "argument": {
                                                                                                  "application": {
                                                                                                    "function": {"project": {"typeName": "hydra.core.model.FieldType", "fieldName": "type"}},
                                                                                                    "argument": {"variable": "ft"}}}}}}},
                                                                                        "argument": {
                                                                                          "lambda": {
                                                                                            "parameter": "e",
                                                                                            "domain": {"variable": "hydra.core.model.Term"},
                                                                                            "body": {
                                                                                              "typeApplication": {
                                                                                                "body": {
                                                                                                  "typeApplication": {
                                                                                                    "body": {
                                                                                                      "either": {
                                                                                                        "right": {
                                                                                                          "record": {
                                                                                                            "typeName": "hydra.core.model.Field",
                                                                                                            "fields": [
                                                                                                              {
                                                                                                                "name": "name",
                                                                                                                "term": {
                                                                                                                  "application": {
                                                                                                                    "function": {"project": {"typeName": "hydra.core.model.FieldType", "fieldName": "name"}},
                                                                                                                    "argument": {"variable": "ft"}}}},
                                                                                                              {"name": "term", "term": {"variable": "e"}}]}}}},
                                                                                                    "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                                "type": {"variable": "hydra.core.model.Field"}}}}}}}}},
                                                                                "typeScheme": {
                                                                                  "variables": [],
                                                                                  "body": {
                                                                                    "function": {
                                                                                      "domain": {"variable": "hydra.core.model.FieldType"},
                                                                                      "codomain": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.model.Field"}}}}},
                                                                                  "constraints": []}}],
                                                                            "body": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "application": {
                                                                                    "function": {
                                                                                      "typeApplication": {
                                                                                        "body": {
                                                                                          "typeApplication": {
                                                                                            "body": {
                                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.eithers.bind"}, "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                            "type": {"list": {"variable": "hydra.core.model.Field"}}}},
                                                                                        "type": {"variable": "hydra.core.model.Term"}}},
                                                                                    "argument": {
                                                                                      "application": {
                                                                                        "function": {
                                                                                          "application": {
                                                                                            "function": {
                                                                                              "typeApplication": {
                                                                                                "body": {
                                                                                                  "typeApplication": {
                                                                                                    "body": {
                                                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.eithers.mapList"}, "type": {"variable": "hydra.core.model.FieldType"}}},
                                                                                                    "type": {"variable": "hydra.core.model.Field"}}},
                                                                                                "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                            "argument": {"variable": "toField"}}},
                                                                                        "argument": {"variable": "rt"}}}}},
                                                                                "argument": {
                                                                                  "lambda": {
                                                                                    "parameter": "dfields",
                                                                                    "domain": {"list": {"variable": "hydra.core.model.Field"}},
                                                                                    "body": {
                                                                                      "typeApplication": {
                                                                                        "body": {
                                                                                          "typeApplication": {
                                                                                            "body": {
                                                                                              "either": {
                                                                                                "right": {
                                                                                                  "inject": {
                                                                                                    "typeName": "hydra.core.model.Term",
                                                                                                    "field": {
                                                                                                      "name": "record",
                                                                                                      "term": {
                                                                                                        "record": {
                                                                                                          "typeName": "hydra.core.model.Record",
                                                                                                          "fields": [{"name": "typeName", "term": {"variable": "tname"}}, {"name": "fields", "term": {"variable": "dfields"}}]}}}}}}},
                                                                                            "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                        "type": {"variable": "hydra.core.model.Term"}}}}}}}}}}}},
                                                                  {
                                                                    "name": "set",
                                                                    "handler": {
                                                                      "lambda": {
                                                                        "parameter": "et",
                                                                        "domain": {"variable": "hydra.core.model.Type"},
                                                                        "body": {
                                                                          "application": {
                                                                            "function": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "application": {
                                                                                    "function": {
                                                                                      "typeApplication": {
                                                                                        "body": {"variable": "hydra.core.lib.logic.ifElse"},
                                                                                        "type": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.model.Term"}}}}},
                                                                                    "argument": {"variable": "minimal"}}},
                                                                                "argument": {
                                                                                  "typeApplication": {
                                                                                    "body": {
                                                                                      "typeApplication": {
                                                                                        "body": {
                                                                                          "either": {
                                                                                            "right": {
                                                                                              "inject": {
                                                                                                "typeName": "hydra.core.model.Term",
                                                                                                "field": {
                                                                                                  "name": "set",
                                                                                                  "term": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.empty"}, "type": {"variable": "hydra.core.model.Term"}}}}}}}},
                                                                                        "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                    "type": {"variable": "hydra.core.model.Term"}}}}},
                                                                            "argument": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "application": {
                                                                                    "function": {
                                                                                      "typeApplication": {
                                                                                        "body": {
                                                                                          "typeApplication": {
                                                                                            "body": {
                                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.eithers.bind"}, "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                            "type": {"variable": "hydra.core.model.Term"}}},
                                                                                        "type": {"variable": "hydra.core.model.Term"}}},
                                                                                    "argument": {
                                                                                      "application": {
                                                                                        "function": {"application": {"function": {"variable": "inst"}, "argument": {"variable": "tname"}}},
                                                                                        "argument": {"variable": "et"}}}}},
                                                                                "argument": {
                                                                                  "lambda": {
                                                                                    "parameter": "e",
                                                                                    "domain": {"variable": "hydra.core.model.Term"},
                                                                                    "body": {
                                                                                      "typeApplication": {
                                                                                        "body": {
                                                                                          "typeApplication": {
                                                                                            "body": {
                                                                                              "either": {
                                                                                                "right": {
                                                                                                  "inject": {
                                                                                                    "typeName": "hydra.core.model.Term",
                                                                                                    "field": {
                                                                                                      "name": "set",
                                                                                                      "term": {
                                                                                                        "application": {
                                                                                                          "function": {
                                                                                                            "typeApplication": {"body": {"variable": "hydra.core.lib.sets.fromList"}, "type": {"variable": "hydra.core.model.Term"}}},
                                                                                                          "argument": {"list": [{"variable": "e"}]}}}}}}}},
                                                                                            "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                        "type": {"variable": "hydra.core.model.Term"}}}}}}}}}}}},
                                                                  {
                                                                    "name": "variable",
                                                                    "handler": {
                                                                      "lambda": {
                                                                        "parameter": "vname",
                                                                        "domain": {"variable": "hydra.core.model.Name"},
                                                                        "body": {
                                                                          "application": {
                                                                            "function": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "application": {
                                                                                    "function": {
                                                                                      "typeApplication": {
                                                                                        "body": {
                                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.optionals.match"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                                        "type": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.model.Term"}}}}},
                                                                                    "argument": {
                                                                                      "application": {
                                                                                        "function": {
                                                                                          "application": {
                                                                                            "function": {
                                                                                              "typeApplication": {
                                                                                                "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.lookup"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                "type": {"variable": "hydra.core.model.Type"}}},
                                                                                            "argument": {"variable": "vname"}}},
                                                                                        "argument": {"variable": "schema"}}}}},
                                                                                "argument": {
                                                                                  "typeApplication": {
                                                                                    "body": {
                                                                                      "typeApplication": {
                                                                                        "body": {
                                                                                          "either": {
                                                                                            "left": {
                                                                                              "inject": {
                                                                                                "typeName": "hydra.core.errors.Error",
                                                                                                "field": {
                                                                                                  "name": "resolution",
                                                                                                  "term": {
                                                                                                    "inject": {
                                                                                                      "typeName": "hydra.core.errors.ResolutionError",
                                                                                                      "field": {
                                                                                                        "name": "unexpectedShape",
                                                                                                        "term": {
                                                                                                          "record": {
                                                                                                            "typeName": "hydra.core.errors.UnexpectedShapeError",
                                                                                                            "fields": [
                                                                                                              {"name": "expected", "term": {"literal": {"string": "bound type variable"}}},
                                                                                                              {
                                                                                                                "name": "actual",
                                                                                                                "term": {
                                                                                                                  "application": {
                                                                                                                    "function": {
                                                                                                                      "application": {"function": {"variable": "hydra.core.lib.strings.concat2"}, "argument": {"literal": {"string": "unbound variable "}}}},
                                                                                                                    "argument": {"application": {"function": {"unwrap": "hydra.core.model.Name"}, "argument": {"variable": "vname"}}}}}}]}}}}}}}}}},
                                                                                        "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                    "type": {"variable": "hydra.core.model.Term"}}}}},
                                                                            "argument": {"application": {"function": {"variable": "inst"}, "argument": {"variable": "vname"}}}}}}}},
                                                                  {
                                                                    "name": "wrap",
                                                                    "handler": {
                                                                      "lambda": {
                                                                        "parameter": "wt",
                                                                        "domain": {"variable": "hydra.core.model.Type"},
                                                                        "body": {
                                                                          "application": {
                                                                            "function": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "typeApplication": {
                                                                                    "body": {
                                                                                      "typeApplication": {
                                                                                        "body": {
                                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.eithers.bind"}, "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                        "type": {"variable": "hydra.core.model.Term"}}},
                                                                                    "type": {"variable": "hydra.core.model.Term"}}},
                                                                                "argument": {
                                                                                  "application": {
                                                                                    "function": {"application": {"function": {"variable": "inst"}, "argument": {"variable": "tname"}}},
                                                                                    "argument": {"variable": "wt"}}}}},
                                                                            "argument": {
                                                                              "lambda": {
                                                                                "parameter": "e",
                                                                                "domain": {"variable": "hydra.core.model.Term"},
                                                                                "body": {
                                                                                  "typeApplication": {
                                                                                    "body": {
                                                                                      "typeApplication": {
                                                                                        "body": {
                                                                                          "either": {
                                                                                            "right": {
                                                                                              "inject": {
                                                                                                "typeName": "hydra.core.model.Term",
                                                                                                "field": {
                                                                                                  "name": "wrap",
                                                                                                  "term": {
                                                                                                    "record": {
                                                                                                      "typeName": "hydra.core.model.WrappedTerm",
                                                                                                      "fields": [{"name": "typeName", "term": {"variable": "tname"}}, {"name": "body", "term": {"variable": "e"}}]}}}}}}},
                                                                                        "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                    "type": {"variable": "hydra.core.model.Term"}}}}}}}}}}]}},
                                                            "argument": {"variable": "t"}}}}}}}}}}}}}}}}}}}}}}},
                "annotation": {
                  "map": [
                    {
                      "key": {"variable": "description"},
                      "value": {
                        "literal": {
                          "string": "Given a graph schema and a nonrecursive type, instantiate it with default values. If the minimal flag is set, the smallest possible term is produced; otherwise, exactly one subterm is produced for constructors which do not otherwise require one, e.g. in lists and optionals. The name parameter provides the element name for nominal type construction."}}}]}}}}}}}]}