packages feed

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

{
  "name": "hydra.core.adapt",
  "metadata": {"description": "Simple, one-way adapters for types and terms", "comments": [], "seeAlso": [], "provisions": []},
  "dependencies": [
    {"module": "hydra.core.annotations"},
    {"module": "hydra.core.coders"},
    {"module": "hydra.core.dependencies"},
    {"module": "hydra.core.environment"},
    {"module": "hydra.core.errors"},
    {"module": "hydra.core.graph"},
    {"module": "hydra.core.hoisting"},
    {"module": "hydra.core.inference"},
    {"module": "hydra.core.lexical"},
    {"module": "hydra.core.lib.eithers"},
    {"module": "hydra.core.lib.equality"},
    {"module": "hydra.core.lib.functions"},
    {"module": "hydra.core.lib.lists"},
    {"module": "hydra.core.lib.literals"},
    {"module": "hydra.core.lib.logic"},
    {"module": "hydra.core.lib.maps"},
    {"module": "hydra.core.lib.optionals"},
    {"module": "hydra.core.lib.pairs"},
    {"module": "hydra.core.lib.sets"},
    {"module": "hydra.core.lib.strings"},
    {"module": "hydra.core.literals"},
    {"module": "hydra.core.model"},
    {"module": "hydra.core.names"},
    {"module": "hydra.core.packaging"},
    {"module": "hydra.core.print.model"},
    {"module": "hydra.core.reduction"},
    {"module": "hydra.core.reflect"},
    {"module": "hydra.core.resolution"},
    {"module": "hydra.core.rewriting"},
    {"module": "hydra.core.scoping"},
    {"module": "hydra.core.strip"},
    {"module": "hydra.core.typing"},
    {"module": "hydra.core.variables"}],
  "definitions": [
    {
      "term": {
        "name": "hydra.core.adapt.adaptDataGraph",
        "signature": {
          "typeParameters": [{"name": "t0", "constraints": []}],
          "parameters": [
            {"name": "arg0", "type": {"variable": "hydra.core.coders.LanguageConstraints"}, "isLazy": false},
            {"name": "arg1", "type": {"literal": "boolean"}, "isLazy": false},
            {"name": "arg2", "type": {"list": {"variable": "hydra.core.model.Binding"}}, "isLazy": false},
            {"name": "arg3", "type": {"variable": "t0"}, "isLazy": false},
            {"name": "arg4", "type": {"variable": "hydra.core.graph.Graph"}, "isLazy": false}],
          "result": {
            "type": {
              "either": {
                "left": {"variable": "hydra.core.errors.Error"},
                "right": {
                  "pair": {"first": {"variable": "hydra.core.graph.Graph"}, "second": {"list": {"variable": "hydra.core.model.Binding"}}}}}}}},
        "body": {
          "typeLambda": {
            "parameter": "t0",
            "body": {
              "annotated": {
                "body": {
                  "lambda": {
                    "parameter": "constraints",
                    "domain": {"variable": "hydra.core.coders.LanguageConstraints"},
                    "body": {
                      "lambda": {
                        "parameter": "doExpand",
                        "domain": {"literal": "boolean"},
                        "body": {
                          "lambda": {
                            "parameter": "els0",
                            "domain": {"list": {"variable": "hydra.core.model.Binding"}},
                            "body": {
                              "lambda": {
                                "parameter": "cx",
                                "domain": {"variable": "t0"},
                                "body": {
                                  "lambda": {
                                    "parameter": "graph0",
                                    "domain": {"variable": "hydra.core.graph.Graph"},
                                    "body": {
                                      "let": {
                                        "bindings": [
                                          {
                                            "name": "transformTerm",
                                            "term": {
                                              "lambda": {
                                                "parameter": "g",
                                                "domain": {"variable": "hydra.core.graph.Graph"},
                                                "body": {
                                                  "lambda": {
                                                    "parameter": "term",
                                                    "domain": {"variable": "hydra.core.model.Term"},
                                                    "body": {
                                                      "let": {
                                                        "bindings": [
                                                          {
                                                            "name": "tx",
                                                            "term": {"variable": "g"},
                                                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.graph.Graph"}, "constraints": []}}],
                                                        "body": {
                                                          "let": {
                                                            "bindings": [
                                                              {
                                                                "name": "t1",
                                                                "term": {
                                                                  "application": {
                                                                    "function": {"variable": "hydra.core.variables.unshadowVariables"},
                                                                    "argument": {"application": {"function": {"variable": "hydra.core.adapt.pushTypeAppsInward"}, "argument": {"variable": "term"}}}}},
                                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                                            "body": {
                                                              "let": {
                                                                "bindings": [
                                                                  {
                                                                    "name": "t2",
                                                                    "term": {
                                                                      "application": {
                                                                        "function": {"variable": "hydra.core.variables.unshadowVariables"},
                                                                        "argument": {
                                                                          "application": {
                                                                            "function": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "application": {
                                                                                    "function": {
                                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.logic.ifElse"}, "type": {"variable": "hydra.core.model.Term"}}},
                                                                                    "argument": {"variable": "doExpand"}}},
                                                                                "argument": {
                                                                                  "application": {
                                                                                    "function": {"variable": "hydra.core.adapt.pushTypeAppsInward"},
                                                                                    "argument": {
                                                                                      "application": {
                                                                                        "function": {"application": {"function": {"variable": "hydra.core.reduction.etaExpandTerm"}, "argument": {"variable": "tx"}}},
                                                                                        "argument": {"variable": "t1"}}}}}}},
                                                                            "argument": {"variable": "t1"}}}}},
                                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                                                "body": {
                                                                  "application": {"function": {"variable": "hydra.core.dependencies.liftLambdaAboveLet"}, "argument": {"variable": "t2"}}}}}}}}}}}}},
                                            "typeScheme": {
                                              "variables": [],
                                              "body": {
                                                "function": {
                                                  "domain": {"variable": "hydra.core.graph.Graph"},
                                                  "codomain": {"function": {"domain": {"variable": "hydra.core.model.Term"}, "codomain": {"variable": "hydra.core.model.Term"}}}}},
                                              "constraints": []}}],
                                        "body": {
                                          "let": {
                                            "bindings": [
                                              {
                                                "name": "transformBinding",
                                                "term": {
                                                  "lambda": {
                                                    "parameter": "g",
                                                    "domain": {"variable": "hydra.core.graph.Graph"},
                                                    "body": {
                                                      "lambda": {
                                                        "parameter": "el",
                                                        "domain": {"variable": "hydra.core.model.Binding"},
                                                        "body": {
                                                          "record": {
                                                            "typeName": "hydra.core.model.Binding",
                                                            "fields": [
                                                              {
                                                                "name": "name",
                                                                "term": {
                                                                  "application": {"function": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "name"}}, "argument": {"variable": "el"}}}},
                                                              {
                                                                "name": "term",
                                                                "term": {
                                                                  "application": {
                                                                    "function": {"application": {"function": {"variable": "transformTerm"}, "argument": {"variable": "g"}}},
                                                                    "argument": {
                                                                      "application": {"function": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "term"}}, "argument": {"variable": "el"}}}}}},
                                                              {
                                                                "name": "typeScheme",
                                                                "term": {
                                                                  "application": {
                                                                    "function": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "typeScheme"}},
                                                                    "argument": {"variable": "el"}}}}]}}}}}},
                                                "typeScheme": {
                                                  "variables": [],
                                                  "body": {
                                                    "function": {
                                                      "domain": {"variable": "hydra.core.graph.Graph"},
                                                      "codomain": {"function": {"domain": {"variable": "hydra.core.model.Binding"}, "codomain": {"variable": "hydra.core.model.Binding"}}}}},
                                                  "constraints": []}}],
                                            "body": {
                                              "let": {
                                                "bindings": [
                                                  {
                                                    "name": "litmap",
                                                    "term": {
                                                      "application": {"function": {"variable": "hydra.core.adapt.adaptLiteralTypesMap"}, "argument": {"variable": "constraints"}}},
                                                    "typeScheme": {
                                                      "variables": [],
                                                      "body": {"map": {"keys": {"variable": "hydra.core.model.LiteralType"}, "values": {"variable": "hydra.core.model.LiteralType"}}},
                                                      "constraints": []}}],
                                                "body": {
                                                  "let": {
                                                    "bindings": [
                                                      {
                                                        "name": "prims0",
                                                        "term": {
                                                          "application": {
                                                            "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "primitives"}},
                                                            "argument": {"variable": "graph0"}}},
                                                        "typeScheme": {
                                                          "variables": [],
                                                          "body": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.graph.Primitive"}}},
                                                          "constraints": []}}],
                                                    "body": {
                                                      "let": {
                                                        "bindings": [
                                                          {
                                                            "name": "schemaTypes0",
                                                            "term": {
                                                              "application": {
                                                                "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "schemaTypes"}},
                                                                "argument": {"variable": "graph0"}}},
                                                            "typeScheme": {
                                                              "variables": [],
                                                              "body": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeScheme"}}},
                                                              "constraints": []}}],
                                                        "body": {
                                                          "let": {
                                                            "bindings": [
                                                              {
                                                                "name": "schemaBindings",
                                                                "term": {
                                                                  "application": {
                                                                    "function": {"variable": "hydra.core.environment.typesToDefinitions"},
                                                                    "argument": {
                                                                      "application": {
                                                                        "function": {
                                                                          "application": {
                                                                            "function": {
                                                                              "typeApplication": {
                                                                                "body": {
                                                                                  "typeApplication": {
                                                                                    "body": {
                                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.maps.map"}, "type": {"variable": "hydra.core.model.TypeScheme"}}},
                                                                                    "type": {"variable": "hydra.core.model.Type"}}},
                                                                                "type": {"variable": "hydra.core.model.Name"}}},
                                                                            "argument": {
                                                                              "lambda": {
                                                                                "parameter": "ts",
                                                                                "domain": {"variable": "hydra.core.model.TypeScheme"},
                                                                                "body": {"application": {"function": {"variable": "hydra.core.scoping.typeSchemeToFType"}, "argument": {"variable": "ts"}}}}}}},
                                                                        "argument": {"variable": "schemaTypes0"}}}}},
                                                                "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Binding"}}, "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": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeScheme"}}}}},
                                                                        "type": {
                                                                          "pair": {"first": {"variable": "hydra.core.graph.Graph"}, "second": {"list": {"variable": "hydra.core.model.Binding"}}}}}},
                                                                    "argument": {
                                                                      "application": {
                                                                        "function": {
                                                                          "application": {
                                                                            "function": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "typeApplication": {
                                                                                    "body": {"variable": "hydra.core.lib.logic.ifElse"},
                                                                                    "type": {
                                                                                      "either": {
                                                                                        "left": {"variable": "hydra.core.errors.Error"},
                                                                                        "right": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeScheme"}}}}}}},
                                                                                "argument": {
                                                                                  "application": {
                                                                                    "function": {
                                                                                      "typeApplication": {
                                                                                        "body": {
                                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.maps.isEmpty"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                        "type": {"variable": "hydra.core.model.TypeScheme"}}},
                                                                                    "argument": {"variable": "schemaTypes0"}}}}},
                                                                            "argument": {
                                                                              "typeApplication": {
                                                                                "body": {
                                                                                  "typeApplication": {
                                                                                    "body": {
                                                                                      "either": {
                                                                                        "right": {
                                                                                          "typeApplication": {
                                                                                            "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.empty"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                            "type": {"variable": "hydra.core.model.TypeScheme"}}}}},
                                                                                    "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                "type": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeScheme"}}}}}}},
                                                                        "argument": {
                                                                          "application": {
                                                                            "function": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "typeApplication": {
                                                                                    "body": {
                                                                                      "typeApplication": {
                                                                                        "body": {
                                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.eithers.bind"}, "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                        "type": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.Type"}}}}},
                                                                                    "type": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeScheme"}}}}},
                                                                                "argument": {
                                                                                  "application": {
                                                                                    "function": {
                                                                                      "application": {
                                                                                        "function": {
                                                                                          "application": {
                                                                                            "function": {
                                                                                              "typeApplication": {
                                                                                                "body": {
                                                                                                  "typeApplication": {
                                                                                                    "body": {
                                                                                                      "typeApplication": {
                                                                                                        "body": {
                                                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.eithers.bimap"}, "type": {"variable": "hydra.core.errors.DecodingError"}}},
                                                                                                        "type": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.Type"}}}}},
                                                                                                    "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                                "type": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.Type"}}}}},
                                                                                            "argument": {
                                                                                              "lambda": {
                                                                                                "parameter": "e",
                                                                                                "domain": {"variable": "hydra.core.errors.DecodingError"},
                                                                                                "body": {"inject": {"typeName": "hydra.core.errors.Error", "field": {"name": "decoding", "term": {"variable": "e"}}}}}}}},
                                                                                        "argument": {
                                                                                          "lambda": {
                                                                                            "parameter": "x",
                                                                                            "domain": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.Type"}}},
                                                                                            "body": {"variable": "x"}}}}},
                                                                                    "argument": {
                                                                                      "application": {
                                                                                        "function": {"application": {"function": {"variable": "hydra.core.environment.graphAsTypes"}, "argument": {"variable": "graph0"}}},
                                                                                        "argument": {"variable": "schemaBindings"}}}}}}},
                                                                            "argument": {
                                                                              "lambda": {
                                                                                "parameter": "tmap0",
                                                                                "domain": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"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": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.Type"}}}}},
                                                                                            "type": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeScheme"}}}}},
                                                                                        "argument": {
                                                                                          "application": {
                                                                                            "function": {
                                                                                              "application": {
                                                                                                "function": {
                                                                                                  "application": {
                                                                                                    "function": {
                                                                                                      "typeApplication": {"body": {"variable": "hydra.core.adapt.adaptGraphSchema"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                    "argument": {"variable": "constraints"}}},
                                                                                                "argument": {"variable": "litmap"}}},
                                                                                            "argument": {"variable": "tmap0"}}}}},
                                                                                    "argument": {
                                                                                      "lambda": {
                                                                                        "parameter": "tmap1",
                                                                                        "domain": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.Type"}}},
                                                                                        "body": {
                                                                                          "typeApplication": {
                                                                                            "body": {
                                                                                              "typeApplication": {
                                                                                                "body": {
                                                                                                  "either": {
                                                                                                    "right": {
                                                                                                      "application": {
                                                                                                        "function": {
                                                                                                          "application": {
                                                                                                            "function": {
                                                                                                              "typeApplication": {
                                                                                                                "body": {
                                                                                                                  "typeApplication": {
                                                                                                                    "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.map"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                                                                    "type": {"variable": "hydra.core.model.TypeScheme"}}},
                                                                                                                "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                            "argument": {
                                                                                                              "lambda": {
                                                                                                                "parameter": "t",
                                                                                                                "domain": {"variable": "hydra.core.model.Type"},
                                                                                                                "body": {"application": {"function": {"variable": "hydra.core.resolution.typeToTypeScheme"}, "argument": {"variable": "t"}}}}}}},
                                                                                                        "argument": {"variable": "tmap1"}}}}},
                                                                                                "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                            "type": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeScheme"}}}}}}}}}}}}}}}}},
                                                                "argument": {
                                                                  "lambda": {
                                                                    "parameter": "schemaResult",
                                                                    "domain": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeScheme"}}},
                                                                    "body": {
                                                                      "let": {
                                                                        "bindings": [
                                                                          {
                                                                            "name": "adaptedSchemaTypes",
                                                                            "term": {"variable": "schemaResult"},
                                                                            "typeScheme": {
                                                                              "variables": [],
                                                                              "body": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeScheme"}}},
                                                                              "constraints": []}}],
                                                                        "body": {
                                                                          "let": {
                                                                            "bindings": [
                                                                              {
                                                                                "name": "adaptBinding",
                                                                                "term": {
                                                                                  "lambda": {
                                                                                    "parameter": "el",
                                                                                    "domain": {"variable": "hydra.core.model.Binding"},
                                                                                    "body": {
                                                                                      "let": {
                                                                                        "bindings": [
                                                                                          {
                                                                                            "name": "transformed",
                                                                                            "term": {
                                                                                              "application": {
                                                                                                "function": {"application": {"function": {"variable": "transformBinding"}, "argument": {"variable": "graph0"}}},
                                                                                                "argument": {"variable": "el"}}},
                                                                                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Binding"}, "constraints": []}}],
                                                                                        "body": {
                                                                                          "let": {
                                                                                            "bindings": [
                                                                                              {
                                                                                                "name": "wrapped",
                                                                                                "term": {
                                                                                                  "inject": {
                                                                                                    "typeName": "hydra.core.model.Term",
                                                                                                    "field": {
                                                                                                      "name": "let",
                                                                                                      "term": {
                                                                                                        "record": {
                                                                                                          "typeName": "hydra.core.model.Let",
                                                                                                          "fields": [
                                                                                                            {
                                                                                                              "name": "bindings",
                                                                                                              "term": {
                                                                                                                "application": {
                                                                                                                  "function": {
                                                                                                                    "typeApplication": {"body": {"variable": "hydra.core.lib.lists.singleton"}, "type": {"variable": "hydra.core.model.Binding"}}},
                                                                                                                  "argument": {"variable": "transformed"}}}},
                                                                                                            {"name": "body", "term": {"inject": {"typeName": "hydra.core.model.Term", "field": {"name": "unit", "term": "unit"}}}}]}}}}},
                                                                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "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": {"variable": "hydra.core.model.Term"}}},
                                                                                                        "type": {"variable": "hydra.core.model.Term"}}},
                                                                                                    "argument": {
                                                                                                      "application": {
                                                                                                        "function": {
                                                                                                          "application": {
                                                                                                            "function": {
                                                                                                              "application": {
                                                                                                                "function": {
                                                                                                                  "application": {
                                                                                                                    "function": {
                                                                                                                      "application": {
                                                                                                                        "function": {"typeApplication": {"body": {"variable": "hydra.core.adapt.adaptTerm"}, "type": {"variable": "t0"}}},
                                                                                                                        "argument": {"variable": "constraints"}}},
                                                                                                                    "argument": {"variable": "litmap"}}},
                                                                                                                "argument": {"variable": "cx"}}},
                                                                                                            "argument": {"variable": "graph0"}}},
                                                                                                        "argument": {"variable": "wrapped"}}}}},
                                                                                                "argument": {
                                                                                                  "lambda": {
                                                                                                    "parameter": "adapted",
                                                                                                    "domain": {"variable": "hydra.core.model.Term"},
                                                                                                    "body": {
                                                                                                      "application": {
                                                                                                        "function": {
                                                                                                          "application": {
                                                                                                            "function": {
                                                                                                              "typeApplication": {"body": {"variable": "hydra.core.rewriting.rewriteTermM"}, "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                                            "argument": {
                                                                                                              "application": {
                                                                                                                "function": {
                                                                                                                  "application": {
                                                                                                                    "function": {
                                                                                                                      "typeApplication": {"body": {"variable": "hydra.core.adapt.adaptLambdaDomains"}, "type": {"variable": "hydra.core.model.Term"}}},
                                                                                                                    "argument": {"variable": "constraints"}}},
                                                                                                                "argument": {"variable": "litmap"}}}}},
                                                                                                        "argument": {"variable": "adapted"}}}}}}}}}}}}},
                                                                                "typeScheme": {
                                                                                  "variables": [],
                                                                                  "body": {
                                                                                    "function": {
                                                                                      "domain": {"variable": "hydra.core.model.Binding"},
                                                                                      "codomain": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.model.Term"}}}}},
                                                                                  "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.Term"}}}},
                                                                                        "type": {
                                                                                          "pair": {"first": {"variable": "hydra.core.graph.Graph"}, "second": {"list": {"variable": "hydra.core.model.Binding"}}}}}},
                                                                                    "argument": {
                                                                                      "application": {
                                                                                        "function": {
                                                                                          "application": {
                                                                                            "function": {
                                                                                              "typeApplication": {
                                                                                                "body": {
                                                                                                  "typeApplication": {
                                                                                                    "body": {
                                                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.eithers.mapList"}, "type": {"variable": "hydra.core.model.Binding"}}},
                                                                                                    "type": {"variable": "hydra.core.model.Term"}}},
                                                                                                "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                            "argument": {"variable": "adaptBinding"}}},
                                                                                        "argument": {"variable": "els0"}}}}},
                                                                                "argument": {
                                                                                  "lambda": {
                                                                                    "parameter": "adaptedTerms",
                                                                                    "domain": {"list": {"variable": "hydra.core.model.Term"}},
                                                                                    "body": {
                                                                                      "let": {
                                                                                        "bindings": [
                                                                                          {
                                                                                            "name": "els1Raw",
                                                                                            "term": {
                                                                                              "application": {
                                                                                                "function": {
                                                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.lists.concat"}, "type": {"variable": "hydra.core.model.Binding"}}},
                                                                                                "argument": {
                                                                                                  "application": {
                                                                                                    "function": {
                                                                                                      "application": {
                                                                                                        "function": {
                                                                                                          "typeApplication": {
                                                                                                            "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.model.Term"}}},
                                                                                                            "type": {"list": {"variable": "hydra.core.model.Binding"}}}},
                                                                                                        "argument": {"variable": "hydra.core.environment.termAsBindings"}}},
                                                                                                    "argument": {"variable": "adaptedTerms"}}}}},
                                                                                            "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Binding"}}, "constraints": []}}],
                                                                                        "body": {
                                                                                          "let": {
                                                                                            "bindings": [
                                                                                              {
                                                                                                "name": "processBinding",
                                                                                                "term": {
                                                                                                  "lambda": {
                                                                                                    "parameter": "el",
                                                                                                    "domain": {"variable": "hydra.core.model.Binding"},
                                                                                                    "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.Binding"}}},
                                                                                                            "argument": {
                                                                                                              "application": {
                                                                                                                "function": {
                                                                                                                  "application": {
                                                                                                                    "function": {
                                                                                                                      "typeApplication": {"body": {"variable": "hydra.core.rewriting.rewriteTermM"}, "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                                                    "argument": {
                                                                                                                      "application": {
                                                                                                                        "function": {
                                                                                                                          "application": {
                                                                                                                            "function": {
                                                                                                                              "typeApplication": {"body": {"variable": "hydra.core.adapt.adaptNestedTypes"}, "type": {"variable": "hydra.core.model.Term"}}},
                                                                                                                            "argument": {"variable": "constraints"}}},
                                                                                                                        "argument": {"variable": "litmap"}}}}},
                                                                                                                "argument": {
                                                                                                                  "application": {"function": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "term"}}, "argument": {"variable": "el"}}}}}}},
                                                                                                        "argument": {
                                                                                                          "lambda": {
                                                                                                            "parameter": "newTerm",
                                                                                                            "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": {"optional": {"variable": "hydra.core.model.TypeScheme"}}}},
                                                                                                                        "type": {"variable": "hydra.core.model.Binding"}}},
                                                                                                                    "argument": {
                                                                                                                      "application": {
                                                                                                                        "function": {
                                                                                                                          "application": {
                                                                                                                            "function": {
                                                                                                                              "application": {
                                                                                                                                "function": {
                                                                                                                                  "typeApplication": {
                                                                                                                                    "body": {
                                                                                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.optionals.match"}, "type": {"variable": "hydra.core.model.TypeScheme"}}},
                                                                                                                                    "type": {
                                                                                                                                      "either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"optional": {"variable": "hydra.core.model.TypeScheme"}}}}}},
                                                                                                                                "argument": {
                                                                                                                                  "application": {
                                                                                                                                    "function": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "typeScheme"}},
                                                                                                                                    "argument": {"variable": "el"}}}}},
                                                                                                                            "argument": {
                                                                                                                              "typeApplication": {
                                                                                                                                "body": {
                                                                                                                                  "typeApplication": {
                                                                                                                                    "body": {
                                                                                                                                      "either": {"right": {"typeApplication": {"body": {"optional": null}, "type": {"variable": "hydra.core.model.TypeScheme"}}}}},
                                                                                                                                    "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                                                                "type": {"optional": {"variable": "hydra.core.model.TypeScheme"}}}}}},
                                                                                                                        "argument": {
                                                                                                                          "lambda": {
                                                                                                                            "parameter": "ts",
                                                                                                                            "domain": {"variable": "hydra.core.model.TypeScheme"},
                                                                                                                            "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.TypeScheme"}}},
                                                                                                                                        "type": {"optional": {"variable": "hydra.core.model.TypeScheme"}}}},
                                                                                                                                    "argument": {
                                                                                                                                      "application": {
                                                                                                                                        "function": {
                                                                                                                                          "application": {
                                                                                                                                            "function": {"application": {"function": {"variable": "hydra.core.adapt.adaptTypeScheme"}, "argument": {"variable": "constraints"}}},
                                                                                                                                            "argument": {"variable": "litmap"}}},
                                                                                                                                        "argument": {"variable": "ts"}}}}},
                                                                                                                                "argument": {
                                                                                                                                  "lambda": {
                                                                                                                                    "parameter": "ts1",
                                                                                                                                    "domain": {"variable": "hydra.core.model.TypeScheme"},
                                                                                                                                    "body": {
                                                                                                                                      "typeApplication": {
                                                                                                                                        "body": {
                                                                                                                                          "typeApplication": {"body": {"either": {"right": {"optional": {"variable": "ts1"}}}}, "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                                                                        "type": {"optional": {"variable": "hydra.core.model.TypeScheme"}}}}}}}}}}}}}},
                                                                                                                "argument": {
                                                                                                                  "lambda": {
                                                                                                                    "parameter": "adaptedType",
                                                                                                                    "domain": {"optional": {"variable": "hydra.core.model.TypeScheme"}},
                                                                                                                    "body": {
                                                                                                                      "typeApplication": {
                                                                                                                        "body": {
                                                                                                                          "typeApplication": {
                                                                                                                            "body": {
                                                                                                                              "either": {
                                                                                                                                "right": {
                                                                                                                                  "record": {
                                                                                                                                    "typeName": "hydra.core.model.Binding",
                                                                                                                                    "fields": [
                                                                                                                                      {
                                                                                                                                        "name": "name",
                                                                                                                                        "term": {
                                                                                                                                          "application": {"function": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "name"}}, "argument": {"variable": "el"}}}},
                                                                                                                                      {"name": "term", "term": {"variable": "newTerm"}},
                                                                                                                                      {"name": "typeScheme", "term": {"variable": "adaptedType"}}]}}}},
                                                                                                                            "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                                                        "type": {"variable": "hydra.core.model.Binding"}}}}}}}}}}}}},
                                                                                                "typeScheme": {
                                                                                                  "variables": [],
                                                                                                  "body": {
                                                                                                    "function": {
                                                                                                      "domain": {"variable": "hydra.core.model.Binding"},
                                                                                                      "codomain": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.model.Binding"}}}}},
                                                                                                  "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.Binding"}}}},
                                                                                                        "type": {
                                                                                                          "pair": {"first": {"variable": "hydra.core.graph.Graph"}, "second": {"list": {"variable": "hydra.core.model.Binding"}}}}}},
                                                                                                    "argument": {
                                                                                                      "application": {
                                                                                                        "function": {
                                                                                                          "application": {
                                                                                                            "function": {
                                                                                                              "typeApplication": {
                                                                                                                "body": {
                                                                                                                  "typeApplication": {
                                                                                                                    "body": {
                                                                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.eithers.mapList"}, "type": {"variable": "hydra.core.model.Binding"}}},
                                                                                                                    "type": {"variable": "hydra.core.model.Binding"}}},
                                                                                                                "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                                            "argument": {"variable": "processBinding"}}},
                                                                                                        "argument": {"variable": "els1Raw"}}}}},
                                                                                                "argument": {
                                                                                                  "lambda": {
                                                                                                    "parameter": "els1",
                                                                                                    "domain": {"list": {"variable": "hydra.core.model.Binding"}},
                                                                                                    "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": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.graph.Primitive"}}}}}},
                                                                                                                "type": {
                                                                                                                  "pair": {"first": {"variable": "hydra.core.graph.Graph"}, "second": {"list": {"variable": "hydra.core.model.Binding"}}}}}},
                                                                                                            "argument": {
                                                                                                              "application": {
                                                                                                                "function": {
                                                                                                                  "application": {
                                                                                                                    "function": {
                                                                                                                      "typeApplication": {
                                                                                                                        "body": {
                                                                                                                          "typeApplication": {
                                                                                                                            "body": {
                                                                                                                              "typeApplication": {
                                                                                                                                "body": {"variable": "hydra.core.lib.eithers.mapList"},
                                                                                                                                "type": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.graph.Primitive"}}}}},
                                                                                                                            "type": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.graph.Primitive"}}}}},
                                                                                                                        "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                                                    "argument": {
                                                                                                                      "lambda": {
                                                                                                                        "parameter": "kv",
                                                                                                                        "domain": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.graph.Primitive"}}},
                                                                                                                        "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.graph.Primitive"}}},
                                                                                                                                    "type": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.graph.Primitive"}}}}},
                                                                                                                                "argument": {
                                                                                                                                  "application": {
                                                                                                                                    "function": {
                                                                                                                                      "application": {
                                                                                                                                        "function": {"application": {"function": {"variable": "hydra.core.adapt.adaptPrimitive"}, "argument": {"variable": "constraints"}}},
                                                                                                                                        "argument": {"variable": "litmap"}}},
                                                                                                                                    "argument": {
                                                                                                                                      "application": {
                                                                                                                                        "function": {
                                                                                                                                          "typeApplication": {
                                                                                                                                            "body": {
                                                                                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                                                            "type": {"variable": "hydra.core.graph.Primitive"}}},
                                                                                                                                        "argument": {"variable": "kv"}}}}}}},
                                                                                                                            "argument": {
                                                                                                                              "lambda": {
                                                                                                                                "parameter": "prim1",
                                                                                                                                "domain": {"variable": "hydra.core.graph.Primitive"},
                                                                                                                                "body": {
                                                                                                                                  "typeApplication": {
                                                                                                                                    "body": {
                                                                                                                                      "typeApplication": {
                                                                                                                                        "body": {
                                                                                                                                          "either": {
                                                                                                                                            "right": {
                                                                                                                                              "typeApplication": {
                                                                                                                                                "body": {
                                                                                                                                                  "typeApplication": {
                                                                                                                                                    "body": {
                                                                                                                                                      "pair": {
                                                                                                                                                        "first": {
                                                                                                                                                          "application": {
                                                                                                                                                            "function": {
                                                                                                                                                              "typeApplication": {
                                                                                                                                                                "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                                                                                "type": {"variable": "hydra.core.graph.Primitive"}}},
                                                                                                                                                            "argument": {"variable": "kv"}}},
                                                                                                                                                        "second": {"variable": "prim1"}}},
                                                                                                                                                    "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                                                                "type": {"variable": "hydra.core.graph.Primitive"}}}}},
                                                                                                                                        "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                                                                    "type": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.graph.Primitive"}}}}}}}}}}}}},
                                                                                                                "argument": {
                                                                                                                  "application": {
                                                                                                                    "function": {
                                                                                                                      "typeApplication": {
                                                                                                                        "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.toList"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                                        "type": {"variable": "hydra.core.graph.Primitive"}}},
                                                                                                                    "argument": {"variable": "prims0"}}}}}}},
                                                                                                        "argument": {
                                                                                                          "lambda": {
                                                                                                            "parameter": "primPairs",
                                                                                                            "domain": {
                                                                                                              "list": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.graph.Primitive"}}}},
                                                                                                            "body": {
                                                                                                              "let": {
                                                                                                                "bindings": [
                                                                                                                  {
                                                                                                                    "name": "prims1",
                                                                                                                    "term": {
                                                                                                                      "application": {
                                                                                                                        "function": {
                                                                                                                          "typeApplication": {
                                                                                                                            "body": {
                                                                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.maps.fromList"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                                            "type": {"variable": "hydra.core.graph.Primitive"}}},
                                                                                                                        "argument": {"variable": "primPairs"}}},
                                                                                                                    "typeScheme": {
                                                                                                                      "variables": [],
                                                                                                                      "body": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.graph.Primitive"}}},
                                                                                                                      "constraints": []}}],
                                                                                                                "body": {
                                                                                                                  "let": {
                                                                                                                    "bindings": [
                                                                                                                      {
                                                                                                                        "name": "adaptedGraphRaw",
                                                                                                                        "term": {
                                                                                                                          "application": {
                                                                                                                            "function": {
                                                                                                                              "application": {
                                                                                                                                "function": {"application": {"function": {"variable": "hydra.core.lexical.buildGraph"}, "argument": {"variable": "els1"}}},
                                                                                                                                "argument": {
                                                                                                                                  "typeApplication": {
                                                                                                                                    "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.empty"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                                                    "type": {"optional": {"variable": "hydra.core.model.Term"}}}}}},
                                                                                                                            "argument": {"variable": "prims1"}}},
                                                                                                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.graph.Graph"}, "constraints": []}}],
                                                                                                                    "body": {
                                                                                                                      "let": {
                                                                                                                        "bindings": [
                                                                                                                          {
                                                                                                                            "name": "adaptedGraph",
                                                                                                                            "term": {
                                                                                                                              "record": {
                                                                                                                                "typeName": "hydra.core.graph.Graph",
                                                                                                                                "fields": [
                                                                                                                                  {
                                                                                                                                    "name": "boundTerms",
                                                                                                                                    "term": {
                                                                                                                                      "application": {
                                                                                                                                        "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "boundTerms"}},
                                                                                                                                        "argument": {"variable": "adaptedGraphRaw"}}}},
                                                                                                                                  {
                                                                                                                                    "name": "boundTypes",
                                                                                                                                    "term": {
                                                                                                                                      "application": {
                                                                                                                                        "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "boundTypes"}},
                                                                                                                                        "argument": {"variable": "adaptedGraphRaw"}}}},
                                                                                                                                  {
                                                                                                                                    "name": "classConstraints",
                                                                                                                                    "term": {
                                                                                                                                      "application": {
                                                                                                                                        "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "classConstraints"}},
                                                                                                                                        "argument": {"variable": "adaptedGraphRaw"}}}},
                                                                                                                                  {
                                                                                                                                    "name": "lambdaVariables",
                                                                                                                                    "term": {
                                                                                                                                      "application": {
                                                                                                                                        "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "lambdaVariables"}},
                                                                                                                                        "argument": {"variable": "adaptedGraphRaw"}}}},
                                                                                                                                  {
                                                                                                                                    "name": "metadata",
                                                                                                                                    "term": {
                                                                                                                                      "application": {
                                                                                                                                        "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "metadata"}},
                                                                                                                                        "argument": {"variable": "adaptedGraphRaw"}}}},
                                                                                                                                  {
                                                                                                                                    "name": "primitives",
                                                                                                                                    "term": {
                                                                                                                                      "application": {
                                                                                                                                        "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "primitives"}},
                                                                                                                                        "argument": {"variable": "adaptedGraphRaw"}}}},
                                                                                                                                  {"name": "schemaTypes", "term": {"variable": "adaptedSchemaTypes"}},
                                                                                                                                  {
                                                                                                                                    "name": "typeVariables",
                                                                                                                                    "term": {
                                                                                                                                      "application": {
                                                                                                                                        "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "typeVariables"}},
                                                                                                                                        "argument": {"variable": "adaptedGraphRaw"}}}}]}},
                                                                                                                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.graph.Graph"}, "constraints": []}}],
                                                                                                                        "body": {
                                                                                                                          "typeApplication": {
                                                                                                                            "body": {
                                                                                                                              "typeApplication": {
                                                                                                                                "body": {
                                                                                                                                  "either": {
                                                                                                                                    "right": {
                                                                                                                                      "typeApplication": {
                                                                                                                                        "body": {
                                                                                                                                          "typeApplication": {
                                                                                                                                            "body": {"pair": {"first": {"variable": "adaptedGraph"}, "second": {"variable": "els1"}}},
                                                                                                                                            "type": {"variable": "hydra.core.graph.Graph"}}},
                                                                                                                                        "type": {"list": {"variable": "hydra.core.model.Binding"}}}}}},
                                                                                                                                "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                                                            "type": {
                                                                                                                              "pair": {"first": {"variable": "hydra.core.graph.Graph"}, "second": {"list": {"variable": "hydra.core.model.Binding"}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}},
                "annotation": {
                  "map": [
                    {
                      "key": {"variable": "description"},
                      "value": {
                        "literal": {
                          "string": "Adapt a graph and its schema to the given language constraints. The doExpand flag controls eta expansion of partial applications. Adaptation is type-preserving: binding-level TypeSchemes are adapted (not stripped). Note: case statement hoisting is done separately, prior to adaptation. The els0 parameter provides the original ordered bindings. Returns both the adapted graph and the ordered adapted bindings."}}}]}}}}}}},
    {
      "term": {
        "name": "hydra.core.adapt.adaptFloatType",
        "signature": {
          "typeParameters": [],
          "parameters": [
            {"name": "arg0", "type": {"variable": "hydra.core.coders.LanguageConstraints"}, "isLazy": false},
            {"name": "arg1", "type": {"variable": "hydra.core.model.FloatType"}, "isLazy": false}],
          "result": {"type": {"optional": {"variable": "hydra.core.model.FloatType"}}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "constraints",
                "domain": {"variable": "hydra.core.coders.LanguageConstraints"},
                "body": {
                  "lambda": {
                    "parameter": "ft",
                    "domain": {"variable": "hydra.core.model.FloatType"},
                    "body": {
                      "let": {
                        "bindings": [
                          {
                            "name": "supported",
                            "term": {
                              "application": {
                                "function": {
                                  "application": {
                                    "function": {
                                      "typeApplication": {"body": {"variable": "hydra.core.lib.sets.member"}, "type": {"variable": "hydra.core.model.FloatType"}}},
                                    "argument": {"variable": "ft"}}},
                                "argument": {
                                  "application": {
                                    "function": {"project": {"typeName": "hydra.core.coders.LanguageConstraints", "fieldName": "floatTypes"}},
                                    "argument": {"variable": "constraints"}}}}},
                            "typeScheme": {"variables": [], "body": {"literal": "boolean"}, "constraints": []}}],
                        "body": {
                          "let": {
                            "bindings": [
                              {
                                "name": "alt",
                                "term": {"application": {"function": {"variable": "hydra.core.adapt.adaptFloatType"}, "argument": {"variable": "constraints"}}},
                                "typeScheme": {
                                  "variables": [],
                                  "body": {
                                    "function": {
                                      "domain": {"variable": "hydra.core.model.FloatType"},
                                      "codomain": {"optional": {"variable": "hydra.core.model.FloatType"}}}},
                                  "constraints": []}}],
                            "body": {
                              "let": {
                                "bindings": [
                                  {
                                    "name": "forUnsupported",
                                    "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": {
                                                          "application": {
                                                            "function": {"variable": "alt"},
                                                            "argument": {"inject": {"typeName": "hydra.core.model.FloatType", "field": {"name": "float64", "term": "unit"}}}}}}}},
                                                  {
                                                    "name": "float64",
                                                    "handler": {
                                                      "lambda": {
                                                        "parameter": "_",
                                                        "domain": "unit",
                                                        "body": {
                                                          "application": {
                                                            "function": {"variable": "alt"},
                                                            "argument": {"inject": {"typeName": "hydra.core.model.FloatType", "field": {"name": "float32", "term": "unit"}}}}}}}}]}},
                                            "argument": {"variable": "ft"}}}}},
                                    "typeScheme": {
                                      "variables": [],
                                      "body": {
                                        "function": {
                                          "domain": {"variable": "hydra.core.model.FloatType"},
                                          "codomain": {"optional": {"variable": "hydra.core.model.FloatType"}}}},
                                      "constraints": []}}],
                                "body": {
                                  "application": {
                                    "function": {
                                      "application": {
                                        "function": {
                                          "application": {
                                            "function": {
                                              "typeApplication": {"body": {"variable": "hydra.core.lib.logic.ifElse"}, "type": {"optional": {"variable": "hydra.core.model.FloatType"}}}},
                                            "argument": {"variable": "supported"}}},
                                        "argument": {"optional": {"variable": "ft"}}}},
                                    "argument": {"application": {"function": {"variable": "forUnsupported"}, "argument": {"variable": "ft"}}}}}}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {"literal": {"string": "Attempt to adapt a floating-point type using the given language constraints"}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.adapt.adaptGraphSchema",
        "signature": {
          "typeParameters": [{"name": "t0", "constraints": [{"simple": "ordering"}]}],
          "parameters": [
            {"name": "arg0", "type": {"variable": "hydra.core.coders.LanguageConstraints"}, "isLazy": false},
            {
              "name": "arg1",
              "type": {"map": {"keys": {"variable": "hydra.core.model.LiteralType"}, "values": {"variable": "hydra.core.model.LiteralType"}}},
              "isLazy": false},
            {
              "name": "arg2",
              "type": {"map": {"keys": {"variable": "t0"}, "values": {"variable": "hydra.core.model.Type"}}},
              "isLazy": false}],
          "result": {
            "type": {
              "either": {
                "left": {"variable": "hydra.core.errors.Error"},
                "right": {"map": {"keys": {"variable": "t0"}, "values": {"variable": "hydra.core.model.Type"}}}}}}},
        "body": {
          "typeLambda": {
            "parameter": "t0",
            "body": {
              "annotated": {
                "body": {
                  "lambda": {
                    "parameter": "constraints",
                    "domain": {"variable": "hydra.core.coders.LanguageConstraints"},
                    "body": {
                      "lambda": {
                        "parameter": "litmap",
                        "domain": {"map": {"keys": {"variable": "hydra.core.model.LiteralType"}, "values": {"variable": "hydra.core.model.LiteralType"}}},
                        "body": {
                          "lambda": {
                            "parameter": "types0",
                            "domain": {"map": {"keys": {"variable": "t0"}, "values": {"variable": "hydra.core.model.Type"}}},
                            "body": {
                              "let": {
                                "bindings": [
                                  {
                                    "name": "mapPair",
                                    "term": {
                                      "typeLambda": {
                                        "parameter": "t1",
                                        "body": {
                                          "lambda": {
                                            "parameter": "pair",
                                            "domain": {"pair": {"first": {"variable": "t1"}, "second": {"variable": "hydra.core.model.Type"}}},
                                            "body": {
                                              "let": {
                                                "bindings": [
                                                  {
                                                    "name": "name",
                                                    "term": {
                                                      "application": {
                                                        "function": {
                                                          "typeApplication": {
                                                            "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"variable": "t1"}}},
                                                            "type": {"variable": "hydra.core.model.Type"}}},
                                                        "argument": {"variable": "pair"}}},
                                                    "typeScheme": {"variables": [], "body": {"variable": "t1"}, "constraints": []}}],
                                                "body": {
                                                  "let": {
                                                    "bindings": [
                                                      {
                                                        "name": "typ",
                                                        "term": {
                                                          "application": {
                                                            "function": {
                                                              "typeApplication": {
                                                                "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"variable": "t1"}}},
                                                                "type": {"variable": "hydra.core.model.Type"}}},
                                                            "argument": {"variable": "pair"}}},
                                                        "typeScheme": {"variables": [], "body": {"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.Error"}}},
                                                                    "type": {"variable": "hydra.core.model.Type"}}},
                                                                "type": {"pair": {"first": {"variable": "t1"}, "second": {"variable": "hydra.core.model.Type"}}}}},
                                                            "argument": {
                                                              "application": {
                                                                "function": {
                                                                  "application": {
                                                                    "function": {"application": {"function": {"variable": "hydra.core.adapt.adaptType"}, "argument": {"variable": "constraints"}}},
                                                                    "argument": {"variable": "litmap"}}},
                                                                "argument": {"variable": "typ"}}}}},
                                                        "argument": {
                                                          "lambda": {
                                                            "parameter": "typ1",
                                                            "domain": {"variable": "hydra.core.model.Type"},
                                                            "body": {
                                                              "typeApplication": {
                                                                "body": {
                                                                  "typeApplication": {
                                                                    "body": {
                                                                      "either": {
                                                                        "right": {
                                                                          "typeApplication": {
                                                                            "body": {
                                                                              "typeApplication": {"body": {"pair": {"first": {"variable": "name"}, "second": {"variable": "typ1"}}}, "type": {"variable": "t1"}}},
                                                                            "type": {"variable": "hydra.core.model.Type"}}}}},
                                                                    "type": {"variable": "hydra.core.errors.Error"}}},
                                                                "type": {"pair": {"first": {"variable": "t1"}, "second": {"variable": "hydra.core.model.Type"}}}}}}}}}}}}}}}}},
                                    "typeScheme": {
                                      "variables": ["t1"],
                                      "body": {
                                        "function": {
                                          "domain": {"pair": {"first": {"variable": "t1"}, "second": {"variable": "hydra.core.model.Type"}}},
                                          "codomain": {
                                            "either": {
                                              "left": {"variable": "hydra.core.errors.Error"},
                                              "right": {"pair": {"first": {"variable": "t1"}, "second": {"variable": "hydra.core.model.Type"}}}}}}},
                                      "constraints": [{"key": "t1", "value": {"classes": []}}]}}],
                                "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": {"pair": {"first": {"variable": "t0"}, "second": {"variable": "hydra.core.model.Type"}}}}}},
                                            "type": {"map": {"keys": {"variable": "t0"}, "values": {"variable": "hydra.core.model.Type"}}}}},
                                        "argument": {
                                          "application": {
                                            "function": {
                                              "application": {
                                                "function": {
                                                  "typeApplication": {
                                                    "body": {
                                                      "typeApplication": {
                                                        "body": {
                                                          "typeApplication": {
                                                            "body": {"variable": "hydra.core.lib.eithers.mapList"},
                                                            "type": {"pair": {"first": {"variable": "t0"}, "second": {"variable": "hydra.core.model.Type"}}}}},
                                                        "type": {"pair": {"first": {"variable": "t0"}, "second": {"variable": "hydra.core.model.Type"}}}}},
                                                    "type": {"variable": "hydra.core.errors.Error"}}},
                                                "argument": {"typeApplication": {"body": {"variable": "mapPair"}, "type": {"variable": "t0"}}}}},
                                            "argument": {
                                              "application": {
                                                "function": {
                                                  "typeApplication": {
                                                    "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.toList"}, "type": {"variable": "t0"}}},
                                                    "type": {"variable": "hydra.core.model.Type"}}},
                                                "argument": {"variable": "types0"}}}}}}},
                                    "argument": {
                                      "lambda": {
                                        "parameter": "pairs",
                                        "domain": {"list": {"pair": {"first": {"variable": "t0"}, "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": "t0"}}},
                                                            "type": {"variable": "hydra.core.model.Type"}}},
                                                        "argument": {"variable": "pairs"}}}}},
                                                "type": {"variable": "hydra.core.errors.Error"}}},
                                            "type": {"map": {"keys": {"variable": "t0"}, "values": {"variable": "hydra.core.model.Type"}}}}}}}}}}}}}}}}},
                "annotation": {
                  "map": [
                    {
                      "key": {"variable": "description"},
                      "value": {"literal": {"string": "Adapt a schema graph to the given language constraints"}}}]}}}}}}},
    {
      "term": {
        "name": "hydra.core.adapt.adaptIntegerType",
        "signature": {
          "typeParameters": [],
          "parameters": [
            {"name": "arg0", "type": {"variable": "hydra.core.coders.LanguageConstraints"}, "isLazy": false},
            {"name": "arg1", "type": {"variable": "hydra.core.model.IntegerType"}, "isLazy": false}],
          "result": {"type": {"optional": {"variable": "hydra.core.model.IntegerType"}}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "constraints",
                "domain": {"variable": "hydra.core.coders.LanguageConstraints"},
                "body": {
                  "lambda": {
                    "parameter": "it",
                    "domain": {"variable": "hydra.core.model.IntegerType"},
                    "body": {
                      "let": {
                        "bindings": [
                          {
                            "name": "supported",
                            "term": {
                              "application": {
                                "function": {
                                  "application": {
                                    "function": {
                                      "typeApplication": {"body": {"variable": "hydra.core.lib.sets.member"}, "type": {"variable": "hydra.core.model.IntegerType"}}},
                                    "argument": {"variable": "it"}}},
                                "argument": {
                                  "application": {
                                    "function": {"project": {"typeName": "hydra.core.coders.LanguageConstraints", "fieldName": "integerTypes"}},
                                    "argument": {"variable": "constraints"}}}}},
                            "typeScheme": {"variables": [], "body": {"literal": "boolean"}, "constraints": []}}],
                        "body": {
                          "let": {
                            "bindings": [
                              {
                                "name": "alt",
                                "term": {
                                  "application": {"function": {"variable": "hydra.core.adapt.adaptIntegerType"}, "argument": {"variable": "constraints"}}},
                                "typeScheme": {
                                  "variables": [],
                                  "body": {
                                    "function": {
                                      "domain": {"variable": "hydra.core.model.IntegerType"},
                                      "codomain": {"optional": {"variable": "hydra.core.model.IntegerType"}}}},
                                  "constraints": []}}],
                            "body": {
                              "let": {
                                "bindings": [
                                  {
                                    "name": "forUnsupported",
                                    "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": {"typeApplication": {"body": {"optional": null}, "type": {"variable": "hydra.core.model.IntegerType"}}}}}},
                                                  {
                                                    "name": "int8",
                                                    "handler": {
                                                      "lambda": {
                                                        "parameter": "_",
                                                        "domain": "unit",
                                                        "body": {
                                                          "application": {
                                                            "function": {"variable": "alt"},
                                                            "argument": {"inject": {"typeName": "hydra.core.model.IntegerType", "field": {"name": "uint16", "term": "unit"}}}}}}}},
                                                  {
                                                    "name": "int16",
                                                    "handler": {
                                                      "lambda": {
                                                        "parameter": "_",
                                                        "domain": "unit",
                                                        "body": {
                                                          "application": {
                                                            "function": {"variable": "alt"},
                                                            "argument": {"inject": {"typeName": "hydra.core.model.IntegerType", "field": {"name": "uint32", "term": "unit"}}}}}}}},
                                                  {
                                                    "name": "int32",
                                                    "handler": {
                                                      "lambda": {
                                                        "parameter": "_",
                                                        "domain": "unit",
                                                        "body": {
                                                          "application": {
                                                            "function": {"variable": "alt"},
                                                            "argument": {"inject": {"typeName": "hydra.core.model.IntegerType", "field": {"name": "uint64", "term": "unit"}}}}}}}},
                                                  {
                                                    "name": "int64",
                                                    "handler": {
                                                      "lambda": {
                                                        "parameter": "_",
                                                        "domain": "unit",
                                                        "body": {
                                                          "application": {
                                                            "function": {"variable": "alt"},
                                                            "argument": {"inject": {"typeName": "hydra.core.model.IntegerType", "field": {"name": "bigint", "term": "unit"}}}}}}}},
                                                  {
                                                    "name": "uint8",
                                                    "handler": {
                                                      "lambda": {
                                                        "parameter": "_",
                                                        "domain": "unit",
                                                        "body": {
                                                          "application": {
                                                            "function": {"variable": "alt"},
                                                            "argument": {"inject": {"typeName": "hydra.core.model.IntegerType", "field": {"name": "int16", "term": "unit"}}}}}}}},
                                                  {
                                                    "name": "uint16",
                                                    "handler": {
                                                      "lambda": {
                                                        "parameter": "_",
                                                        "domain": "unit",
                                                        "body": {
                                                          "application": {
                                                            "function": {"variable": "alt"},
                                                            "argument": {"inject": {"typeName": "hydra.core.model.IntegerType", "field": {"name": "int32", "term": "unit"}}}}}}}},
                                                  {
                                                    "name": "uint32",
                                                    "handler": {
                                                      "lambda": {
                                                        "parameter": "_",
                                                        "domain": "unit",
                                                        "body": {
                                                          "application": {
                                                            "function": {"variable": "alt"},
                                                            "argument": {"inject": {"typeName": "hydra.core.model.IntegerType", "field": {"name": "int64", "term": "unit"}}}}}}}},
                                                  {
                                                    "name": "uint64",
                                                    "handler": {
                                                      "lambda": {
                                                        "parameter": "_",
                                                        "domain": "unit",
                                                        "body": {
                                                          "application": {
                                                            "function": {"variable": "alt"},
                                                            "argument": {"inject": {"typeName": "hydra.core.model.IntegerType", "field": {"name": "bigint", "term": "unit"}}}}}}}}]}},
                                            "argument": {"variable": "it"}}}}},
                                    "typeScheme": {
                                      "variables": [],
                                      "body": {
                                        "function": {
                                          "domain": {"variable": "hydra.core.model.IntegerType"},
                                          "codomain": {"optional": {"variable": "hydra.core.model.IntegerType"}}}},
                                      "constraints": []}}],
                                "body": {
                                  "application": {
                                    "function": {
                                      "application": {
                                        "function": {
                                          "application": {
                                            "function": {
                                              "typeApplication": {
                                                "body": {"variable": "hydra.core.lib.logic.ifElse"},
                                                "type": {"optional": {"variable": "hydra.core.model.IntegerType"}}}},
                                            "argument": {"variable": "supported"}}},
                                        "argument": {"optional": {"variable": "it"}}}},
                                    "argument": {"application": {"function": {"variable": "forUnsupported"}, "argument": {"variable": "it"}}}}}}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {"literal": {"string": "Attempt to adapt an integer type using the given language constraints"}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.adapt.adaptLambdaDomains",
        "signature": {
          "typeParameters": [{"name": "t0", "constraints": []}],
          "parameters": [
            {"name": "arg0", "type": {"variable": "hydra.core.coders.LanguageConstraints"}, "isLazy": false},
            {
              "name": "arg1",
              "type": {"map": {"keys": {"variable": "hydra.core.model.LiteralType"}, "values": {"variable": "hydra.core.model.LiteralType"}}},
              "isLazy": false},
            {
              "name": "arg2",
              "type": {
                "function": {
                  "domain": {"variable": "t0"},
                  "codomain": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.model.Term"}}}}},
              "isLazy": false},
            {"name": "arg3", "type": {"variable": "t0"}, "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": "constraints",
                    "domain": {"variable": "hydra.core.coders.LanguageConstraints"},
                    "body": {
                      "lambda": {
                        "parameter": "litmap",
                        "domain": {"map": {"keys": {"variable": "hydra.core.model.LiteralType"}, "values": {"variable": "hydra.core.model.LiteralType"}}},
                        "body": {
                          "lambda": {
                            "parameter": "recurse",
                            "domain": {
                              "function": {
                                "domain": {"variable": "t0"},
                                "codomain": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.model.Term"}}}}},
                            "body": {
                              "lambda": {
                                "parameter": "term",
                                "domain": {"variable": "t0"},
                                "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": {"variable": "recurse"}, "argument": {"variable": "term"}}}}},
                                    "argument": {
                                      "lambda": {
                                        "parameter": "rewritten",
                                        "domain": {"variable": "hydra.core.model.Term"},
                                        "body": {
                                          "application": {
                                            "function": {
                                              "cases": {
                                                "typeName": "hydra.core.model.Term",
                                                "default": {
                                                  "typeApplication": {
                                                    "body": {
                                                      "typeApplication": {"body": {"either": {"right": {"variable": "rewritten"}}}, "type": {"variable": "hydra.core.errors.Error"}}},
                                                    "type": {"variable": "hydra.core.model.Term"}}},
                                                "cases": [
                                                  {
                                                    "name": "lambda",
                                                    "handler": {
                                                      "lambda": {
                                                        "parameter": "l",
                                                        "domain": {"variable": "hydra.core.model.Lambda"},
                                                        "body": {
                                                          "application": {
                                                            "function": {
                                                              "application": {
                                                                "function": {
                                                                  "typeApplication": {
                                                                    "body": {
                                                                      "typeApplication": {
                                                                        "body": {
                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.eithers.bind"}, "type": {"variable": "hydra.core.errors.Error"}}},
                                                                        "type": {"optional": {"variable": "hydra.core.model.Type"}}}},
                                                                    "type": {"variable": "hydra.core.model.Term"}}},
                                                                "argument": {
                                                                  "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": {"optional": {"variable": "hydra.core.model.Type"}}}}}},
                                                                            "argument": {
                                                                              "application": {"function": {"project": {"typeName": "hydra.core.model.Lambda", "fieldName": "domain"}}, "argument": {"variable": "l"}}}}},
                                                                        "argument": {
                                                                          "typeApplication": {
                                                                            "body": {
                                                                              "typeApplication": {
                                                                                "body": {"either": {"right": {"typeApplication": {"body": {"optional": null}, "type": {"variable": "hydra.core.model.Type"}}}}},
                                                                                "type": {"variable": "hydra.core.errors.Error"}}},
                                                                            "type": {"optional": {"variable": "hydra.core.model.Type"}}}}}},
                                                                    "argument": {
                                                                      "lambda": {
                                                                        "parameter": "dom",
                                                                        "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.Type"}}},
                                                                                    "type": {"optional": {"variable": "hydra.core.model.Type"}}}},
                                                                                "argument": {
                                                                                  "application": {
                                                                                    "function": {
                                                                                      "application": {
                                                                                        "function": {"application": {"function": {"variable": "hydra.core.adapt.adaptType"}, "argument": {"variable": "constraints"}}},
                                                                                        "argument": {"variable": "litmap"}}},
                                                                                    "argument": {"variable": "dom"}}}}},
                                                                            "argument": {
                                                                              "lambda": {
                                                                                "parameter": "dom1",
                                                                                "domain": {"variable": "hydra.core.model.Type"},
                                                                                "body": {
                                                                                  "typeApplication": {
                                                                                    "body": {
                                                                                      "typeApplication": {"body": {"either": {"right": {"optional": {"variable": "dom1"}}}}, "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                    "type": {"optional": {"variable": "hydra.core.model.Type"}}}}}}}}}}}}}},
                                                            "argument": {
                                                              "lambda": {
                                                                "parameter": "adaptedDomain",
                                                                "domain": {"optional": {"variable": "hydra.core.model.Type"}},
                                                                "body": {
                                                                  "typeApplication": {
                                                                    "body": {
                                                                      "typeApplication": {
                                                                        "body": {
                                                                          "either": {
                                                                            "right": {
                                                                              "inject": {
                                                                                "typeName": "hydra.core.model.Term",
                                                                                "field": {
                                                                                  "name": "lambda",
                                                                                  "term": {
                                                                                    "record": {
                                                                                      "typeName": "hydra.core.model.Lambda",
                                                                                      "fields": [
                                                                                        {
                                                                                          "name": "parameter",
                                                                                          "term": {
                                                                                            "application": {
                                                                                              "function": {"project": {"typeName": "hydra.core.model.Lambda", "fieldName": "parameter"}},
                                                                                              "argument": {"variable": "l"}}}},
                                                                                        {"name": "domain", "term": {"variable": "adaptedDomain"}},
                                                                                        {
                                                                                          "name": "body",
                                                                                          "term": {
                                                                                            "application": {"function": {"project": {"typeName": "hydra.core.model.Lambda", "fieldName": "body"}}, "argument": {"variable": "l"}}}}]}}}}}}},
                                                                        "type": {"variable": "hydra.core.errors.Error"}}},
                                                                    "type": {"variable": "hydra.core.model.Term"}}}}}}}}}}]}},
                                            "argument": {"variable": "rewritten"}}}}}}}}}}}}}}},
                "annotation": {
                  "map": [
                    {
                      "key": {"variable": "description"},
                      "value": {"literal": {"string": "Rewrite callback for adapting lambda domain types in a term"}}}]}}}}}}},
    {
      "term": {
        "name": "hydra.core.adapt.adaptLiteral",
        "signature": {
          "typeParameters": [],
          "parameters": [
            {"name": "arg0", "type": {"variable": "hydra.core.model.LiteralType"}, "isLazy": false},
            {"name": "arg1", "type": {"variable": "hydra.core.model.Literal"}, "isLazy": false}],
          "result": {"type": {"variable": "hydra.core.model.Literal"}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "lt",
                "domain": {"variable": "hydra.core.model.LiteralType"},
                "body": {
                  "lambda": {
                    "parameter": "l",
                    "domain": {"variable": "hydra.core.model.Literal"},
                    "body": {
                      "application": {
                        "function": {
                          "cases": {
                            "typeName": "hydra.core.model.Literal",
                            "cases": [
                              {
                                "name": "binary",
                                "handler": {
                                  "lambda": {
                                    "parameter": "b",
                                    "domain": {"literal": "binary"},
                                    "body": {
                                      "application": {
                                        "function": {
                                          "cases": {
                                            "typeName": "hydra.core.model.LiteralType",
                                            "cases": [
                                              {
                                                "name": "string",
                                                "handler": {
                                                  "lambda": {
                                                    "parameter": "_",
                                                    "domain": "unit",
                                                    "body": {
                                                      "inject": {
                                                        "typeName": "hydra.core.model.Literal",
                                                        "field": {
                                                          "name": "string",
                                                          "term": {"application": {"function": {"variable": "hydra.core.lib.literals.binaryToBase64"}, "argument": {"variable": "b"}}}}}}}}}]}},
                                        "argument": {"variable": "lt"}}}}}},
                              {
                                "name": "boolean",
                                "handler": {
                                  "lambda": {
                                    "parameter": "b",
                                    "domain": {"literal": "boolean"},
                                    "body": {
                                      "application": {
                                        "function": {
                                          "cases": {
                                            "typeName": "hydra.core.model.LiteralType",
                                            "cases": [
                                              {
                                                "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": {"application": {"function": {"variable": "hydra.core.literals.bigintToIntegerValue"}, "argument": {"variable": "it"}}},
                                                              "argument": {
                                                                "application": {
                                                                  "function": {
                                                                    "application": {
                                                                      "function": {
                                                                        "application": {
                                                                          "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.logic.ifElse"}, "type": {"literal": {"integer": "bigint"}}}},
                                                                          "argument": {"variable": "b"}}},
                                                                      "argument": {"literal": {"integer": {"bigint": "1"}}}}},
                                                                  "argument": {"literal": {"integer": {"bigint": "0"}}}}}}}}}}}}}]}},
                                        "argument": {"variable": "lt"}}}}}},
                              {
                                "name": "decimal",
                                "handler": {
                                  "lambda": {
                                    "parameter": "d",
                                    "domain": {"literal": "decimal"},
                                    "body": {
                                      "application": {
                                        "function": {
                                          "cases": {
                                            "typeName": "hydra.core.model.LiteralType",
                                            "cases": [
                                              {
                                                "name": "float",
                                                "handler": {
                                                  "lambda": {
                                                    "parameter": "_",
                                                    "domain": {"variable": "hydra.core.model.FloatType"},
                                                    "body": {
                                                      "inject": {
                                                        "typeName": "hydra.core.model.Literal",
                                                        "field": {
                                                          "name": "float",
                                                          "term": {
                                                            "inject": {
                                                              "typeName": "hydra.core.model.FloatValue",
                                                              "field": {
                                                                "name": "float64",
                                                                "term": {"application": {"function": {"variable": "hydra.core.lib.literals.decimalToFloat64"}, "argument": {"variable": "d"}}}}}}}}}}}},
                                              {
                                                "name": "string",
                                                "handler": {
                                                  "lambda": {
                                                    "parameter": "_",
                                                    "domain": "unit",
                                                    "body": {
                                                      "inject": {
                                                        "typeName": "hydra.core.model.Literal",
                                                        "field": {
                                                          "name": "string",
                                                          "term": {"application": {"function": {"variable": "hydra.core.lib.literals.printDecimal"}, "argument": {"variable": "d"}}}}}}}}}]}},
                                        "argument": {"variable": "lt"}}}}}},
                              {
                                "name": "float",
                                "handler": {
                                  "lambda": {
                                    "parameter": "f",
                                    "domain": {"variable": "hydra.core.model.FloatValue"},
                                    "body": {
                                      "application": {
                                        "function": {
                                          "cases": {
                                            "typeName": "hydra.core.model.LiteralType",
                                            "cases": [
                                              {
                                                "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": {
                                                                "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": {
                                                                                  "application": {
                                                                                    "function": {
                                                                                      "cases": {
                                                                                        "typeName": "hydra.core.model.FloatValue",
                                                                                        "cases": [
                                                                                          {
                                                                                            "name": "float32",
                                                                                            "handler": {"lambda": {"parameter": "f32", "domain": {"literal": {"float": "float32"}}, "body": {"variable": "f32"}}}},
                                                                                          {
                                                                                            "name": "float64",
                                                                                            "handler": {
                                                                                              "lambda": {
                                                                                                "parameter": "f64",
                                                                                                "domain": {"literal": {"float": "float64"}},
                                                                                                "body": {"application": {"function": {"variable": "hydra.core.lib.literals.float64ToFloat32"}, "argument": {"variable": "f64"}}}}}}]}},
                                                                                    "argument": {"variable": "f"}}}}}}}}},
                                                                    {
                                                                      "name": "float64",
                                                                      "handler": {
                                                                        "lambda": {
                                                                          "parameter": "_",
                                                                          "domain": "unit",
                                                                          "body": {
                                                                            "inject": {
                                                                              "typeName": "hydra.core.model.FloatValue",
                                                                              "field": {
                                                                                "name": "float64",
                                                                                "term": {
                                                                                  "application": {
                                                                                    "function": {
                                                                                      "cases": {
                                                                                        "typeName": "hydra.core.model.FloatValue",
                                                                                        "cases": [
                                                                                          {
                                                                                            "name": "float32",
                                                                                            "handler": {
                                                                                              "lambda": {
                                                                                                "parameter": "f32",
                                                                                                "domain": {"literal": {"float": "float32"}},
                                                                                                "body": {"application": {"function": {"variable": "hydra.core.lib.literals.float32ToFloat64"}, "argument": {"variable": "f32"}}}}}},
                                                                                          {
                                                                                            "name": "float64",
                                                                                            "handler": {"lambda": {"parameter": "f64", "domain": {"literal": {"float": "float64"}}, "body": {"variable": "f64"}}}}]}},
                                                                                    "argument": {"variable": "f"}}}}}}}}}]}},
                                                              "argument": {"variable": "ft"}}}}}}}}}]}},
                                        "argument": {"variable": "lt"}}}}}},
                              {
                                "name": "integer",
                                "handler": {
                                  "lambda": {
                                    "parameter": "i",
                                    "domain": {"variable": "hydra.core.model.IntegerValue"},
                                    "body": {
                                      "application": {
                                        "function": {
                                          "cases": {
                                            "typeName": "hydra.core.model.LiteralType",
                                            "cases": [
                                              {
                                                "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": {"application": {"function": {"variable": "hydra.core.literals.bigintToIntegerValue"}, "argument": {"variable": "it"}}},
                                                              "argument": {"application": {"function": {"variable": "hydra.core.literals.integerValueToBigint"}, "argument": {"variable": "i"}}}}}}}}}}}]}},
                                        "argument": {"variable": "lt"}}}}}}]}},
                        "argument": {"variable": "l"}}}}}}},
            "annotation": {
              "map": [{"key": {"variable": "description"}, "value": {"literal": {"string": "Convert a literal to a different type"}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.adapt.adaptLiteralType",
        "signature": {
          "typeParameters": [],
          "parameters": [
            {"name": "arg0", "type": {"variable": "hydra.core.coders.LanguageConstraints"}, "isLazy": false},
            {"name": "arg1", "type": {"variable": "hydra.core.model.LiteralType"}, "isLazy": false}],
          "result": {"type": {"optional": {"variable": "hydra.core.model.LiteralType"}}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "constraints",
                "domain": {"variable": "hydra.core.coders.LanguageConstraints"},
                "body": {
                  "lambda": {
                    "parameter": "lt",
                    "domain": {"variable": "hydra.core.model.LiteralType"},
                    "body": {
                      "let": {
                        "bindings": [
                          {
                            "name": "forUnsupported",
                            "term": {
                              "lambda": {
                                "parameter": "lt",
                                "domain": {"variable": "hydra.core.model.LiteralType"},
                                "body": {
                                  "application": {
                                    "function": {
                                      "cases": {
                                        "typeName": "hydra.core.model.LiteralType",
                                        "default": {"typeApplication": {"body": {"optional": null}, "type": {"variable": "hydra.core.model.LiteralType"}}},
                                        "cases": [
                                          {
                                            "name": "binary",
                                            "handler": {
                                              "lambda": {
                                                "parameter": "_",
                                                "domain": "unit",
                                                "body": {"optional": {"inject": {"typeName": "hydra.core.model.LiteralType", "field": {"name": "string", "term": "unit"}}}}}}},
                                          {
                                            "name": "boolean",
                                            "handler": {
                                              "lambda": {
                                                "parameter": "_",
                                                "domain": "unit",
                                                "body": {
                                                  "application": {
                                                    "function": {
                                                      "application": {
                                                        "function": {
                                                          "typeApplication": {
                                                            "body": {
                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.optionals.map"}, "type": {"variable": "hydra.core.model.IntegerType"}}},
                                                            "type": {"variable": "hydra.core.model.LiteralType"}}},
                                                        "argument": {
                                                          "lambda": {
                                                            "parameter": "x",
                                                            "domain": {"variable": "hydra.core.model.IntegerType"},
                                                            "body": {"inject": {"typeName": "hydra.core.model.LiteralType", "field": {"name": "integer", "term": {"variable": "x"}}}}}}}},
                                                    "argument": {
                                                      "application": {
                                                        "function": {
                                                          "application": {"function": {"variable": "hydra.core.adapt.adaptIntegerType"}, "argument": {"variable": "constraints"}}},
                                                        "argument": {"inject": {"typeName": "hydra.core.model.IntegerType", "field": {"name": "int8", "term": "unit"}}}}}}}}}},
                                          {
                                            "name": "decimal",
                                            "handler": {
                                              "lambda": {
                                                "parameter": "_",
                                                "domain": "unit",
                                                "body": {
                                                  "optional": {
                                                    "inject": {
                                                      "typeName": "hydra.core.model.LiteralType",
                                                      "field": {
                                                        "name": "float",
                                                        "term": {"inject": {"typeName": "hydra.core.model.FloatType", "field": {"name": "float64", "term": "unit"}}}}}}}}}},
                                          {
                                            "name": "float",
                                            "handler": {
                                              "lambda": {
                                                "parameter": "ft",
                                                "domain": {"variable": "hydra.core.model.FloatType"},
                                                "body": {
                                                  "application": {
                                                    "function": {
                                                      "application": {
                                                        "function": {
                                                          "typeApplication": {
                                                            "body": {
                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.optionals.map"}, "type": {"variable": "hydra.core.model.FloatType"}}},
                                                            "type": {"variable": "hydra.core.model.LiteralType"}}},
                                                        "argument": {
                                                          "lambda": {
                                                            "parameter": "x",
                                                            "domain": {"variable": "hydra.core.model.FloatType"},
                                                            "body": {"inject": {"typeName": "hydra.core.model.LiteralType", "field": {"name": "float", "term": {"variable": "x"}}}}}}}},
                                                    "argument": {
                                                      "application": {
                                                        "function": {"application": {"function": {"variable": "hydra.core.adapt.adaptFloatType"}, "argument": {"variable": "constraints"}}},
                                                        "argument": {"variable": "ft"}}}}}}}},
                                          {
                                            "name": "integer",
                                            "handler": {
                                              "lambda": {
                                                "parameter": "it",
                                                "domain": {"variable": "hydra.core.model.IntegerType"},
                                                "body": {
                                                  "application": {
                                                    "function": {
                                                      "application": {
                                                        "function": {
                                                          "typeApplication": {
                                                            "body": {
                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.optionals.map"}, "type": {"variable": "hydra.core.model.IntegerType"}}},
                                                            "type": {"variable": "hydra.core.model.LiteralType"}}},
                                                        "argument": {
                                                          "lambda": {
                                                            "parameter": "x",
                                                            "domain": {"variable": "hydra.core.model.IntegerType"},
                                                            "body": {"inject": {"typeName": "hydra.core.model.LiteralType", "field": {"name": "integer", "term": {"variable": "x"}}}}}}}},
                                                    "argument": {
                                                      "application": {
                                                        "function": {
                                                          "application": {"function": {"variable": "hydra.core.adapt.adaptIntegerType"}, "argument": {"variable": "constraints"}}},
                                                        "argument": {"variable": "it"}}}}}}}}]}},
                                    "argument": {"variable": "lt"}}}}},
                            "typeScheme": {
                              "variables": [],
                              "body": {
                                "function": {
                                  "domain": {"variable": "hydra.core.model.LiteralType"},
                                  "codomain": {"optional": {"variable": "hydra.core.model.LiteralType"}}}},
                              "constraints": []}}],
                        "body": {
                          "application": {
                            "function": {
                              "application": {
                                "function": {
                                  "application": {
                                    "function": {
                                      "typeApplication": {
                                        "body": {"variable": "hydra.core.lib.logic.ifElse"},
                                        "type": {"optional": {"variable": "hydra.core.model.LiteralType"}}}},
                                    "argument": {
                                      "application": {
                                        "function": {
                                          "application": {"function": {"variable": "hydra.core.adapt.literalTypeSupported"}, "argument": {"variable": "constraints"}}},
                                        "argument": {"variable": "lt"}}}}},
                                "argument": {"typeApplication": {"body": {"optional": null}, "type": {"variable": "hydra.core.model.LiteralType"}}}}},
                            "argument": {"application": {"function": {"variable": "forUnsupported"}, "argument": {"variable": "lt"}}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {"literal": {"string": "Attempt to adapt a literal type using the given language constraints"}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.adapt.adaptLiteralTypesMap",
        "signature": {
          "typeParameters": [],
          "parameters": [{"name": "arg0", "type": {"variable": "hydra.core.coders.LanguageConstraints"}, "isLazy": false}],
          "result": {
            "type": {"map": {"keys": {"variable": "hydra.core.model.LiteralType"}, "values": {"variable": "hydra.core.model.LiteralType"}}}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "constraints",
                "domain": {"variable": "hydra.core.coders.LanguageConstraints"},
                "body": {
                  "let": {
                    "bindings": [
                      {
                        "name": "tryType",
                        "term": {
                          "lambda": {
                            "parameter": "lt",
                            "domain": {"variable": "hydra.core.model.LiteralType"},
                            "body": {
                              "application": {
                                "function": {
                                  "application": {
                                    "function": {
                                      "application": {
                                        "function": {
                                          "typeApplication": {
                                            "body": {
                                              "typeApplication": {"body": {"variable": "hydra.core.lib.optionals.match"}, "type": {"variable": "hydra.core.model.LiteralType"}}},
                                            "type": {
                                              "optional": {
                                                "pair": {"first": {"variable": "hydra.core.model.LiteralType"}, "second": {"variable": "hydra.core.model.LiteralType"}}}}}},
                                        "argument": {
                                          "application": {
                                            "function": {
                                              "application": {"function": {"variable": "hydra.core.adapt.adaptLiteralType"}, "argument": {"variable": "constraints"}}},
                                            "argument": {"variable": "lt"}}}}},
                                    "argument": {
                                      "typeApplication": {
                                        "body": {"optional": null},
                                        "type": {
                                          "pair": {"first": {"variable": "hydra.core.model.LiteralType"}, "second": {"variable": "hydra.core.model.LiteralType"}}}}}}},
                                "argument": {
                                  "lambda": {
                                    "parameter": "lt2",
                                    "domain": {"variable": "hydra.core.model.LiteralType"},
                                    "body": {
                                      "optional": {
                                        "typeApplication": {
                                          "body": {
                                            "typeApplication": {
                                              "body": {"pair": {"first": {"variable": "lt"}, "second": {"variable": "lt2"}}},
                                              "type": {"variable": "hydra.core.model.LiteralType"}}},
                                          "type": {"variable": "hydra.core.model.LiteralType"}}}}}}}}}},
                        "typeScheme": {
                          "variables": [],
                          "body": {
                            "function": {
                              "domain": {"variable": "hydra.core.model.LiteralType"},
                              "codomain": {
                                "optional": {
                                  "pair": {"first": {"variable": "hydra.core.model.LiteralType"}, "second": {"variable": "hydra.core.model.LiteralType"}}}}}},
                          "constraints": []}}],
                    "body": {
                      "application": {
                        "function": {
                          "typeApplication": {
                            "body": {
                              "typeApplication": {"body": {"variable": "hydra.core.lib.maps.fromList"}, "type": {"variable": "hydra.core.model.LiteralType"}}},
                            "type": {"variable": "hydra.core.model.LiteralType"}}},
                        "argument": {
                          "application": {
                            "function": {
                              "typeApplication": {
                                "body": {"variable": "hydra.core.lib.optionals.givens"},
                                "type": {
                                  "pair": {"first": {"variable": "hydra.core.model.LiteralType"}, "second": {"variable": "hydra.core.model.LiteralType"}}}}},
                            "argument": {
                              "application": {
                                "function": {
                                  "application": {
                                    "function": {
                                      "typeApplication": {
                                        "body": {
                                          "typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.model.LiteralType"}}},
                                        "type": {
                                          "optional": {
                                            "pair": {"first": {"variable": "hydra.core.model.LiteralType"}, "second": {"variable": "hydra.core.model.LiteralType"}}}}}},
                                    "argument": {"variable": "tryType"}}},
                                "argument": {"variable": "hydra.core.reflect.literalTypes"}}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {"literal": {"string": "Derive a map of adapted literal types for the given language constraints"}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.adapt.adaptLiteralValue",
        "signature": {
          "typeParameters": [{"name": "t0", "constraints": [{"simple": "ordering"}]}],
          "parameters": [
            {
              "name": "arg0",
              "type": {"map": {"keys": {"variable": "t0"}, "values": {"variable": "hydra.core.model.LiteralType"}}},
              "isLazy": false},
            {"name": "arg1", "type": {"variable": "t0"}, "isLazy": false},
            {"name": "arg2", "type": {"variable": "hydra.core.model.Literal"}, "isLazy": false}],
          "result": {"type": {"variable": "hydra.core.model.Literal"}}},
        "body": {
          "typeLambda": {
            "parameter": "t0",
            "body": {
              "annotated": {
                "body": {
                  "lambda": {
                    "parameter": "litmap",
                    "domain": {"map": {"keys": {"variable": "t0"}, "values": {"variable": "hydra.core.model.LiteralType"}}},
                    "body": {
                      "lambda": {
                        "parameter": "lt",
                        "domain": {"variable": "t0"},
                        "body": {
                          "lambda": {
                            "parameter": "l",
                            "domain": {"variable": "hydra.core.model.Literal"},
                            "body": {
                              "application": {
                                "function": {
                                  "application": {
                                    "function": {
                                      "application": {
                                        "function": {
                                          "typeApplication": {
                                            "body": {
                                              "typeApplication": {"body": {"variable": "hydra.core.lib.optionals.match"}, "type": {"variable": "hydra.core.model.LiteralType"}}},
                                            "type": {"variable": "hydra.core.model.Literal"}}},
                                        "argument": {
                                          "application": {
                                            "function": {
                                              "application": {
                                                "function": {
                                                  "typeApplication": {
                                                    "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.lookup"}, "type": {"variable": "t0"}}},
                                                    "type": {"variable": "hydra.core.model.LiteralType"}}},
                                                "argument": {"variable": "lt"}}},
                                            "argument": {"variable": "litmap"}}}}},
                                    "argument": {
                                      "inject": {
                                        "typeName": "hydra.core.model.Literal",
                                        "field": {
                                          "name": "string",
                                          "term": {"application": {"function": {"variable": "hydra.core.print.model.literal"}, "argument": {"variable": "l"}}}}}}}},
                                "argument": {
                                  "lambda": {
                                    "parameter": "lt2",
                                    "domain": {"variable": "hydra.core.model.LiteralType"},
                                    "body": {
                                      "application": {
                                        "function": {"application": {"function": {"variable": "hydra.core.adapt.adaptLiteral"}, "argument": {"variable": "lt2"}}},
                                        "argument": {"variable": "l"}}}}}}}}}}}}},
                "annotation": {
                  "map": [
                    {
                      "key": {"variable": "description"},
                      "value": {"literal": {"string": "Adapt a literal value using the given language constraints"}}}]}}}}}}},
    {
      "term": {
        "name": "hydra.core.adapt.adaptNestedTypes",
        "signature": {
          "typeParameters": [{"name": "t0", "constraints": []}],
          "parameters": [
            {"name": "arg0", "type": {"variable": "hydra.core.coders.LanguageConstraints"}, "isLazy": false},
            {
              "name": "arg1",
              "type": {"map": {"keys": {"variable": "hydra.core.model.LiteralType"}, "values": {"variable": "hydra.core.model.LiteralType"}}},
              "isLazy": false},
            {
              "name": "arg2",
              "type": {
                "function": {
                  "domain": {"variable": "t0"},
                  "codomain": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.model.Term"}}}}},
              "isLazy": false},
            {"name": "arg3", "type": {"variable": "t0"}, "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": "constraints",
                    "domain": {"variable": "hydra.core.coders.LanguageConstraints"},
                    "body": {
                      "lambda": {
                        "parameter": "litmap",
                        "domain": {"map": {"keys": {"variable": "hydra.core.model.LiteralType"}, "values": {"variable": "hydra.core.model.LiteralType"}}},
                        "body": {
                          "lambda": {
                            "parameter": "recurse",
                            "domain": {
                              "function": {
                                "domain": {"variable": "t0"},
                                "codomain": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.model.Term"}}}}},
                            "body": {
                              "lambda": {
                                "parameter": "term",
                                "domain": {"variable": "t0"},
                                "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": {"variable": "recurse"}, "argument": {"variable": "term"}}}}},
                                    "argument": {
                                      "lambda": {
                                        "parameter": "rewritten",
                                        "domain": {"variable": "hydra.core.model.Term"},
                                        "body": {
                                          "application": {
                                            "function": {
                                              "cases": {
                                                "typeName": "hydra.core.model.Term",
                                                "default": {
                                                  "typeApplication": {
                                                    "body": {
                                                      "typeApplication": {"body": {"either": {"right": {"variable": "rewritten"}}}, "type": {"variable": "hydra.core.errors.Error"}}},
                                                    "type": {"variable": "hydra.core.model.Term"}}},
                                                "cases": [
                                                  {
                                                    "name": "let",
                                                    "handler": {
                                                      "lambda": {
                                                        "parameter": "lt",
                                                        "domain": {"variable": "hydra.core.model.Let"},
                                                        "body": {
                                                          "let": {
                                                            "bindings": [
                                                              {
                                                                "name": "adaptB",
                                                                "term": {
                                                                  "lambda": {
                                                                    "parameter": "b",
                                                                    "domain": {"variable": "hydra.core.model.Binding"},
                                                                    "body": {
                                                                      "application": {
                                                                        "function": {
                                                                          "application": {
                                                                            "function": {
                                                                              "typeApplication": {
                                                                                "body": {
                                                                                  "typeApplication": {
                                                                                    "body": {
                                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.eithers.bind"}, "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                    "type": {"optional": {"variable": "hydra.core.model.TypeScheme"}}}},
                                                                                "type": {"variable": "hydra.core.model.Binding"}}},
                                                                            "argument": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "application": {
                                                                                    "function": {
                                                                                      "application": {
                                                                                        "function": {
                                                                                          "typeApplication": {
                                                                                            "body": {
                                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.optionals.match"}, "type": {"variable": "hydra.core.model.TypeScheme"}}},
                                                                                            "type": {
                                                                                              "either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"optional": {"variable": "hydra.core.model.TypeScheme"}}}}}},
                                                                                        "argument": {
                                                                                          "application": {
                                                                                            "function": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "typeScheme"}},
                                                                                            "argument": {"variable": "b"}}}}},
                                                                                    "argument": {
                                                                                      "typeApplication": {
                                                                                        "body": {
                                                                                          "typeApplication": {
                                                                                            "body": {
                                                                                              "either": {"right": {"typeApplication": {"body": {"optional": null}, "type": {"variable": "hydra.core.model.TypeScheme"}}}}},
                                                                                            "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                        "type": {"optional": {"variable": "hydra.core.model.TypeScheme"}}}}}},
                                                                                "argument": {
                                                                                  "lambda": {
                                                                                    "parameter": "ts",
                                                                                    "domain": {"variable": "hydra.core.model.TypeScheme"},
                                                                                    "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.TypeScheme"}}},
                                                                                                "type": {"optional": {"variable": "hydra.core.model.TypeScheme"}}}},
                                                                                            "argument": {
                                                                                              "application": {
                                                                                                "function": {
                                                                                                  "application": {
                                                                                                    "function": {"application": {"function": {"variable": "hydra.core.adapt.adaptTypeScheme"}, "argument": {"variable": "constraints"}}},
                                                                                                    "argument": {"variable": "litmap"}}},
                                                                                                "argument": {"variable": "ts"}}}}},
                                                                                        "argument": {
                                                                                          "lambda": {
                                                                                            "parameter": "ts1",
                                                                                            "domain": {"variable": "hydra.core.model.TypeScheme"},
                                                                                            "body": {
                                                                                              "typeApplication": {
                                                                                                "body": {
                                                                                                  "typeApplication": {"body": {"either": {"right": {"optional": {"variable": "ts1"}}}}, "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                                "type": {"optional": {"variable": "hydra.core.model.TypeScheme"}}}}}}}}}}}}}},
                                                                        "argument": {
                                                                          "lambda": {
                                                                            "parameter": "adaptedBType",
                                                                            "domain": {"optional": {"variable": "hydra.core.model.TypeScheme"}},
                                                                            "body": {
                                                                              "typeApplication": {
                                                                                "body": {
                                                                                  "typeApplication": {
                                                                                    "body": {
                                                                                      "either": {
                                                                                        "right": {
                                                                                          "record": {
                                                                                            "typeName": "hydra.core.model.Binding",
                                                                                            "fields": [
                                                                                              {
                                                                                                "name": "name",
                                                                                                "term": {
                                                                                                  "application": {"function": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "name"}}, "argument": {"variable": "b"}}}},
                                                                                              {
                                                                                                "name": "term",
                                                                                                "term": {
                                                                                                  "application": {"function": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "term"}}, "argument": {"variable": "b"}}}},
                                                                                              {"name": "typeScheme", "term": {"variable": "adaptedBType"}}]}}}},
                                                                                    "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                "type": {"variable": "hydra.core.model.Binding"}}}}}}}}},
                                                                "typeScheme": {
                                                                  "variables": [],
                                                                  "body": {
                                                                    "function": {
                                                                      "domain": {"variable": "hydra.core.model.Binding"},
                                                                      "codomain": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.model.Binding"}}}}},
                                                                  "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.Binding"}}}},
                                                                        "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.Binding"}}},
                                                                                    "type": {"variable": "hydra.core.model.Binding"}}},
                                                                                "type": {"variable": "hydra.core.errors.Error"}}},
                                                                            "argument": {"variable": "adaptB"}}},
                                                                        "argument": {
                                                                          "application": {"function": {"project": {"typeName": "hydra.core.model.Let", "fieldName": "bindings"}}, "argument": {"variable": "lt"}}}}}}},
                                                                "argument": {
                                                                  "lambda": {
                                                                    "parameter": "adaptedBindings",
                                                                    "domain": {"list": {"variable": "hydra.core.model.Binding"}},
                                                                    "body": {
                                                                      "typeApplication": {
                                                                        "body": {
                                                                          "typeApplication": {
                                                                            "body": {
                                                                              "either": {
                                                                                "right": {
                                                                                  "inject": {
                                                                                    "typeName": "hydra.core.model.Term",
                                                                                    "field": {
                                                                                      "name": "let",
                                                                                      "term": {
                                                                                        "record": {
                                                                                          "typeName": "hydra.core.model.Let",
                                                                                          "fields": [
                                                                                            {"name": "bindings", "term": {"variable": "adaptedBindings"}},
                                                                                            {
                                                                                              "name": "body",
                                                                                              "term": {
                                                                                                "application": {"function": {"project": {"typeName": "hydra.core.model.Let", "fieldName": "body"}}, "argument": {"variable": "lt"}}}}]}}}}}}},
                                                                            "type": {"variable": "hydra.core.errors.Error"}}},
                                                                        "type": {"variable": "hydra.core.model.Term"}}}}}}}}}}}}]}},
                                            "argument": {"variable": "rewritten"}}}}}}}}}}}}}}},
                "annotation": {
                  "map": [
                    {
                      "key": {"variable": "description"},
                      "value": {"literal": {"string": "Rewrite callback for adapting nested let binding TypeSchemes in a term"}}}]}}}}}}},
    {
      "term": {
        "name": "hydra.core.adapt.adaptPrimitive",
        "signature": {
          "typeParameters": [],
          "parameters": [
            {"name": "arg0", "type": {"variable": "hydra.core.coders.LanguageConstraints"}, "isLazy": false},
            {
              "name": "arg1",
              "type": {"map": {"keys": {"variable": "hydra.core.model.LiteralType"}, "values": {"variable": "hydra.core.model.LiteralType"}}},
              "isLazy": false},
            {"name": "arg2", "type": {"variable": "hydra.core.graph.Primitive"}, "isLazy": false}],
          "result": {
            "type": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.graph.Primitive"}}}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "constraints",
                "domain": {"variable": "hydra.core.coders.LanguageConstraints"},
                "body": {
                  "lambda": {
                    "parameter": "litmap",
                    "domain": {"map": {"keys": {"variable": "hydra.core.model.LiteralType"}, "values": {"variable": "hydra.core.model.LiteralType"}}},
                    "body": {
                      "lambda": {
                        "parameter": "prim0",
                        "domain": {"variable": "hydra.core.graph.Primitive"},
                        "body": {
                          "let": {
                            "bindings": [
                              {
                                "name": "def0",
                                "term": {
                                  "application": {
                                    "function": {"project": {"typeName": "hydra.core.graph.Primitive", "fieldName": "definition"}},
                                    "argument": {"variable": "prim0"}}},
                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.packaging.PrimitiveDefinition"}, "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": {"variable": "hydra.core.typing.TermSignature"}}},
                                        "type": {"variable": "hydra.core.graph.Primitive"}}},
                                    "argument": {
                                      "application": {
                                        "function": {
                                          "application": {
                                            "function": {
                                              "application": {"function": {"variable": "hydra.core.adapt.adaptTermSignature"}, "argument": {"variable": "constraints"}}},
                                            "argument": {"variable": "litmap"}}},
                                        "argument": {
                                          "application": {
                                            "function": {"project": {"typeName": "hydra.core.packaging.PrimitiveDefinition", "fieldName": "signature"}},
                                            "argument": {"variable": "def0"}}}}}}},
                                "argument": {
                                  "lambda": {
                                    "parameter": "sig1",
                                    "domain": {"variable": "hydra.core.typing.TermSignature"},
                                    "body": {
                                      "let": {
                                        "bindings": [
                                          {
                                            "name": "def1",
                                            "term": {
                                              "record": {
                                                "typeName": "hydra.core.packaging.PrimitiveDefinition",
                                                "fields": [
                                                  {
                                                    "name": "name",
                                                    "term": {
                                                      "application": {
                                                        "function": {"project": {"typeName": "hydra.core.packaging.PrimitiveDefinition", "fieldName": "name"}},
                                                        "argument": {"variable": "def0"}}}},
                                                  {
                                                    "name": "metadata",
                                                    "term": {
                                                      "application": {
                                                        "function": {"project": {"typeName": "hydra.core.packaging.PrimitiveDefinition", "fieldName": "metadata"}},
                                                        "argument": {"variable": "def0"}}}},
                                                  {"name": "signature", "term": {"variable": "sig1"}},
                                                  {
                                                    "name": "isPure",
                                                    "term": {
                                                      "application": {
                                                        "function": {"project": {"typeName": "hydra.core.packaging.PrimitiveDefinition", "fieldName": "isPure"}},
                                                        "argument": {"variable": "def0"}}}},
                                                  {
                                                    "name": "isTotal",
                                                    "term": {
                                                      "application": {
                                                        "function": {"project": {"typeName": "hydra.core.packaging.PrimitiveDefinition", "fieldName": "isTotal"}},
                                                        "argument": {"variable": "def0"}}}},
                                                  {
                                                    "name": "defaultImplementation",
                                                    "term": {
                                                      "application": {
                                                        "function": {"project": {"typeName": "hydra.core.packaging.PrimitiveDefinition", "fieldName": "defaultImplementation"}},
                                                        "argument": {"variable": "def0"}}}}]}},
                                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.packaging.PrimitiveDefinition"}, "constraints": []}}],
                                        "body": {
                                          "typeApplication": {
                                            "body": {
                                              "typeApplication": {
                                                "body": {
                                                  "either": {
                                                    "right": {
                                                      "record": {
                                                        "typeName": "hydra.core.graph.Primitive",
                                                        "fields": [
                                                          {"name": "definition", "term": {"variable": "def1"}},
                                                          {
                                                            "name": "implementation",
                                                            "term": {
                                                              "application": {
                                                                "function": {"project": {"typeName": "hydra.core.graph.Primitive", "fieldName": "implementation"}},
                                                                "argument": {"variable": "prim0"}}}}]}}}},
                                                "type": {"variable": "hydra.core.errors.Error"}}},
                                            "type": {"variable": "hydra.core.graph.Primitive"}}}}}}}}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {"literal": {"string": "Adapt a primitive to the given language constraints, prior to inference"}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.adapt.adaptTerm",
        "signature": {
          "typeParameters": [{"name": "t0", "constraints": []}],
          "parameters": [
            {"name": "arg0", "type": {"variable": "hydra.core.coders.LanguageConstraints"}, "isLazy": false},
            {
              "name": "arg1",
              "type": {"map": {"keys": {"variable": "hydra.core.model.LiteralType"}, "values": {"variable": "hydra.core.model.LiteralType"}}},
              "isLazy": false},
            {"name": "arg2", "type": {"variable": "t0"}, "isLazy": false},
            {"name": "arg3", "type": {"variable": "hydra.core.graph.Graph"}, "isLazy": false},
            {"name": "arg4", "type": {"variable": "hydra.core.model.Term"}, "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": "constraints",
                    "domain": {"variable": "hydra.core.coders.LanguageConstraints"},
                    "body": {
                      "lambda": {
                        "parameter": "litmap",
                        "domain": {"map": {"keys": {"variable": "hydra.core.model.LiteralType"}, "values": {"variable": "hydra.core.model.LiteralType"}}},
                        "body": {
                          "lambda": {
                            "parameter": "cx",
                            "domain": {"variable": "t0"},
                            "body": {
                              "lambda": {
                                "parameter": "graph",
                                "domain": {"variable": "hydra.core.graph.Graph"},
                                "body": {
                                  "lambda": {
                                    "parameter": "term0",
                                    "domain": {"variable": "hydra.core.model.Term"},
                                    "body": {
                                      "let": {
                                        "bindings": [
                                          {
                                            "name": "rewrite",
                                            "term": {
                                              "typeLambda": {
                                                "parameter": "t1",
                                                "body": {
                                                  "lambda": {
                                                    "parameter": "recurse",
                                                    "domain": {
                                                      "function": {
                                                        "domain": {"variable": "t1"},
                                                        "codomain": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.model.Term"}}}}},
                                                    "body": {
                                                      "lambda": {
                                                        "parameter": "term0",
                                                        "domain": {"variable": "t1"},
                                                        "body": {
                                                          "let": {
                                                            "bindings": [
                                                              {
                                                                "name": "forSupported",
                                                                "term": {
                                                                  "typeLambda": {
                                                                    "parameter": "t2",
                                                                    "body": {
                                                                      "lambda": {
                                                                        "parameter": "term",
                                                                        "domain": {"variable": "hydra.core.model.Term"},
                                                                        "body": {
                                                                          "application": {
                                                                            "function": {
                                                                              "cases": {
                                                                                "typeName": "hydra.core.model.Term",
                                                                                "default": {
                                                                                  "typeApplication": {
                                                                                    "body": {"typeApplication": {"body": {"either": {"right": {"optional": {"variable": "term"}}}}, "type": {"variable": "t2"}}},
                                                                                    "type": {"optional": {"variable": "hydra.core.model.Term"}}}},
                                                                                "cases": [
                                                                                  {
                                                                                    "name": "literal",
                                                                                    "handler": {
                                                                                      "lambda": {
                                                                                        "parameter": "l",
                                                                                        "domain": {"variable": "hydra.core.model.Literal"},
                                                                                        "body": {
                                                                                          "let": {
                                                                                            "bindings": [
                                                                                              {
                                                                                                "name": "lt",
                                                                                                "term": {"application": {"function": {"variable": "hydra.core.reflect.literalType"}, "argument": {"variable": "l"}}},
                                                                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.LiteralType"}, "constraints": []}}],
                                                                                            "body": {
                                                                                              "typeApplication": {
                                                                                                "body": {
                                                                                                  "typeApplication": {
                                                                                                    "body": {
                                                                                                      "either": {
                                                                                                        "right": {
                                                                                                          "optional": {
                                                                                                            "application": {
                                                                                                              "function": {
                                                                                                                "application": {
                                                                                                                  "function": {
                                                                                                                    "application": {
                                                                                                                      "function": {
                                                                                                                        "typeApplication": {"body": {"variable": "hydra.core.lib.logic.ifElse"}, "type": {"variable": "hydra.core.model.Term"}}},
                                                                                                                      "argument": {
                                                                                                                        "application": {
                                                                                                                          "function": {
                                                                                                                            "application": {"function": {"variable": "hydra.core.adapt.literalTypeSupported"}, "argument": {"variable": "constraints"}}},
                                                                                                                          "argument": {"variable": "lt"}}}}},
                                                                                                                  "argument": {"variable": "term"}}},
                                                                                                              "argument": {
                                                                                                                "inject": {
                                                                                                                  "typeName": "hydra.core.model.Term",
                                                                                                                  "field": {
                                                                                                                    "name": "literal",
                                                                                                                    "term": {
                                                                                                                      "application": {
                                                                                                                        "function": {
                                                                                                                          "application": {
                                                                                                                            "function": {
                                                                                                                              "application": {
                                                                                                                                "function": {
                                                                                                                                  "typeApplication": {"body": {"variable": "hydra.core.adapt.adaptLiteralValue"}, "type": {"variable": "hydra.core.model.LiteralType"}}},
                                                                                                                                "argument": {"variable": "litmap"}}},
                                                                                                                            "argument": {"variable": "lt"}}},
                                                                                                                        "argument": {"variable": "l"}}}}}}}}}}},
                                                                                                    "type": {"variable": "t2"}}},
                                                                                                "type": {"optional": {"variable": "hydra.core.model.Term"}}}}}}}}}]}},
                                                                            "argument": {"variable": "term"}}}}}}},
                                                                "typeScheme": {
                                                                  "variables": ["t2"],
                                                                  "body": {
                                                                    "function": {
                                                                      "domain": {"variable": "hydra.core.model.Term"},
                                                                      "codomain": {"either": {"left": {"variable": "t2"}, "right": {"optional": {"variable": "hydra.core.model.Term"}}}}}},
                                                                  "constraints": []}},
                                                              {
                                                                "name": "forUnsupported",
                                                                "term": {
                                                                  "lambda": {
                                                                    "parameter": "term",
                                                                    "domain": {"variable": "hydra.core.model.Term"},
                                                                    "body": {
                                                                      "let": {
                                                                        "bindings": [
                                                                          {
                                                                            "name": "tryAlts",
                                                                            "term": {
                                                                              "lambda": {
                                                                                "parameter": "alts",
                                                                                "domain": {"list": {"variable": "hydra.core.model.Term"}},
                                                                                "body": {
                                                                                  "application": {
                                                                                    "function": {
                                                                                      "application": {
                                                                                        "function": {
                                                                                          "application": {
                                                                                            "function": {
                                                                                              "typeApplication": {
                                                                                                "body": {
                                                                                                  "typeApplication": {
                                                                                                    "body": {"variable": "hydra.core.lib.optionals.match"},
                                                                                                    "type": {"pair": {"first": {"variable": "hydra.core.model.Term"}, "second": {"list": {"variable": "hydra.core.model.Term"}}}}}},
                                                                                                "type": {
                                                                                                  "either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"optional": {"variable": "hydra.core.model.Term"}}}}}},
                                                                                            "argument": {
                                                                                              "application": {
                                                                                                "function": {
                                                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.lists.uncons"}, "type": {"variable": "hydra.core.model.Term"}}},
                                                                                                "argument": {"variable": "alts"}}}}},
                                                                                        "argument": {
                                                                                          "typeApplication": {
                                                                                            "body": {
                                                                                              "typeApplication": {
                                                                                                "body": {"either": {"right": {"typeApplication": {"body": {"optional": null}, "type": {"variable": "hydra.core.model.Term"}}}}},
                                                                                                "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                            "type": {"optional": {"variable": "hydra.core.model.Term"}}}}}},
                                                                                    "argument": {
                                                                                      "lambda": {
                                                                                        "parameter": "uc",
                                                                                        "domain": {"pair": {"first": {"variable": "hydra.core.model.Term"}, "second": {"list": {"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": {"optional": {"variable": "hydra.core.model.Term"}}}},
                                                                                                    "type": {"optional": {"variable": "hydra.core.model.Term"}}}},
                                                                                                "argument": {
                                                                                                  "application": {
                                                                                                    "function": {"variable": "tryTerm"},
                                                                                                    "argument": {
                                                                                                      "application": {
                                                                                                        "function": {
                                                                                                          "typeApplication": {
                                                                                                            "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"variable": "hydra.core.model.Term"}}},
                                                                                                            "type": {"list": {"variable": "hydra.core.model.Term"}}}},
                                                                                                        "argument": {"variable": "uc"}}}}}}},
                                                                                            "argument": {
                                                                                              "lambda": {
                                                                                                "parameter": "mterm",
                                                                                                "domain": {"optional": {"variable": "hydra.core.model.Term"}},
                                                                                                "body": {
                                                                                                  "application": {
                                                                                                    "function": {
                                                                                                      "application": {
                                                                                                        "function": {
                                                                                                          "application": {
                                                                                                            "function": {
                                                                                                              "typeApplication": {
                                                                                                                "body": {
                                                                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.optionals.match"}, "type": {"variable": "hydra.core.model.Term"}}},
                                                                                                                "type": {
                                                                                                                  "either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"optional": {"variable": "hydra.core.model.Term"}}}}}},
                                                                                                            "argument": {"variable": "mterm"}}},
                                                                                                        "argument": {
                                                                                                          "application": {
                                                                                                            "function": {"variable": "tryAlts"},
                                                                                                            "argument": {
                                                                                                              "application": {
                                                                                                                "function": {
                                                                                                                  "typeApplication": {
                                                                                                                    "body": {
                                                                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"variable": "hydra.core.model.Term"}}},
                                                                                                                    "type": {"list": {"variable": "hydra.core.model.Term"}}}},
                                                                                                                "argument": {"variable": "uc"}}}}}}},
                                                                                                    "argument": {
                                                                                                      "lambda": {
                                                                                                        "parameter": "t",
                                                                                                        "domain": {"variable": "hydra.core.model.Term"},
                                                                                                        "body": {
                                                                                                          "typeApplication": {
                                                                                                            "body": {
                                                                                                              "typeApplication": {"body": {"either": {"right": {"optional": {"variable": "t"}}}}, "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                                            "type": {"optional": {"variable": "hydra.core.model.Term"}}}}}}}}}}}}}}}}}},
                                                                            "typeScheme": {
                                                                              "variables": [],
                                                                              "body": {
                                                                                "function": {
                                                                                  "domain": {"list": {"variable": "hydra.core.model.Term"}},
                                                                                  "codomain": {
                                                                                    "either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"optional": {"variable": "hydra.core.model.Term"}}}}}},
                                                                              "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.Term"}}}},
                                                                                    "type": {"optional": {"variable": "hydra.core.model.Term"}}}},
                                                                                "argument": {
                                                                                  "application": {
                                                                                    "function": {
                                                                                      "application": {
                                                                                        "function": {
                                                                                          "application": {
                                                                                            "function": {"typeApplication": {"body": {"variable": "hydra.core.adapt.termAlternatives"}, "type": {"variable": "t0"}}},
                                                                                            "argument": {"variable": "cx"}}},
                                                                                        "argument": {"variable": "graph"}}},
                                                                                    "argument": {"variable": "term"}}}}},
                                                                            "argument": {
                                                                              "lambda": {
                                                                                "parameter": "alts0",
                                                                                "domain": {"list": {"variable": "hydra.core.model.Term"}},
                                                                                "body": {"application": {"function": {"variable": "tryAlts"}, "argument": {"variable": "alts0"}}}}}}}}}}},
                                                                "typeScheme": {
                                                                  "variables": [],
                                                                  "body": {
                                                                    "function": {
                                                                      "domain": {"variable": "hydra.core.model.Term"},
                                                                      "codomain": {
                                                                        "either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"optional": {"variable": "hydra.core.model.Term"}}}}}},
                                                                  "constraints": []}},
                                                              {
                                                                "name": "tryTerm",
                                                                "term": {
                                                                  "lambda": {
                                                                    "parameter": "term",
                                                                    "domain": {"variable": "hydra.core.model.Term"},
                                                                    "body": {
                                                                      "let": {
                                                                        "bindings": [
                                                                          {
                                                                            "name": "supportedVariant",
                                                                            "term": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "application": {
                                                                                    "function": {
                                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.sets.member"}, "type": {"variable": "hydra.core.variants.TermVariant"}}},
                                                                                    "argument": {"application": {"function": {"variable": "hydra.core.reflect.termVariant"}, "argument": {"variable": "term"}}}}},
                                                                                "argument": {
                                                                                  "application": {
                                                                                    "function": {"project": {"typeName": "hydra.core.coders.LanguageConstraints", "fieldName": "termVariants"}},
                                                                                    "argument": {"variable": "constraints"}}}}},
                                                                            "typeScheme": {"variables": [], "body": {"literal": "boolean"}, "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": {"optional": {"variable": "hydra.core.model.Term"}}}}}},
                                                                                    "argument": {"variable": "supportedVariant"}}},
                                                                                "argument": {
                                                                                  "application": {
                                                                                    "function": {"typeApplication": {"body": {"variable": "forSupported"}, "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                    "argument": {"variable": "term"}}}}},
                                                                            "argument": {"application": {"function": {"variable": "forUnsupported"}, "argument": {"variable": "term"}}}}}}}}},
                                                                "typeScheme": {
                                                                  "variables": [],
                                                                  "body": {
                                                                    "function": {
                                                                      "domain": {"variable": "hydra.core.model.Term"},
                                                                      "codomain": {
                                                                        "either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"optional": {"variable": "hydra.core.model.Term"}}}}}},
                                                                  "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": {"variable": "hydra.core.model.Term"}}},
                                                                        "type": {"variable": "hydra.core.model.Term"}}},
                                                                    "argument": {"application": {"function": {"variable": "recurse"}, "argument": {"variable": "term0"}}}}},
                                                                "argument": {
                                                                  "lambda": {
                                                                    "parameter": "term1",
                                                                    "domain": {"variable": "hydra.core.model.Term"},
                                                                    "body": {
                                                                      "application": {
                                                                        "function": {
                                                                          "cases": {
                                                                            "typeName": "hydra.core.model.Term",
                                                                            "default": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "application": {
                                                                                    "function": {
                                                                                      "typeApplication": {
                                                                                        "body": {
                                                                                          "typeApplication": {
                                                                                            "body": {
                                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.eithers.bind"}, "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                            "type": {"optional": {"variable": "hydra.core.model.Term"}}}},
                                                                                        "type": {"variable": "hydra.core.model.Term"}}},
                                                                                    "argument": {"application": {"function": {"variable": "tryTerm"}, "argument": {"variable": "term1"}}}}},
                                                                                "argument": {
                                                                                  "lambda": {
                                                                                    "parameter": "mterm",
                                                                                    "domain": {"optional": {"variable": "hydra.core.model.Term"}},
                                                                                    "body": {
                                                                                      "application": {
                                                                                        "function": {
                                                                                          "application": {
                                                                                            "function": {
                                                                                              "application": {
                                                                                                "function": {
                                                                                                  "typeApplication": {
                                                                                                    "body": {
                                                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.optionals.match"}, "type": {"variable": "hydra.core.model.Term"}}},
                                                                                                    "type": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.model.Term"}}}}},
                                                                                                "argument": {"variable": "mterm"}}},
                                                                                            "argument": {
                                                                                              "typeApplication": {
                                                                                                "body": {
                                                                                                  "typeApplication": {
                                                                                                    "body": {
                                                                                                      "either": {
                                                                                                        "left": {
                                                                                                          "inject": {
                                                                                                            "typeName": "hydra.core.errors.Error",
                                                                                                            "field": {
                                                                                                              "name": "other",
                                                                                                              "term": {
                                                                                                                "wrap": {
                                                                                                                  "typeName": "hydra.core.errors.OtherError",
                                                                                                                  "body": {
                                                                                                                    "application": {
                                                                                                                      "function": {
                                                                                                                        "application": {
                                                                                                                          "function": {"variable": "hydra.core.lib.strings.concat2"},
                                                                                                                          "argument": {"literal": {"string": "no alternatives for term: "}}}},
                                                                                                                      "argument": {"application": {"function": {"variable": "hydra.core.print.model.term"}, "argument": {"variable": "term1"}}}}}}}}}}}},
                                                                                                    "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                                "type": {"variable": "hydra.core.model.Term"}}}}},
                                                                                        "argument": {
                                                                                          "lambda": {
                                                                                            "parameter": "term2",
                                                                                            "domain": {"variable": "hydra.core.model.Term"},
                                                                                            "body": {
                                                                                              "typeApplication": {
                                                                                                "body": {
                                                                                                  "typeApplication": {"body": {"either": {"right": {"variable": "term2"}}}, "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                                "type": {"variable": "hydra.core.model.Term"}}}}}}}}}}},
                                                                            "cases": [
                                                                              {
                                                                                "name": "annotated",
                                                                                "handler": {
                                                                                  "lambda": {
                                                                                    "parameter": "_",
                                                                                    "domain": {"variable": "hydra.core.model.AnnotatedTerm"},
                                                                                    "body": {
                                                                                      "typeApplication": {
                                                                                        "body": {
                                                                                          "typeApplication": {"body": {"either": {"right": {"variable": "term1"}}}, "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                        "type": {"variable": "hydra.core.model.Term"}}}}}},
                                                                              {
                                                                                "name": "typeApplication",
                                                                                "handler": {
                                                                                  "lambda": {
                                                                                    "parameter": "ta",
                                                                                    "domain": {"variable": "hydra.core.model.TypeApplicationTerm"},
                                                                                    "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.Type"}}},
                                                                                                "type": {"variable": "hydra.core.model.Term"}}},
                                                                                            "argument": {
                                                                                              "application": {
                                                                                                "function": {
                                                                                                  "application": {
                                                                                                    "function": {"application": {"function": {"variable": "hydra.core.adapt.adaptType"}, "argument": {"variable": "constraints"}}},
                                                                                                    "argument": {"variable": "litmap"}}},
                                                                                                "argument": {
                                                                                                  "application": {
                                                                                                    "function": {"project": {"typeName": "hydra.core.model.TypeApplicationTerm", "fieldName": "type"}},
                                                                                                    "argument": {"variable": "ta"}}}}}}},
                                                                                        "argument": {
                                                                                          "lambda": {
                                                                                            "parameter": "atyp",
                                                                                            "domain": {"variable": "hydra.core.model.Type"},
                                                                                            "body": {
                                                                                              "typeApplication": {
                                                                                                "body": {
                                                                                                  "typeApplication": {
                                                                                                    "body": {
                                                                                                      "either": {
                                                                                                        "right": {
                                                                                                          "inject": {
                                                                                                            "typeName": "hydra.core.model.Term",
                                                                                                            "field": {
                                                                                                              "name": "typeApplication",
                                                                                                              "term": {
                                                                                                                "record": {
                                                                                                                  "typeName": "hydra.core.model.TypeApplicationTerm",
                                                                                                                  "fields": [
                                                                                                                    {
                                                                                                                      "name": "body",
                                                                                                                      "term": {
                                                                                                                        "application": {
                                                                                                                          "function": {"project": {"typeName": "hydra.core.model.TypeApplicationTerm", "fieldName": "body"}},
                                                                                                                          "argument": {"variable": "ta"}}}},
                                                                                                                    {"name": "type", "term": {"variable": "atyp"}}]}}}}}}},
                                                                                                    "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                                "type": {"variable": "hydra.core.model.Term"}}}}}}}}}},
                                                                              {
                                                                                "name": "typeLambda",
                                                                                "handler": {
                                                                                  "lambda": {
                                                                                    "parameter": "_",
                                                                                    "domain": {"variable": "hydra.core.model.TypeLambda"},
                                                                                    "body": {
                                                                                      "typeApplication": {
                                                                                        "body": {
                                                                                          "typeApplication": {"body": {"either": {"right": {"variable": "term1"}}}, "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                        "type": {"variable": "hydra.core.model.Term"}}}}}}]}},
                                                                        "argument": {"variable": "term1"}}}}}}}}}}}}}}},
                                            "typeScheme": {
                                              "variables": ["t1"],
                                              "body": {
                                                "function": {
                                                  "domain": {
                                                    "function": {
                                                      "domain": {"variable": "t1"},
                                                      "codomain": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.model.Term"}}}}},
                                                  "codomain": {
                                                    "function": {
                                                      "domain": {"variable": "t1"},
                                                      "codomain": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.model.Term"}}}}}}},
                                              "constraints": []}}],
                                        "body": {
                                          "application": {
                                            "function": {
                                              "application": {
                                                "function": {
                                                  "typeApplication": {"body": {"variable": "hydra.core.rewriting.rewriteTermM"}, "type": {"variable": "hydra.core.errors.Error"}}},
                                                "argument": {"typeApplication": {"body": {"variable": "rewrite"}, "type": {"variable": "hydra.core.model.Term"}}}}},
                                            "argument": {"variable": "term0"}}}}}}}}}}}}}}},
                "annotation": {
                  "map": [
                    {
                      "key": {"variable": "description"},
                      "value": {"literal": {"string": "Adapt a term using the given language constraints"}}}]}}}}}}},
    {
      "term": {
        "name": "hydra.core.adapt.adaptTermForLanguage",
        "signature": {
          "typeParameters": [{"name": "t0", "constraints": []}],
          "parameters": [
            {"name": "arg0", "type": {"variable": "hydra.core.coders.Language"}, "isLazy": false},
            {"name": "arg1", "type": {"variable": "t0"}, "isLazy": false},
            {"name": "arg2", "type": {"variable": "hydra.core.graph.Graph"}, "isLazy": false},
            {"name": "arg3", "type": {"variable": "hydra.core.model.Term"}, "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": "lang",
                    "domain": {"variable": "hydra.core.coders.Language"},
                    "body": {
                      "lambda": {
                        "parameter": "cx",
                        "domain": {"variable": "t0"},
                        "body": {
                          "lambda": {
                            "parameter": "g",
                            "domain": {"variable": "hydra.core.graph.Graph"},
                            "body": {
                              "lambda": {
                                "parameter": "term",
                                "domain": {"variable": "hydra.core.model.Term"},
                                "body": {
                                  "let": {
                                    "bindings": [
                                      {
                                        "name": "constraints",
                                        "term": {
                                          "application": {
                                            "function": {"project": {"typeName": "hydra.core.coders.Language", "fieldName": "constraints"}},
                                            "argument": {"variable": "lang"}}},
                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.coders.LanguageConstraints"}, "constraints": []}}],
                                    "body": {
                                      "let": {
                                        "bindings": [
                                          {
                                            "name": "litmap",
                                            "term": {
                                              "application": {"function": {"variable": "hydra.core.adapt.adaptLiteralTypesMap"}, "argument": {"variable": "constraints"}}},
                                            "typeScheme": {
                                              "variables": [],
                                              "body": {"map": {"keys": {"variable": "hydra.core.model.LiteralType"}, "values": {"variable": "hydra.core.model.LiteralType"}}},
                                              "constraints": []}}],
                                        "body": {
                                          "application": {
                                            "function": {
                                              "application": {
                                                "function": {
                                                  "application": {
                                                    "function": {
                                                      "application": {
                                                        "function": {
                                                          "application": {
                                                            "function": {"typeApplication": {"body": {"variable": "hydra.core.adapt.adaptTerm"}, "type": {"variable": "t0"}}},
                                                            "argument": {"variable": "constraints"}}},
                                                        "argument": {"variable": "litmap"}}},
                                                    "argument": {"variable": "cx"}}},
                                                "argument": {"variable": "g"}}},
                                            "argument": {"variable": "term"}}}}}}}}}}}}}}},
                "annotation": {
                  "map": [
                    {
                      "key": {"variable": "description"},
                      "value": {"literal": {"string": "Adapt a term using the constraints of a given language"}}}]}}}}}}},
    {
      "term": {
        "name": "hydra.core.adapt.adaptTermSignature",
        "signature": {
          "typeParameters": [],
          "parameters": [
            {"name": "arg0", "type": {"variable": "hydra.core.coders.LanguageConstraints"}, "isLazy": false},
            {
              "name": "arg1",
              "type": {"map": {"keys": {"variable": "hydra.core.model.LiteralType"}, "values": {"variable": "hydra.core.model.LiteralType"}}},
              "isLazy": false},
            {"name": "arg2", "type": {"variable": "hydra.core.typing.TermSignature"}, "isLazy": false}],
          "result": {
            "type": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.typing.TermSignature"}}}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "constraints",
                "domain": {"variable": "hydra.core.coders.LanguageConstraints"},
                "body": {
                  "lambda": {
                    "parameter": "litmap",
                    "domain": {"map": {"keys": {"variable": "hydra.core.model.LiteralType"}, "values": {"variable": "hydra.core.model.LiteralType"}}},
                    "body": {
                      "lambda": {
                        "parameter": "sig0",
                        "domain": {"variable": "hydra.core.typing.TermSignature"},
                        "body": {
                          "let": {
                            "bindings": [
                              {
                                "name": "result0",
                                "term": {
                                  "application": {
                                    "function": {"project": {"typeName": "hydra.core.typing.TermSignature", "fieldName": "result"}},
                                    "argument": {"variable": "sig0"}}},
                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.Result"}, "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": {"variable": "hydra.core.model.Type"}}},
                                        "type": {"variable": "hydra.core.typing.TermSignature"}}},
                                    "argument": {
                                      "application": {
                                        "function": {
                                          "application": {
                                            "function": {"application": {"function": {"variable": "hydra.core.adapt.adaptType"}, "argument": {"variable": "constraints"}}},
                                            "argument": {"variable": "litmap"}}},
                                        "argument": {
                                          "application": {
                                            "function": {"project": {"typeName": "hydra.core.typing.Result", "fieldName": "type"}},
                                            "argument": {"variable": "result0"}}}}}}},
                                "argument": {
                                  "lambda": {
                                    "parameter": "resultType1",
                                    "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": {"list": {"variable": "hydra.core.typing.Parameter"}}}},
                                                "type": {"variable": "hydra.core.typing.TermSignature"}}},
                                            "argument": {
                                              "application": {
                                                "function": {
                                                  "application": {
                                                    "function": {
                                                      "typeApplication": {
                                                        "body": {
                                                          "typeApplication": {
                                                            "body": {
                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.eithers.mapList"}, "type": {"variable": "hydra.core.typing.Parameter"}}},
                                                            "type": {"variable": "hydra.core.typing.Parameter"}}},
                                                        "type": {"variable": "hydra.core.errors.Error"}}},
                                                    "argument": {
                                                      "lambda": {
                                                        "parameter": "p",
                                                        "domain": {"variable": "hydra.core.typing.Parameter"},
                                                        "body": {
                                                          "application": {
                                                            "function": {
                                                              "application": {
                                                                "function": {
                                                                  "typeApplication": {
                                                                    "body": {
                                                                      "typeApplication": {
                                                                        "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.eithers.map"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                        "type": {"variable": "hydra.core.typing.Parameter"}}},
                                                                    "type": {"variable": "hydra.core.errors.Error"}}},
                                                                "argument": {
                                                                  "lambda": {
                                                                    "parameter": "ty1",
                                                                    "domain": {"variable": "hydra.core.model.Type"},
                                                                    "body": {
                                                                      "record": {
                                                                        "typeName": "hydra.core.typing.Parameter",
                                                                        "fields": [
                                                                          {
                                                                            "name": "name",
                                                                            "term": {
                                                                              "application": {
                                                                                "function": {"project": {"typeName": "hydra.core.typing.Parameter", "fieldName": "name"}},
                                                                                "argument": {"variable": "p"}}}},
                                                                          {
                                                                            "name": "description",
                                                                            "term": {
                                                                              "application": {
                                                                                "function": {"project": {"typeName": "hydra.core.typing.Parameter", "fieldName": "description"}},
                                                                                "argument": {"variable": "p"}}}},
                                                                          {"name": "type", "term": {"variable": "ty1"}},
                                                                          {
                                                                            "name": "isLazy",
                                                                            "term": {
                                                                              "application": {
                                                                                "function": {"project": {"typeName": "hydra.core.typing.Parameter", "fieldName": "isLazy"}},
                                                                                "argument": {"variable": "p"}}}}]}}}}}},
                                                            "argument": {
                                                              "application": {
                                                                "function": {
                                                                  "application": {
                                                                    "function": {"application": {"function": {"variable": "hydra.core.adapt.adaptType"}, "argument": {"variable": "constraints"}}},
                                                                    "argument": {"variable": "litmap"}}},
                                                                "argument": {
                                                                  "application": {
                                                                    "function": {"project": {"typeName": "hydra.core.typing.Parameter", "fieldName": "type"}},
                                                                    "argument": {"variable": "p"}}}}}}}}}}},
                                                "argument": {
                                                  "application": {
                                                    "function": {"project": {"typeName": "hydra.core.typing.TermSignature", "fieldName": "parameters"}},
                                                    "argument": {"variable": "sig0"}}}}}}},
                                        "argument": {
                                          "lambda": {
                                            "parameter": "params1",
                                            "domain": {"list": {"variable": "hydra.core.typing.Parameter"}},
                                            "body": {
                                              "typeApplication": {
                                                "body": {
                                                  "typeApplication": {
                                                    "body": {
                                                      "either": {
                                                        "right": {
                                                          "record": {
                                                            "typeName": "hydra.core.typing.TermSignature",
                                                            "fields": [
                                                              {
                                                                "name": "typeParameters",
                                                                "term": {
                                                                  "application": {
                                                                    "function": {"project": {"typeName": "hydra.core.typing.TermSignature", "fieldName": "typeParameters"}},
                                                                    "argument": {"variable": "sig0"}}}},
                                                              {"name": "parameters", "term": {"variable": "params1"}},
                                                              {
                                                                "name": "result",
                                                                "term": {
                                                                  "record": {
                                                                    "typeName": "hydra.core.typing.Result",
                                                                    "fields": [
                                                                      {
                                                                        "name": "description",
                                                                        "term": {
                                                                          "application": {
                                                                            "function": {"project": {"typeName": "hydra.core.typing.Result", "fieldName": "description"}},
                                                                            "argument": {"variable": "result0"}}}},
                                                                      {"name": "type", "term": {"variable": "resultType1"}}]}}}]}}}},
                                                    "type": {"variable": "hydra.core.errors.Error"}}},
                                                "type": {"variable": "hydra.core.typing.TermSignature"}}}}}}}}}}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {
                    "literal": {
                      "string": "Adapt the types within a term signature to the given language constraints, in place. Parameter names, descriptions, and per-parameter isLazy flags, as well as type parameters, are preserved; only the parameter and result types are adapted. Unlike routing through TypeScheme (the type-only view), this retains the full TermSignature metadata, including primitive laziness flags."}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.adapt.adaptType",
        "signature": {
          "typeParameters": [],
          "parameters": [
            {"name": "arg0", "type": {"variable": "hydra.core.coders.LanguageConstraints"}, "isLazy": false},
            {
              "name": "arg1",
              "type": {"map": {"keys": {"variable": "hydra.core.model.LiteralType"}, "values": {"variable": "hydra.core.model.LiteralType"}}},
              "isLazy": false},
            {"name": "arg2", "type": {"variable": "hydra.core.model.Type"}, "isLazy": false}],
          "result": {"type": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.model.Type"}}}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "constraints",
                "domain": {"variable": "hydra.core.coders.LanguageConstraints"},
                "body": {
                  "lambda": {
                    "parameter": "litmap",
                    "domain": {"map": {"keys": {"variable": "hydra.core.model.LiteralType"}, "values": {"variable": "hydra.core.model.LiteralType"}}},
                    "body": {
                      "lambda": {
                        "parameter": "type0",
                        "domain": {"variable": "hydra.core.model.Type"},
                        "body": {
                          "let": {
                            "bindings": [
                              {
                                "name": "forSupported",
                                "term": {
                                  "lambda": {
                                    "parameter": "typ",
                                    "domain": {"variable": "hydra.core.model.Type"},
                                    "body": {
                                      "application": {
                                        "function": {
                                          "cases": {
                                            "typeName": "hydra.core.model.Type",
                                            "default": {"optional": {"variable": "typ"}},
                                            "cases": [
                                              {
                                                "name": "literal",
                                                "handler": {
                                                  "lambda": {
                                                    "parameter": "lt",
                                                    "domain": {"variable": "hydra.core.model.LiteralType"},
                                                    "body": {
                                                      "application": {
                                                        "function": {
                                                          "application": {
                                                            "function": {
                                                              "application": {
                                                                "function": {
                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.logic.ifElse"}, "type": {"optional": {"variable": "hydra.core.model.Type"}}}},
                                                                "argument": {
                                                                  "application": {
                                                                    "function": {
                                                                      "application": {"function": {"variable": "hydra.core.adapt.literalTypeSupported"}, "argument": {"variable": "constraints"}}},
                                                                    "argument": {"variable": "lt"}}}}},
                                                            "argument": {"optional": {"variable": "typ"}}}},
                                                        "argument": {
                                                          "application": {
                                                            "function": {
                                                              "application": {
                                                                "function": {
                                                                  "application": {
                                                                    "function": {
                                                                      "typeApplication": {
                                                                        "body": {
                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.optionals.match"}, "type": {"variable": "hydra.core.model.LiteralType"}}},
                                                                        "type": {"optional": {"variable": "hydra.core.model.Type"}}}},
                                                                    "argument": {
                                                                      "application": {
                                                                        "function": {
                                                                          "application": {
                                                                            "function": {
                                                                              "typeApplication": {
                                                                                "body": {
                                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.maps.lookup"}, "type": {"variable": "hydra.core.model.LiteralType"}}},
                                                                                "type": {"variable": "hydra.core.model.LiteralType"}}},
                                                                            "argument": {"variable": "lt"}}},
                                                                        "argument": {"variable": "litmap"}}}}},
                                                                "argument": {
                                                                  "optional": {
                                                                    "inject": {
                                                                      "typeName": "hydra.core.model.Type",
                                                                      "field": {
                                                                        "name": "literal",
                                                                        "term": {"inject": {"typeName": "hydra.core.model.LiteralType", "field": {"name": "string", "term": "unit"}}}}}}}}},
                                                            "argument": {
                                                              "lambda": {
                                                                "parameter": "lt2",
                                                                "domain": {"variable": "hydra.core.model.LiteralType"},
                                                                "body": {
                                                                  "optional": {"inject": {"typeName": "hydra.core.model.Type", "field": {"name": "literal", "term": {"variable": "lt2"}}}}}}}}}}}}}}]}},
                                        "argument": {"variable": "typ"}}}}},
                                "typeScheme": {
                                  "variables": [],
                                  "body": {
                                    "function": {"domain": {"variable": "hydra.core.model.Type"}, "codomain": {"optional": {"variable": "hydra.core.model.Type"}}}},
                                  "constraints": []}},
                              {
                                "name": "forUnsupported",
                                "term": {
                                  "lambda": {
                                    "parameter": "typ",
                                    "domain": {"variable": "hydra.core.model.Type"},
                                    "body": {
                                      "let": {
                                        "bindings": [
                                          {
                                            "name": "tryAlts",
                                            "term": {
                                              "lambda": {
                                                "parameter": "alts",
                                                "domain": {"list": {"variable": "hydra.core.model.Type"}},
                                                "body": {
                                                  "application": {
                                                    "function": {
                                                      "application": {
                                                        "function": {
                                                          "typeApplication": {
                                                            "body": {
                                                              "typeApplication": {
                                                                "body": {"variable": "hydra.core.lib.optionals.bind"},
                                                                "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"list": {"variable": "hydra.core.model.Type"}}}}}},
                                                            "type": {"variable": "hydra.core.model.Type"}}},
                                                        "argument": {
                                                          "application": {
                                                            "function": {
                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.lists.uncons"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                            "argument": {"variable": "alts"}}}}},
                                                    "argument": {
                                                      "lambda": {
                                                        "parameter": "uc",
                                                        "domain": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                        "body": {
                                                          "application": {
                                                            "function": {
                                                              "application": {
                                                                "function": {
                                                                  "application": {
                                                                    "function": {
                                                                      "typeApplication": {
                                                                        "body": {
                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.optionals.match"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                        "type": {"optional": {"variable": "hydra.core.model.Type"}}}},
                                                                    "argument": {
                                                                      "application": {
                                                                        "function": {"variable": "tryType"},
                                                                        "argument": {
                                                                          "application": {
                                                                            "function": {
                                                                              "typeApplication": {
                                                                                "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                                "type": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                                            "argument": {"variable": "uc"}}}}}}},
                                                                "argument": {
                                                                  "application": {
                                                                    "function": {"variable": "tryAlts"},
                                                                    "argument": {
                                                                      "application": {
                                                                        "function": {
                                                                          "typeApplication": {
                                                                            "body": {
                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                            "type": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                                        "argument": {"variable": "uc"}}}}}}},
                                                            "argument": {"lambda": {"parameter": "t", "domain": {"variable": "hydra.core.model.Type"}, "body": {"optional": {"variable": "t"}}}}}}}}}}}},
                                            "typeScheme": {
                                              "variables": [],
                                              "body": {
                                                "function": {
                                                  "domain": {"list": {"variable": "hydra.core.model.Type"}},
                                                  "codomain": {"optional": {"variable": "hydra.core.model.Type"}}}},
                                              "constraints": []}}],
                                        "body": {
                                          "let": {
                                            "bindings": [
                                              {
                                                "name": "alts0",
                                                "term": {"application": {"function": {"variable": "hydra.core.adapt.typeAlternatives"}, "argument": {"variable": "typ"}}},
                                                "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Type"}}, "constraints": []}}],
                                            "body": {"application": {"function": {"variable": "tryAlts"}, "argument": {"variable": "alts0"}}}}}}}}},
                                "typeScheme": {
                                  "variables": [],
                                  "body": {
                                    "function": {"domain": {"variable": "hydra.core.model.Type"}, "codomain": {"optional": {"variable": "hydra.core.model.Type"}}}},
                                  "constraints": []}},
                              {
                                "name": "tryType",
                                "term": {
                                  "lambda": {
                                    "parameter": "typ",
                                    "domain": {"variable": "hydra.core.model.Type"},
                                    "body": {
                                      "let": {
                                        "bindings": [
                                          {
                                            "name": "supportedVariant",
                                            "term": {
                                              "application": {
                                                "function": {
                                                  "application": {
                                                    "function": {
                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.sets.member"}, "type": {"variable": "hydra.core.variants.TypeVariant"}}},
                                                    "argument": {"application": {"function": {"variable": "hydra.core.reflect.typeVariant"}, "argument": {"variable": "typ"}}}}},
                                                "argument": {
                                                  "application": {
                                                    "function": {"project": {"typeName": "hydra.core.coders.LanguageConstraints", "fieldName": "typeVariants"}},
                                                    "argument": {"variable": "constraints"}}}}},
                                            "typeScheme": {"variables": [], "body": {"literal": "boolean"}, "constraints": []}}],
                                        "body": {
                                          "application": {
                                            "function": {
                                              "application": {
                                                "function": {
                                                  "application": {
                                                    "function": {
                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.logic.ifElse"}, "type": {"optional": {"variable": "hydra.core.model.Type"}}}},
                                                    "argument": {"variable": "supportedVariant"}}},
                                                "argument": {"application": {"function": {"variable": "forSupported"}, "argument": {"variable": "typ"}}}}},
                                            "argument": {"application": {"function": {"variable": "forUnsupported"}, "argument": {"variable": "typ"}}}}}}}}},
                                "typeScheme": {
                                  "variables": [],
                                  "body": {
                                    "function": {"domain": {"variable": "hydra.core.model.Type"}, "codomain": {"optional": {"variable": "hydra.core.model.Type"}}}},
                                  "constraints": []}}],
                            "body": {
                              "let": {
                                "bindings": [
                                  {
                                    "name": "rewrite",
                                    "term": {
                                      "lambda": {
                                        "parameter": "recurse",
                                        "domain": {
                                          "function": {
                                            "domain": {"variable": "hydra.core.model.Type"},
                                            "codomain": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.model.Type"}}}}},
                                        "body": {
                                          "lambda": {
                                            "parameter": "typ",
                                            "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.Type"}}},
                                                        "type": {"variable": "hydra.core.model.Type"}}},
                                                    "argument": {"application": {"function": {"variable": "recurse"}, "argument": {"variable": "typ"}}}}},
                                                "argument": {
                                                  "lambda": {
                                                    "parameter": "type1",
                                                    "domain": {"variable": "hydra.core.model.Type"},
                                                    "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.Type"}}}}},
                                                                "argument": {"application": {"function": {"variable": "tryType"}, "argument": {"variable": "type1"}}}}},
                                                            "argument": {
                                                              "typeApplication": {
                                                                "body": {
                                                                  "typeApplication": {
                                                                    "body": {
                                                                      "either": {
                                                                        "left": {
                                                                          "inject": {
                                                                            "typeName": "hydra.core.errors.Error",
                                                                            "field": {
                                                                              "name": "other",
                                                                              "term": {
                                                                                "wrap": {
                                                                                  "typeName": "hydra.core.errors.OtherError",
                                                                                  "body": {
                                                                                    "application": {
                                                                                      "function": {
                                                                                        "application": {
                                                                                          "function": {"variable": "hydra.core.lib.strings.concat2"},
                                                                                          "argument": {"literal": {"string": "no alternatives for type: "}}}},
                                                                                      "argument": {"application": {"function": {"variable": "hydra.core.print.model.type"}, "argument": {"variable": "typ"}}}}}}}}}}}},
                                                                    "type": {"variable": "hydra.core.errors.Error"}}},
                                                                "type": {"variable": "hydra.core.model.Type"}}}}},
                                                        "argument": {
                                                          "lambda": {
                                                            "parameter": "type2",
                                                            "domain": {"variable": "hydra.core.model.Type"},
                                                            "body": {
                                                              "typeApplication": {
                                                                "body": {
                                                                  "typeApplication": {"body": {"either": {"right": {"variable": "type2"}}}, "type": {"variable": "hydra.core.errors.Error"}}},
                                                                "type": {"variable": "hydra.core.model.Type"}}}}}}}}}}}}}}},
                                    "typeScheme": {
                                      "variables": [],
                                      "body": {
                                        "function": {
                                          "domain": {
                                            "function": {
                                              "domain": {"variable": "hydra.core.model.Type"},
                                              "codomain": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.model.Type"}}}}},
                                          "codomain": {
                                            "function": {
                                              "domain": {"variable": "hydra.core.model.Type"},
                                              "codomain": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.model.Type"}}}}}}},
                                      "constraints": []}}],
                                "body": {
                                  "application": {
                                    "function": {
                                      "application": {
                                        "function": {
                                          "typeApplication": {"body": {"variable": "hydra.core.rewriting.rewriteTypeM"}, "type": {"variable": "hydra.core.errors.Error"}}},
                                        "argument": {"variable": "rewrite"}}},
                                    "argument": {"variable": "type0"}}}}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {"literal": {"string": "Adapt a type using the given language constraints"}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.adapt.adaptTypeForLanguage",
        "signature": {
          "typeParameters": [],
          "parameters": [
            {"name": "arg0", "type": {"variable": "hydra.core.coders.Language"}, "isLazy": false},
            {"name": "arg1", "type": {"variable": "hydra.core.model.Type"}, "isLazy": false}],
          "result": {"type": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.model.Type"}}}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "lang",
                "domain": {"variable": "hydra.core.coders.Language"},
                "body": {
                  "lambda": {
                    "parameter": "typ",
                    "domain": {"variable": "hydra.core.model.Type"},
                    "body": {
                      "let": {
                        "bindings": [
                          {
                            "name": "constraints",
                            "term": {
                              "application": {
                                "function": {"project": {"typeName": "hydra.core.coders.Language", "fieldName": "constraints"}},
                                "argument": {"variable": "lang"}}},
                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.coders.LanguageConstraints"}, "constraints": []}}],
                        "body": {
                          "let": {
                            "bindings": [
                              {
                                "name": "litmap",
                                "term": {
                                  "application": {"function": {"variable": "hydra.core.adapt.adaptLiteralTypesMap"}, "argument": {"variable": "constraints"}}},
                                "typeScheme": {
                                  "variables": [],
                                  "body": {"map": {"keys": {"variable": "hydra.core.model.LiteralType"}, "values": {"variable": "hydra.core.model.LiteralType"}}},
                                  "constraints": []}}],
                            "body": {
                              "application": {
                                "function": {
                                  "application": {
                                    "function": {"application": {"function": {"variable": "hydra.core.adapt.adaptType"}, "argument": {"variable": "constraints"}}},
                                    "argument": {"variable": "litmap"}}},
                                "argument": {"variable": "typ"}}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {"literal": {"string": "Adapt a type using the constraints of a given language"}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.adapt.adaptTypeScheme",
        "signature": {
          "typeParameters": [],
          "parameters": [
            {"name": "arg0", "type": {"variable": "hydra.core.coders.LanguageConstraints"}, "isLazy": false},
            {
              "name": "arg1",
              "type": {"map": {"keys": {"variable": "hydra.core.model.LiteralType"}, "values": {"variable": "hydra.core.model.LiteralType"}}},
              "isLazy": false},
            {"name": "arg2", "type": {"variable": "hydra.core.model.TypeScheme"}, "isLazy": false}],
          "result": {
            "type": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.model.TypeScheme"}}}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "constraints",
                "domain": {"variable": "hydra.core.coders.LanguageConstraints"},
                "body": {
                  "lambda": {
                    "parameter": "litmap",
                    "domain": {"map": {"keys": {"variable": "hydra.core.model.LiteralType"}, "values": {"variable": "hydra.core.model.LiteralType"}}},
                    "body": {
                      "lambda": {
                        "parameter": "ts0",
                        "domain": {"variable": "hydra.core.model.TypeScheme"},
                        "body": {
                          "let": {
                            "bindings": [
                              {
                                "name": "vars0",
                                "term": {
                                  "application": {
                                    "function": {"project": {"typeName": "hydra.core.model.TypeScheme", "fieldName": "variables"}},
                                    "argument": {"variable": "ts0"}}},
                                "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Name"}}, "constraints": []}}],
                            "body": {
                              "let": {
                                "bindings": [
                                  {
                                    "name": "t0",
                                    "term": {
                                      "application": {
                                        "function": {"project": {"typeName": "hydra.core.model.TypeScheme", "fieldName": "body"}},
                                        "argument": {"variable": "ts0"}}},
                                    "typeScheme": {"variables": [], "body": {"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.Error"}}},
                                                "type": {"variable": "hydra.core.model.Type"}}},
                                            "type": {"variable": "hydra.core.model.TypeScheme"}}},
                                        "argument": {
                                          "application": {
                                            "function": {
                                              "application": {
                                                "function": {"application": {"function": {"variable": "hydra.core.adapt.adaptType"}, "argument": {"variable": "constraints"}}},
                                                "argument": {"variable": "litmap"}}},
                                            "argument": {"variable": "t0"}}}}},
                                    "argument": {
                                      "lambda": {
                                        "parameter": "t1",
                                        "domain": {"variable": "hydra.core.model.Type"},
                                        "body": {
                                          "typeApplication": {
                                            "body": {
                                              "typeApplication": {
                                                "body": {
                                                  "either": {
                                                    "right": {
                                                      "record": {
                                                        "typeName": "hydra.core.model.TypeScheme",
                                                        "fields": [
                                                          {"name": "variables", "term": {"variable": "vars0"}},
                                                          {"name": "body", "term": {"variable": "t1"}},
                                                          {
                                                            "name": "constraints",
                                                            "term": {
                                                              "application": {
                                                                "function": {"project": {"typeName": "hydra.core.model.TypeScheme", "fieldName": "constraints"}},
                                                                "argument": {"variable": "ts0"}}}}]}}}},
                                                "type": {"variable": "hydra.core.errors.Error"}}},
                                            "type": {"variable": "hydra.core.model.TypeScheme"}}}}}}}}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {"literal": {"string": "Adapt a type scheme to the given language constraints, prior to inference"}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.adapt.composeCoders",
        "signature": {
          "typeParameters": [
            {"name": "t0", "constraints": []},
            {"name": "t1", "constraints": []},
            {"name": "t2", "constraints": []},
            {"name": "t3", "constraints": []}],
          "parameters": [
            {
              "name": "arg0",
              "type": {
                "application": {
                  "function": {
                    "application": {
                      "function": {"application": {"function": {"variable": "hydra.core.coders.Coder"}, "argument": {"variable": "t0"}}},
                      "argument": {"variable": "t1"}}},
                  "argument": {"variable": "t2"}}},
              "isLazy": false},
            {
              "name": "arg1",
              "type": {
                "application": {
                  "function": {
                    "application": {
                      "function": {"application": {"function": {"variable": "hydra.core.coders.Coder"}, "argument": {"variable": "t1"}}},
                      "argument": {"variable": "t3"}}},
                  "argument": {"variable": "t2"}}},
              "isLazy": false}],
          "result": {
            "type": {
              "application": {
                "function": {
                  "application": {
                    "function": {"application": {"function": {"variable": "hydra.core.coders.Coder"}, "argument": {"variable": "t0"}}},
                    "argument": {"variable": "t3"}}},
                "argument": {"variable": "t2"}}}}},
        "body": {
          "typeLambda": {
            "parameter": "t0",
            "body": {
              "typeLambda": {
                "parameter": "t1",
                "body": {
                  "typeLambda": {
                    "parameter": "t2",
                    "body": {
                      "typeLambda": {
                        "parameter": "t3",
                        "body": {
                          "annotated": {
                            "body": {
                              "lambda": {
                                "parameter": "c1",
                                "domain": {
                                  "application": {
                                    "function": {
                                      "application": {
                                        "function": {"application": {"function": {"variable": "hydra.core.coders.Coder"}, "argument": {"variable": "t0"}}},
                                        "argument": {"variable": "t1"}}},
                                    "argument": {"variable": "t2"}}},
                                "body": {
                                  "lambda": {
                                    "parameter": "c2",
                                    "domain": {
                                      "application": {
                                        "function": {
                                          "application": {
                                            "function": {"application": {"function": {"variable": "hydra.core.coders.Coder"}, "argument": {"variable": "t1"}}},
                                            "argument": {"variable": "t3"}}},
                                        "argument": {"variable": "t2"}}},
                                    "body": {
                                      "typeApplication": {
                                        "body": {
                                          "typeApplication": {
                                            "body": {
                                              "typeApplication": {
                                                "body": {
                                                  "record": {
                                                    "typeName": "hydra.core.coders.Coder",
                                                    "fields": [
                                                      {
                                                        "name": "encode",
                                                        "term": {
                                                          "lambda": {
                                                            "parameter": "a",
                                                            "domain": {"variable": "t0"},
                                                            "body": {
                                                              "application": {
                                                                "function": {
                                                                  "application": {
                                                                    "function": {
                                                                      "typeApplication": {
                                                                        "body": {
                                                                          "typeApplication": {
                                                                            "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.eithers.bind"}, "type": {"variable": "t2"}}},
                                                                            "type": {"variable": "t1"}}},
                                                                        "type": {"variable": "t3"}}},
                                                                    "argument": {
                                                                      "application": {
                                                                        "function": {
                                                                          "application": {
                                                                            "function": {
                                                                              "typeApplication": {
                                                                                "body": {
                                                                                  "typeApplication": {
                                                                                    "body": {
                                                                                      "typeApplication": {"body": {"project": {"typeName": "hydra.core.coders.Coder", "fieldName": "encode"}}, "type": {"variable": "t0"}}},
                                                                                    "type": {"variable": "t1"}}},
                                                                                "type": {"variable": "t2"}}},
                                                                            "argument": {"variable": "c1"}}},
                                                                        "argument": {"variable": "a"}}}}},
                                                                "argument": {
                                                                  "lambda": {
                                                                    "parameter": "b1",
                                                                    "domain": {"variable": "t1"},
                                                                    "body": {
                                                                      "application": {
                                                                        "function": {
                                                                          "application": {
                                                                            "function": {
                                                                              "typeApplication": {
                                                                                "body": {
                                                                                  "typeApplication": {
                                                                                    "body": {
                                                                                      "typeApplication": {"body": {"project": {"typeName": "hydra.core.coders.Coder", "fieldName": "encode"}}, "type": {"variable": "t1"}}},
                                                                                    "type": {"variable": "t3"}}},
                                                                                "type": {"variable": "t2"}}},
                                                                            "argument": {"variable": "c2"}}},
                                                                        "argument": {"variable": "b1"}}}}}}}}}},
                                                      {
                                                        "name": "decode",
                                                        "term": {
                                                          "lambda": {
                                                            "parameter": "c",
                                                            "domain": {"variable": "t3"},
                                                            "body": {
                                                              "application": {
                                                                "function": {
                                                                  "application": {
                                                                    "function": {
                                                                      "typeApplication": {
                                                                        "body": {
                                                                          "typeApplication": {
                                                                            "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.eithers.bind"}, "type": {"variable": "t2"}}},
                                                                            "type": {"variable": "t1"}}},
                                                                        "type": {"variable": "t0"}}},
                                                                    "argument": {
                                                                      "application": {
                                                                        "function": {
                                                                          "application": {
                                                                            "function": {
                                                                              "typeApplication": {
                                                                                "body": {
                                                                                  "typeApplication": {
                                                                                    "body": {
                                                                                      "typeApplication": {"body": {"project": {"typeName": "hydra.core.coders.Coder", "fieldName": "decode"}}, "type": {"variable": "t1"}}},
                                                                                    "type": {"variable": "t3"}}},
                                                                                "type": {"variable": "t2"}}},
                                                                            "argument": {"variable": "c2"}}},
                                                                        "argument": {"variable": "c"}}}}},
                                                                "argument": {
                                                                  "lambda": {
                                                                    "parameter": "b2",
                                                                    "domain": {"variable": "t1"},
                                                                    "body": {
                                                                      "application": {
                                                                        "function": {
                                                                          "application": {
                                                                            "function": {
                                                                              "typeApplication": {
                                                                                "body": {
                                                                                  "typeApplication": {
                                                                                    "body": {
                                                                                      "typeApplication": {"body": {"project": {"typeName": "hydra.core.coders.Coder", "fieldName": "decode"}}, "type": {"variable": "t0"}}},
                                                                                    "type": {"variable": "t1"}}},
                                                                                "type": {"variable": "t2"}}},
                                                                            "argument": {"variable": "c1"}}},
                                                                        "argument": {"variable": "b2"}}}}}}}}}}]}},
                                                "type": {"variable": "t0"}}},
                                            "type": {"variable": "t3"}}},
                                        "type": {"variable": "t2"}}}}}}},
                            "annotation": {
                              "map": [{"key": {"variable": "description"}, "value": {"literal": {"string": "Compose two coders into a single coder"}}}]}}}}}}}}}}}}},
    {
      "term": {
        "name": "hydra.core.adapt.dataGraphToDefinitions",
        "signature": {
          "typeParameters": [],
          "parameters": [
            {"name": "arg0", "type": {"variable": "hydra.core.coders.LanguageConstraints"}, "isLazy": false},
            {"name": "arg1", "type": {"literal": "boolean"}, "isLazy": false},
            {"name": "arg2", "type": {"literal": "boolean"}, "isLazy": false},
            {"name": "arg3", "type": {"literal": "boolean"}, "isLazy": false},
            {"name": "arg4", "type": {"literal": "boolean"}, "isLazy": false},
            {"name": "arg5", "type": {"list": {"variable": "hydra.core.model.Binding"}}, "isLazy": false},
            {"name": "arg6", "type": {"variable": "hydra.core.graph.Graph"}, "isLazy": false},
            {"name": "arg7", "type": {"list": {"variable": "hydra.core.packaging.ModuleName"}}, "isLazy": false},
            {"name": "arg8", "type": {"variable": "hydra.core.typing.InferenceContext"}, "isLazy": false}],
          "result": {
            "type": {
              "either": {
                "left": {"variable": "hydra.core.errors.Error"},
                "right": {
                  "pair": {
                    "first": {"variable": "hydra.core.graph.Graph"},
                    "second": {"list": {"list": {"variable": "hydra.core.packaging.TermDefinition"}}}}}}}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "constraints",
                "domain": {"variable": "hydra.core.coders.LanguageConstraints"},
                "body": {
                  "lambda": {
                    "parameter": "doInfer",
                    "domain": {"literal": "boolean"},
                    "body": {
                      "lambda": {
                        "parameter": "doExpand",
                        "domain": {"literal": "boolean"},
                        "body": {
                          "lambda": {
                            "parameter": "doHoistCaseStatements",
                            "domain": {"literal": "boolean"},
                            "body": {
                              "lambda": {
                                "parameter": "doHoistPolymorphicLetBindings",
                                "domain": {"literal": "boolean"},
                                "body": {
                                  "lambda": {
                                    "parameter": "originalBindings",
                                    "domain": {"list": {"variable": "hydra.core.model.Binding"}},
                                    "body": {
                                      "lambda": {
                                        "parameter": "graph0",
                                        "domain": {"variable": "hydra.core.graph.Graph"},
                                        "body": {
                                          "lambda": {
                                            "parameter": "namespaces",
                                            "domain": {"list": {"variable": "hydra.core.packaging.ModuleName"}},
                                            "body": {
                                              "lambda": {
                                                "parameter": "cx",
                                                "domain": {"variable": "hydra.core.typing.InferenceContext"},
                                                "body": {
                                                  "let": {
                                                    "bindings": [
                                                      {
                                                        "name": "namespacesSet",
                                                        "term": {
                                                          "application": {
                                                            "function": {
                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.sets.fromList"}, "type": {"variable": "hydra.core.packaging.ModuleName"}}},
                                                            "argument": {"variable": "namespaces"}}},
                                                        "typeScheme": {"variables": [], "body": {"set": {"variable": "hydra.core.packaging.ModuleName"}}, "constraints": []}}],
                                                    "body": {
                                                      "let": {
                                                        "bindings": [
                                                          {
                                                            "name": "isParentBinding",
                                                            "term": {
                                                              "lambda": {
                                                                "parameter": "b",
                                                                "domain": {"variable": "hydra.core.model.Binding"},
                                                                "body": {
                                                                  "application": {
                                                                    "function": {
                                                                      "application": {
                                                                        "function": {
                                                                          "application": {
                                                                            "function": {
                                                                              "typeApplication": {
                                                                                "body": {
                                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.optionals.match"}, "type": {"variable": "hydra.core.packaging.ModuleName"}}},
                                                                                "type": {"literal": "boolean"}}},
                                                                            "argument": {
                                                                              "application": {
                                                                                "function": {"variable": "hydra.core.names.moduleNameOf"},
                                                                                "argument": {
                                                                                  "application": {"function": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "name"}}, "argument": {"variable": "b"}}}}}}},
                                                                        "argument": {"literal": {"boolean": false}}}},
                                                                    "argument": {
                                                                      "lambda": {
                                                                        "parameter": "ns",
                                                                        "domain": {"variable": "hydra.core.packaging.ModuleName"},
                                                                        "body": {
                                                                          "application": {
                                                                            "function": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.sets.member"}, "type": {"variable": "hydra.core.packaging.ModuleName"}}},
                                                                                "argument": {"variable": "ns"}}},
                                                                            "argument": {"variable": "namespacesSet"}}}}}}}}},
                                                            "typeScheme": {
                                                              "variables": [],
                                                              "body": {"function": {"domain": {"variable": "hydra.core.model.Binding"}, "codomain": {"literal": "boolean"}}},
                                                              "constraints": []}}],
                                                        "body": {
                                                          "let": {
                                                            "bindings": [
                                                              {
                                                                "name": "hoistCases",
                                                                "term": {
                                                                  "lambda": {
                                                                    "parameter": "bindings",
                                                                    "domain": {"list": {"variable": "hydra.core.model.Binding"}},
                                                                    "body": {
                                                                      "let": {
                                                                        "bindings": [
                                                                          {
                                                                            "name": "stripped",
                                                                            "term": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "application": {
                                                                                    "function": {
                                                                                      "typeApplication": {
                                                                                        "body": {
                                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.model.Binding"}}},
                                                                                        "type": {"variable": "hydra.core.model.Binding"}}},
                                                                                    "argument": {
                                                                                      "lambda": {
                                                                                        "parameter": "b",
                                                                                        "domain": {"variable": "hydra.core.model.Binding"},
                                                                                        "body": {
                                                                                          "record": {
                                                                                            "typeName": "hydra.core.model.Binding",
                                                                                            "fields": [
                                                                                              {
                                                                                                "name": "name",
                                                                                                "term": {
                                                                                                  "application": {"function": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "name"}}, "argument": {"variable": "b"}}}},
                                                                                              {
                                                                                                "name": "term",
                                                                                                "term": {
                                                                                                  "application": {
                                                                                                    "function": {"variable": "hydra.core.strip.stripTypeLambdas"},
                                                                                                    "argument": {
                                                                                                      "application": {"function": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "term"}}, "argument": {"variable": "b"}}}}}},
                                                                                              {
                                                                                                "name": "typeScheme",
                                                                                                "term": {
                                                                                                  "application": {
                                                                                                    "function": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "typeScheme"}},
                                                                                                    "argument": {"variable": "b"}}}}]}}}}}},
                                                                                "argument": {"variable": "bindings"}}},
                                                                            "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Binding"}}, "constraints": []}}],
                                                                        "body": {
                                                                          "let": {
                                                                            "bindings": [
                                                                              {
                                                                                "name": "term0",
                                                                                "term": {
                                                                                  "inject": {
                                                                                    "typeName": "hydra.core.model.Term",
                                                                                    "field": {
                                                                                      "name": "let",
                                                                                      "term": {
                                                                                        "record": {
                                                                                          "typeName": "hydra.core.model.Let",
                                                                                          "fields": [
                                                                                            {"name": "bindings", "term": {"variable": "stripped"}},
                                                                                            {"name": "body", "term": {"inject": {"typeName": "hydra.core.model.Term", "field": {"name": "unit", "term": "unit"}}}}]}}}}},
                                                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                                                            "body": {
                                                                              "let": {
                                                                                "bindings": [
                                                                                  {
                                                                                    "name": "unshadowed0",
                                                                                    "term": {
                                                                                      "application": {
                                                                                        "function": {"variable": "hydra.core.environment.termAsBindings"},
                                                                                        "argument": {"application": {"function": {"variable": "hydra.core.variables.unshadowVariables"}, "argument": {"variable": "term0"}}}}},
                                                                                    "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Binding"}}, "constraints": []}}],
                                                                                "body": {
                                                                                  "let": {
                                                                                    "bindings": [
                                                                                      {
                                                                                        "name": "hoisted",
                                                                                        "term": {
                                                                                          "application": {"function": {"variable": "hydra.core.hoisting.hoistCaseStatementsInGraph"}, "argument": {"variable": "unshadowed0"}}},
                                                                                        "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Binding"}}, "constraints": []}}],
                                                                                    "body": {
                                                                                      "let": {
                                                                                        "bindings": [
                                                                                          {
                                                                                            "name": "term1",
                                                                                            "term": {
                                                                                              "inject": {
                                                                                                "typeName": "hydra.core.model.Term",
                                                                                                "field": {
                                                                                                  "name": "let",
                                                                                                  "term": {
                                                                                                    "record": {
                                                                                                      "typeName": "hydra.core.model.Let",
                                                                                                      "fields": [
                                                                                                        {"name": "bindings", "term": {"variable": "hoisted"}},
                                                                                                        {"name": "body", "term": {"inject": {"typeName": "hydra.core.model.Term", "field": {"name": "unit", "term": "unit"}}}}]}}}}},
                                                                                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                                                                        "body": {
                                                                                          "application": {
                                                                                            "function": {"variable": "hydra.core.environment.termAsBindings"},
                                                                                            "argument": {"application": {"function": {"variable": "hydra.core.variables.unshadowVariables"}, "argument": {"variable": "term1"}}}}}}}}}}}}}}}}},
                                                                "typeScheme": {
                                                                  "variables": [],
                                                                  "body": {
                                                                    "function": {
                                                                      "domain": {"list": {"variable": "hydra.core.model.Binding"}},
                                                                      "codomain": {"list": {"variable": "hydra.core.model.Binding"}}}},
                                                                  "constraints": []}}],
                                                            "body": {
                                                              "let": {
                                                                "bindings": [
                                                                  {
                                                                    "name": "hoistPoly",
                                                                    "term": {
                                                                      "lambda": {
                                                                        "parameter": "bindings",
                                                                        "domain": {"list": {"variable": "hydra.core.model.Binding"}},
                                                                        "body": {
                                                                          "let": {
                                                                            "bindings": [
                                                                              {
                                                                                "name": "letBefore",
                                                                                "term": {
                                                                                  "record": {
                                                                                    "typeName": "hydra.core.model.Let",
                                                                                    "fields": [
                                                                                      {"name": "bindings", "term": {"variable": "bindings"}},
                                                                                      {"name": "body", "term": {"inject": {"typeName": "hydra.core.model.Term", "field": {"name": "unit", "term": "unit"}}}}]}},
                                                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Let"}, "constraints": []}}],
                                                                            "body": {
                                                                              "let": {
                                                                                "bindings": [
                                                                                  {
                                                                                    "name": "letAfter",
                                                                                    "term": {
                                                                                      "application": {
                                                                                        "function": {
                                                                                          "application": {
                                                                                            "function": {"variable": "hydra.core.hoisting.hoistPolymorphicLetBindings"},
                                                                                            "argument": {"variable": "isParentBinding"}}},
                                                                                        "argument": {"variable": "letBefore"}}},
                                                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Let"}, "constraints": []}}],
                                                                                "body": {
                                                                                  "application": {
                                                                                    "function": {"project": {"typeName": "hydra.core.model.Let", "fieldName": "bindings"}},
                                                                                    "argument": {"variable": "letAfter"}}}}}}}}},
                                                                    "typeScheme": {
                                                                      "variables": [],
                                                                      "body": {
                                                                        "function": {
                                                                          "domain": {"list": {"variable": "hydra.core.model.Binding"}},
                                                                          "codomain": {"list": {"variable": "hydra.core.model.Binding"}}}},
                                                                      "constraints": []}}],
                                                                "body": {
                                                                  "let": {
                                                                    "bindings": [
                                                                      {
                                                                        "name": "qualifyUntyped",
                                                                        "term": {
                                                                          "lambda": {
                                                                            "parameter": "b",
                                                                            "domain": {"variable": "hydra.core.model.Binding"},
                                                                            "body": {
                                                                              "let": {
                                                                                "bindings": [
                                                                                  {
                                                                                    "name": "nm",
                                                                                    "term": {
                                                                                      "application": {
                                                                                        "function": {"unwrap": "hydra.core.model.Name"},
                                                                                        "argument": {
                                                                                          "application": {"function": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "name"}}, "argument": {"variable": "b"}}}}},
                                                                                    "typeScheme": {"variables": [], "body": {"literal": "string"}, "constraints": []}}],
                                                                                "body": {
                                                                                  "application": {
                                                                                    "function": {
                                                                                      "application": {
                                                                                        "function": {
                                                                                          "application": {
                                                                                            "function": {
                                                                                              "typeApplication": {
                                                                                                "body": {
                                                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.optionals.match"}, "type": {"variable": "hydra.core.packaging.ModuleName"}}},
                                                                                                "type": {"literal": "string"}}},
                                                                                            "argument": {
                                                                                              "application": {
                                                                                                "function": {"variable": "hydra.core.names.moduleNameOf"},
                                                                                                "argument": {
                                                                                                  "application": {"function": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "name"}}, "argument": {"variable": "b"}}}}}}},
                                                                                        "argument": {
                                                                                          "application": {
                                                                                            "function": {
                                                                                              "application": {"function": {"variable": "hydra.core.lib.strings.concat2"}, "argument": {"literal": {"string": "(no module) "}}}},
                                                                                            "argument": {"variable": "nm"}}}}},
                                                                                    "argument": {
                                                                                      "lambda": {
                                                                                        "parameter": "ns",
                                                                                        "domain": {"variable": "hydra.core.packaging.ModuleName"},
                                                                                        "body": {
                                                                                          "application": {
                                                                                            "function": {"variable": "hydra.core.lib.strings.concat"},
                                                                                            "argument": {
                                                                                              "list": [
                                                                                                {"application": {"function": {"unwrap": "hydra.core.packaging.ModuleName"}, "argument": {"variable": "ns"}}},
                                                                                                {"literal": {"string": " :: "}},
                                                                                                {"variable": "nm"}]}}}}}}}}}}},
                                                                        "typeScheme": {
                                                                          "variables": [],
                                                                          "body": {"function": {"domain": {"variable": "hydra.core.model.Binding"}, "codomain": {"literal": "string"}}},
                                                                          "constraints": []}}],
                                                                    "body": {
                                                                      "let": {
                                                                        "bindings": [
                                                                          {
                                                                            "name": "checkBindingsTyped",
                                                                            "term": {
                                                                              "lambda": {
                                                                                "parameter": "debugLabel",
                                                                                "domain": {"literal": "string"},
                                                                                "body": {
                                                                                  "lambda": {
                                                                                    "parameter": "bindings",
                                                                                    "domain": {"list": {"variable": "hydra.core.model.Binding"}},
                                                                                    "body": {
                                                                                      "let": {
                                                                                        "bindings": [
                                                                                          {
                                                                                            "name": "untypedBindings",
                                                                                            "term": {
                                                                                              "application": {
                                                                                                "function": {
                                                                                                  "application": {
                                                                                                    "function": {
                                                                                                      "typeApplication": {
                                                                                                        "body": {
                                                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.model.Binding"}}},
                                                                                                        "type": {"literal": "string"}}},
                                                                                                    "argument": {"variable": "qualifyUntyped"}}},
                                                                                                "argument": {
                                                                                                  "application": {
                                                                                                    "function": {
                                                                                                      "application": {
                                                                                                        "function": {
                                                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.lists.filter"}, "type": {"variable": "hydra.core.model.Binding"}}},
                                                                                                        "argument": {
                                                                                                          "lambda": {
                                                                                                            "parameter": "b",
                                                                                                            "domain": {"variable": "hydra.core.model.Binding"},
                                                                                                            "body": {
                                                                                                              "application": {
                                                                                                                "function": {"variable": "hydra.core.lib.logic.not"},
                                                                                                                "argument": {
                                                                                                                  "application": {
                                                                                                                    "function": {
                                                                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.optionals.isGiven"}, "type": {"variable": "hydra.core.model.TypeScheme"}}},
                                                                                                                    "argument": {
                                                                                                                      "application": {
                                                                                                                        "function": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "typeScheme"}},
                                                                                                                        "argument": {"variable": "b"}}}}}}}}}}},
                                                                                                    "argument": {"variable": "bindings"}}}}},
                                                                                            "typeScheme": {"variables": [], "body": {"list": {"literal": "string"}}, "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": {"list": {"variable": "hydra.core.model.Binding"}}}}}},
                                                                                                    "argument": {
                                                                                                      "application": {
                                                                                                        "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.isEmpty"}, "type": {"literal": "string"}}},
                                                                                                        "argument": {"variable": "untypedBindings"}}}}},
                                                                                                "argument": {
                                                                                                  "typeApplication": {
                                                                                                    "body": {
                                                                                                      "typeApplication": {"body": {"either": {"right": {"variable": "bindings"}}}, "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                                    "type": {"list": {"variable": "hydra.core.model.Binding"}}}}}},
                                                                                            "argument": {
                                                                                              "typeApplication": {
                                                                                                "body": {
                                                                                                  "typeApplication": {
                                                                                                    "body": {
                                                                                                      "either": {
                                                                                                        "left": {
                                                                                                          "inject": {
                                                                                                            "typeName": "hydra.core.errors.Error",
                                                                                                            "field": {
                                                                                                              "name": "other",
                                                                                                              "term": {
                                                                                                                "wrap": {
                                                                                                                  "typeName": "hydra.core.errors.OtherError",
                                                                                                                  "body": {
                                                                                                                    "application": {
                                                                                                                      "function": {"variable": "hydra.core.lib.strings.concat"},
                                                                                                                      "argument": {
                                                                                                                        "list": [
                                                                                                                          {"literal": {"string": "Found "}},
                                                                                                                          {
                                                                                                                            "application": {
                                                                                                                              "function": {"variable": "hydra.core.lib.literals.printInt32"},
                                                                                                                              "argument": {
                                                                                                                                "application": {
                                                                                                                                  "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.length"}, "type": {"literal": "string"}}},
                                                                                                                                  "argument": {"variable": "untypedBindings"}}}}},
                                                                                                                          {"literal": {"string": " untyped binding(s) ("}},
                                                                                                                          {"variable": "debugLabel"},
                                                                                                                          {"literal": {"string": "); each must carry a type scheme at this stage. "}},
                                                                                                                          {"literal": {"string": "This usually means stale dist/json field shapes after a kernel record rename "}},
                                                                                                                          {"literal": {"string": "(regenerate the affected package's JSON). Offending bindings (module :: name): "}},
                                                                                                                          {
                                                                                                                            "application": {
                                                                                                                              "function": {"application": {"function": {"variable": "hydra.core.lib.strings.join"}, "argument": {"literal": {"string": ", "}}}},
                                                                                                                              "argument": {"variable": "untypedBindings"}}}]}}}}}}}}}},
                                                                                                    "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                                "type": {"list": {"variable": "hydra.core.model.Binding"}}}}}}}}}}}},
                                                                            "typeScheme": {
                                                                              "variables": [],
                                                                              "body": {
                                                                                "function": {
                                                                                  "domain": {"literal": "string"},
                                                                                  "codomain": {
                                                                                    "function": {
                                                                                      "domain": {"list": {"variable": "hydra.core.model.Binding"}},
                                                                                      "codomain": {
                                                                                        "either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"list": {"variable": "hydra.core.model.Binding"}}}}}}}},
                                                                              "constraints": []}}],
                                                                        "body": {
                                                                          "let": {
                                                                            "bindings": [
                                                                              {
                                                                                "name": "normalizeBindings",
                                                                                "term": {
                                                                                  "lambda": {
                                                                                    "parameter": "bindings",
                                                                                    "domain": {"list": {"variable": "hydra.core.model.Binding"}},
                                                                                    "body": {
                                                                                      "application": {
                                                                                        "function": {
                                                                                          "application": {
                                                                                            "function": {
                                                                                              "typeApplication": {
                                                                                                "body": {
                                                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.model.Binding"}}},
                                                                                                "type": {"variable": "hydra.core.model.Binding"}}},
                                                                                            "argument": {
                                                                                              "lambda": {
                                                                                                "parameter": "b",
                                                                                                "domain": {"variable": "hydra.core.model.Binding"},
                                                                                                "body": {
                                                                                                  "record": {
                                                                                                    "typeName": "hydra.core.model.Binding",
                                                                                                    "fields": [
                                                                                                      {
                                                                                                        "name": "name",
                                                                                                        "term": {
                                                                                                          "application": {"function": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "name"}}, "argument": {"variable": "b"}}}},
                                                                                                      {
                                                                                                        "name": "term",
                                                                                                        "term": {
                                                                                                          "application": {
                                                                                                            "function": {"variable": "hydra.core.adapt.pushTypeAppsInward"},
                                                                                                            "argument": {
                                                                                                              "application": {"function": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "term"}}, "argument": {"variable": "b"}}}}}},
                                                                                                      {
                                                                                                        "name": "typeScheme",
                                                                                                        "term": {
                                                                                                          "application": {
                                                                                                            "function": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "typeScheme"}},
                                                                                                            "argument": {"variable": "b"}}}}]}}}}}},
                                                                                        "argument": {"variable": "bindings"}}}}},
                                                                                "typeScheme": {
                                                                                  "variables": [],
                                                                                  "body": {
                                                                                    "function": {
                                                                                      "domain": {"list": {"variable": "hydra.core.model.Binding"}},
                                                                                      "codomain": {"list": {"variable": "hydra.core.model.Binding"}}}},
                                                                                  "constraints": []}}],
                                                                            "body": {
                                                                              "let": {
                                                                                "bindings": [
                                                                                  {
                                                                                    "name": "rebuildGraph",
                                                                                    "term": {
                                                                                      "lambda": {
                                                                                        "parameter": "bindings",
                                                                                        "domain": {"list": {"variable": "hydra.core.model.Binding"}},
                                                                                        "body": {
                                                                                          "let": {
                                                                                            "bindings": [
                                                                                              {
                                                                                                "name": "g",
                                                                                                "term": {
                                                                                                  "application": {
                                                                                                    "function": {
                                                                                                      "application": {
                                                                                                        "function": {"application": {"function": {"variable": "hydra.core.lexical.buildGraph"}, "argument": {"variable": "bindings"}}},
                                                                                                        "argument": {
                                                                                                          "typeApplication": {
                                                                                                            "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.empty"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                            "type": {"optional": {"variable": "hydra.core.model.Term"}}}}}},
                                                                                                    "argument": {
                                                                                                      "application": {
                                                                                                        "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "primitives"}},
                                                                                                        "argument": {"variable": "graph0"}}}}},
                                                                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.graph.Graph"}, "constraints": []}}],
                                                                                            "body": {
                                                                                              "record": {
                                                                                                "typeName": "hydra.core.graph.Graph",
                                                                                                "fields": [
                                                                                                  {
                                                                                                    "name": "boundTerms",
                                                                                                    "term": {
                                                                                                      "application": {
                                                                                                        "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "boundTerms"}},
                                                                                                        "argument": {"variable": "g"}}}},
                                                                                                  {
                                                                                                    "name": "boundTypes",
                                                                                                    "term": {
                                                                                                      "application": {
                                                                                                        "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "boundTypes"}},
                                                                                                        "argument": {"variable": "g"}}}},
                                                                                                  {
                                                                                                    "name": "classConstraints",
                                                                                                    "term": {
                                                                                                      "application": {
                                                                                                        "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "classConstraints"}},
                                                                                                        "argument": {"variable": "g"}}}},
                                                                                                  {
                                                                                                    "name": "lambdaVariables",
                                                                                                    "term": {
                                                                                                      "application": {
                                                                                                        "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "lambdaVariables"}},
                                                                                                        "argument": {"variable": "g"}}}},
                                                                                                  {
                                                                                                    "name": "metadata",
                                                                                                    "term": {
                                                                                                      "application": {
                                                                                                        "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "metadata"}},
                                                                                                        "argument": {"variable": "g"}}}},
                                                                                                  {
                                                                                                    "name": "primitives",
                                                                                                    "term": {
                                                                                                      "application": {
                                                                                                        "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "primitives"}},
                                                                                                        "argument": {"variable": "g"}}}},
                                                                                                  {
                                                                                                    "name": "schemaTypes",
                                                                                                    "term": {
                                                                                                      "application": {
                                                                                                        "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "schemaTypes"}},
                                                                                                        "argument": {"variable": "graph0"}}}},
                                                                                                  {
                                                                                                    "name": "typeVariables",
                                                                                                    "term": {
                                                                                                      "application": {
                                                                                                        "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "typeVariables"}},
                                                                                                        "argument": {"variable": "g"}}}}]}}}}}},
                                                                                    "typeScheme": {
                                                                                      "variables": [],
                                                                                      "body": {
                                                                                        "function": {"domain": {"list": {"variable": "hydra.core.model.Binding"}}, "codomain": {"variable": "hydra.core.graph.Graph"}}},
                                                                                      "constraints": []}}],
                                                                                "body": {
                                                                                  "let": {
                                                                                    "bindings": [
                                                                                      {
                                                                                        "name": "bins0",
                                                                                        "term": {"variable": "originalBindings"},
                                                                                        "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Binding"}}, "constraints": []}}],
                                                                                    "body": {
                                                                                      "let": {
                                                                                        "bindings": [
                                                                                          {
                                                                                            "name": "bins1",
                                                                                            "term": {
                                                                                              "application": {
                                                                                                "function": {
                                                                                                  "application": {
                                                                                                    "function": {
                                                                                                      "application": {
                                                                                                        "function": {
                                                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.logic.ifElse"}, "type": {"list": {"variable": "hydra.core.model.Binding"}}}},
                                                                                                        "argument": {"variable": "doHoistCaseStatements"}}},
                                                                                                    "argument": {"application": {"function": {"variable": "hoistCases"}, "argument": {"variable": "bins0"}}}}},
                                                                                                "argument": {"variable": "bins0"}}},
                                                                                            "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Binding"}}, "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.Binding"}}}},
                                                                                                    "type": {
                                                                                                      "pair": {
                                                                                                        "first": {"variable": "hydra.core.graph.Graph"},
                                                                                                        "second": {"list": {"list": {"variable": "hydra.core.packaging.TermDefinition"}}}}}}},
                                                                                                "argument": {
                                                                                                  "application": {
                                                                                                    "function": {
                                                                                                      "application": {
                                                                                                        "function": {
                                                                                                          "application": {
                                                                                                            "function": {
                                                                                                              "typeApplication": {
                                                                                                                "body": {"variable": "hydra.core.lib.logic.ifElse"},
                                                                                                                "type": {
                                                                                                                  "either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"list": {"variable": "hydra.core.model.Binding"}}}}}},
                                                                                                            "argument": {"variable": "doInfer"}}},
                                                                                                        "argument": {
                                                                                                          "application": {
                                                                                                            "function": {
                                                                                                              "application": {
                                                                                                                "function": {
                                                                                                                  "typeApplication": {
                                                                                                                    "body": {
                                                                                                                      "typeApplication": {
                                                                                                                        "body": {
                                                                                                                          "typeApplication": {
                                                                                                                            "body": {"variable": "hydra.core.lib.eithers.map"},
                                                                                                                            "type": {
                                                                                                                              "pair": {
                                                                                                                                "first": {
                                                                                                                                  "pair": {"first": {"variable": "hydra.core.graph.Graph"}, "second": {"list": {"variable": "hydra.core.model.Binding"}}}},
                                                                                                                                "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                                                        "type": {"list": {"variable": "hydra.core.model.Binding"}}}},
                                                                                                                    "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                                                "argument": {
                                                                                                                  "lambda": {
                                                                                                                    "parameter": "result",
                                                                                                                    "domain": {
                                                                                                                      "pair": {
                                                                                                                        "first": {
                                                                                                                          "pair": {"first": {"variable": "hydra.core.graph.Graph"}, "second": {"list": {"variable": "hydra.core.model.Binding"}}}},
                                                                                                                        "second": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                                                    "body": {
                                                                                                                      "application": {
                                                                                                                        "function": {
                                                                                                                          "typeApplication": {
                                                                                                                            "body": {
                                                                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"variable": "hydra.core.graph.Graph"}}},
                                                                                                                            "type": {"list": {"variable": "hydra.core.model.Binding"}}}},
                                                                                                                        "argument": {
                                                                                                                          "application": {
                                                                                                                            "function": {
                                                                                                                              "typeApplication": {
                                                                                                                                "body": {
                                                                                                                                  "typeApplication": {
                                                                                                                                    "body": {"variable": "hydra.core.lib.pairs.first"},
                                                                                                                                    "type": {
                                                                                                                                      "pair": {"first": {"variable": "hydra.core.graph.Graph"}, "second": {"list": {"variable": "hydra.core.model.Binding"}}}}}},
                                                                                                                                "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                                                            "argument": {"variable": "result"}}}}}}}}},
                                                                                                            "argument": {
                                                                                                              "application": {
                                                                                                                "function": {
                                                                                                                  "application": {
                                                                                                                    "function": {"application": {"function": {"variable": "hydra.core.inference.inferGraphTypes"}, "argument": {"variable": "cx"}}},
                                                                                                                    "argument": {"variable": "bins1"}}},
                                                                                                                "argument": {"application": {"function": {"variable": "rebuildGraph"}, "argument": {"variable": "bins1"}}}}}}}}},
                                                                                                    "argument": {
                                                                                                      "application": {
                                                                                                        "function": {
                                                                                                          "application": {"function": {"variable": "checkBindingsTyped"}, "argument": {"literal": {"string": "after case hoisting"}}}},
                                                                                                        "argument": {"variable": "bins1"}}}}}}},
                                                                                            "argument": {
                                                                                              "lambda": {
                                                                                                "parameter": "bins2",
                                                                                                "domain": {"list": {"variable": "hydra.core.model.Binding"}},
                                                                                                "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.Binding"}}}},
                                                                                                            "type": {
                                                                                                              "pair": {
                                                                                                                "first": {"variable": "hydra.core.graph.Graph"},
                                                                                                                "second": {"list": {"list": {"variable": "hydra.core.packaging.TermDefinition"}}}}}}},
                                                                                                        "argument": {
                                                                                                          "application": {
                                                                                                            "function": {
                                                                                                              "application": {
                                                                                                                "function": {
                                                                                                                  "application": {
                                                                                                                    "function": {
                                                                                                                      "typeApplication": {
                                                                                                                        "body": {"variable": "hydra.core.lib.logic.ifElse"},
                                                                                                                        "type": {
                                                                                                                          "either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"list": {"variable": "hydra.core.model.Binding"}}}}}},
                                                                                                                    "argument": {"variable": "doHoistPolymorphicLetBindings"}}},
                                                                                                                "argument": {
                                                                                                                  "application": {
                                                                                                                    "function": {
                                                                                                                      "application": {"function": {"variable": "checkBindingsTyped"}, "argument": {"literal": {"string": "after let hoisting"}}}},
                                                                                                                    "argument": {"application": {"function": {"variable": "hoistPoly"}, "argument": {"variable": "bins2"}}}}}}},
                                                                                                            "argument": {
                                                                                                              "typeApplication": {
                                                                                                                "body": {
                                                                                                                  "typeApplication": {"body": {"either": {"right": {"variable": "bins2"}}}, "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                                                "type": {"list": {"variable": "hydra.core.model.Binding"}}}}}}}},
                                                                                                    "argument": {
                                                                                                      "lambda": {
                                                                                                        "parameter": "bins3",
                                                                                                        "domain": {"list": {"variable": "hydra.core.model.Binding"}},
                                                                                                        "body": {
                                                                                                          "application": {
                                                                                                            "function": {
                                                                                                              "application": {
                                                                                                                "function": {
                                                                                                                  "typeApplication": {
                                                                                                                    "body": {
                                                                                                                      "typeApplication": {
                                                                                                                        "body": {
                                                                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.eithers.bind"}, "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                                                        "type": {
                                                                                                                          "pair": {"first": {"variable": "hydra.core.graph.Graph"}, "second": {"list": {"variable": "hydra.core.model.Binding"}}}}}},
                                                                                                                    "type": {
                                                                                                                      "pair": {
                                                                                                                        "first": {"variable": "hydra.core.graph.Graph"},
                                                                                                                        "second": {"list": {"list": {"variable": "hydra.core.packaging.TermDefinition"}}}}}}},
                                                                                                                "argument": {
                                                                                                                  "application": {
                                                                                                                    "function": {
                                                                                                                      "application": {
                                                                                                                        "function": {
                                                                                                                          "application": {
                                                                                                                            "function": {
                                                                                                                              "application": {
                                                                                                                                "function": {
                                                                                                                                  "application": {
                                                                                                                                    "function": {
                                                                                                                                      "typeApplication": {"body": {"variable": "hydra.core.adapt.adaptDataGraph"}, "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                                                                    "argument": {"variable": "constraints"}}},
                                                                                                                                "argument": {"variable": "doExpand"}}},
                                                                                                                            "argument": {"variable": "bins3"}}},
                                                                                                                        "argument": {"variable": "cx"}}},
                                                                                                                    "argument": {"application": {"function": {"variable": "rebuildGraph"}, "argument": {"variable": "bins3"}}}}}}},
                                                                                                            "argument": {
                                                                                                              "lambda": {
                                                                                                                "parameter": "adaptResult",
                                                                                                                "domain": {
                                                                                                                  "pair": {"first": {"variable": "hydra.core.graph.Graph"}, "second": {"list": {"variable": "hydra.core.model.Binding"}}}},
                                                                                                                "body": {
                                                                                                                  "let": {
                                                                                                                    "bindings": [
                                                                                                                      {
                                                                                                                        "name": "adapted",
                                                                                                                        "term": {
                                                                                                                          "application": {
                                                                                                                            "function": {
                                                                                                                              "typeApplication": {
                                                                                                                                "body": {
                                                                                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"variable": "hydra.core.graph.Graph"}}},
                                                                                                                                "type": {"list": {"variable": "hydra.core.model.Binding"}}}},
                                                                                                                            "argument": {"variable": "adaptResult"}}},
                                                                                                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.graph.Graph"}, "constraints": []}}],
                                                                                                                    "body": {
                                                                                                                      "let": {
                                                                                                                        "bindings": [
                                                                                                                          {
                                                                                                                            "name": "adaptedBindings",
                                                                                                                            "term": {
                                                                                                                              "application": {
                                                                                                                                "function": {
                                                                                                                                  "typeApplication": {
                                                                                                                                    "body": {
                                                                                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"variable": "hydra.core.graph.Graph"}}},
                                                                                                                                    "type": {"list": {"variable": "hydra.core.model.Binding"}}}},
                                                                                                                                "argument": {"variable": "adaptResult"}}},
                                                                                                                            "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Binding"}}, "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.Binding"}}}},
                                                                                                                                    "type": {
                                                                                                                                      "pair": {
                                                                                                                                        "first": {"variable": "hydra.core.graph.Graph"},
                                                                                                                                        "second": {"list": {"list": {"variable": "hydra.core.packaging.TermDefinition"}}}}}}},
                                                                                                                                "argument": {
                                                                                                                                  "application": {
                                                                                                                                    "function": {
                                                                                                                                      "application": {"function": {"variable": "checkBindingsTyped"}, "argument": {"literal": {"string": "after adaptation"}}}},
                                                                                                                                    "argument": {"variable": "adaptedBindings"}}}}},
                                                                                                                            "argument": {
                                                                                                                              "lambda": {
                                                                                                                                "parameter": "bins4",
                                                                                                                                "domain": {"list": {"variable": "hydra.core.model.Binding"}},
                                                                                                                                "body": {
                                                                                                                                  "let": {
                                                                                                                                    "bindings": [
                                                                                                                                      {
                                                                                                                                        "name": "bins5Raw",
                                                                                                                                        "term": {"application": {"function": {"variable": "normalizeBindings"}, "argument": {"variable": "bins4"}}},
                                                                                                                                        "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Binding"}}, "constraints": []}}],
                                                                                                                                    "body": {
                                                                                                                                      "let": {
                                                                                                                                        "bindings": [
                                                                                                                                          {
                                                                                                                                            "name": "peelOne",
                                                                                                                                            "term": {
                                                                                                                                              "lambda": {
                                                                                                                                                "parameter": "t",
                                                                                                                                                "domain": {"variable": "hydra.core.model.Term"},
                                                                                                                                                "body": {
                                                                                                                                                  "application": {
                                                                                                                                                    "function": {
                                                                                                                                                      "cases": {
                                                                                                                                                        "typeName": "hydra.core.model.Term",
                                                                                                                                                        "default": {"variable": "t"},
                                                                                                                                                        "cases": [
                                                                                                                                                          {
                                                                                                                                                            "name": "typeLambda",
                                                                                                                                                            "handler": {
                                                                                                                                                              "lambda": {
                                                                                                                                                                "parameter": "tl",
                                                                                                                                                                "domain": {"variable": "hydra.core.model.TypeLambda"},
                                                                                                                                                                "body": {
                                                                                                                                                                  "application": {
                                                                                                                                                                    "function": {"project": {"typeName": "hydra.core.model.TypeLambda", "fieldName": "body"}},
                                                                                                                                                                    "argument": {"variable": "tl"}}}}}},
                                                                                                                                                          {
                                                                                                                                                            "name": "typeApplication",
                                                                                                                                                            "handler": {
                                                                                                                                                              "lambda": {
                                                                                                                                                                "parameter": "ta",
                                                                                                                                                                "domain": {"variable": "hydra.core.model.TypeApplicationTerm"},
                                                                                                                                                                "body": {
                                                                                                                                                                  "application": {
                                                                                                                                                                    "function": {"project": {"typeName": "hydra.core.model.TypeApplicationTerm", "fieldName": "body"}},
                                                                                                                                                                    "argument": {"variable": "ta"}}}}}}]}},
                                                                                                                                                    "argument": {"variable": "t"}}}}},
                                                                                                                                            "typeScheme": {
                                                                                                                                              "variables": [],
                                                                                                                                              "body": {"function": {"domain": {"variable": "hydra.core.model.Term"}, "codomain": {"variable": "hydra.core.model.Term"}}},
                                                                                                                                              "constraints": []}}],
                                                                                                                                        "body": {
                                                                                                                                          "let": {
                                                                                                                                            "bindings": [
                                                                                                                                              {
                                                                                                                                                "name": "extractAnn",
                                                                                                                                                "term": {
                                                                                                                                                  "lambda": {
                                                                                                                                                    "parameter": "t",
                                                                                                                                                    "domain": {"variable": "hydra.core.model.Term"},
                                                                                                                                                    "body": {
                                                                                                                                                      "application": {
                                                                                                                                                        "function": {
                                                                                                                                                          "cases": {
                                                                                                                                                            "typeName": "hydra.core.model.Term",
                                                                                                                                                            "default": {"typeApplication": {"body": {"optional": null}, "type": {"variable": "hydra.core.model.Term"}}},
                                                                                                                                                            "cases": [
                                                                                                                                                              {
                                                                                                                                                                "name": "annotated",
                                                                                                                                                                "handler": {
                                                                                                                                                                  "lambda": {
                                                                                                                                                                    "parameter": "at",
                                                                                                                                                                    "domain": {"variable": "hydra.core.model.AnnotatedTerm"},
                                                                                                                                                                    "body": {
                                                                                                                                                                      "optional": {
                                                                                                                                                                        "application": {
                                                                                                                                                                          "function": {"project": {"typeName": "hydra.core.model.AnnotatedTerm", "fieldName": "annotation"}},
                                                                                                                                                                          "argument": {"variable": "at"}}}}}}}]}},
                                                                                                                                                        "argument": {"variable": "t"}}}}},
                                                                                                                                                "typeScheme": {
                                                                                                                                                  "variables": [],
                                                                                                                                                  "body": {
                                                                                                                                                    "function": {"domain": {"variable": "hydra.core.model.Term"}, "codomain": {"optional": {"variable": "hydra.core.model.Term"}}}},
                                                                                                                                                  "constraints": []}}],
                                                                                                                                            "body": {
                                                                                                                                              "let": {
                                                                                                                                                "bindings": [
                                                                                                                                                  {
                                                                                                                                                    "name": "findAnn",
                                                                                                                                                    "term": {
                                                                                                                                                      "lambda": {
                                                                                                                                                        "parameter": "t",
                                                                                                                                                        "domain": {"variable": "hydra.core.model.Term"},
                                                                                                                                                        "body": {
                                                                                                                                                          "let": {
                                                                                                                                                            "bindings": [
                                                                                                                                                              {
                                                                                                                                                                "name": "t1",
                                                                                                                                                                "term": {"application": {"function": {"variable": "peelOne"}, "argument": {"variable": "t"}}},
                                                                                                                                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                                                                                                                                            "body": {
                                                                                                                                                              "let": {
                                                                                                                                                                "bindings": [
                                                                                                                                                                  {
                                                                                                                                                                    "name": "t2",
                                                                                                                                                                    "term": {"application": {"function": {"variable": "peelOne"}, "argument": {"variable": "t1"}}},
                                                                                                                                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                                                                                                                                                "body": {
                                                                                                                                                                  "let": {
                                                                                                                                                                    "bindings": [
                                                                                                                                                                      {
                                                                                                                                                                        "name": "t3",
                                                                                                                                                                        "term": {"application": {"function": {"variable": "peelOne"}, "argument": {"variable": "t2"}}},
                                                                                                                                                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                                                                                                                                                    "body": {
                                                                                                                                                                      "application": {
                                                                                                                                                                        "function": {
                                                                                                                                                                          "application": {
                                                                                                                                                                            "function": {
                                                                                                                                                                              "application": {
                                                                                                                                                                                "function": {
                                                                                                                                                                                  "typeApplication": {
                                                                                                                                                                                    "body": {
                                                                                                                                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.optionals.match"}, "type": {"variable": "hydra.core.model.Term"}}},
                                                                                                                                                                                    "type": {"optional": {"variable": "hydra.core.model.Term"}}}},
                                                                                                                                                                                "argument": {"application": {"function": {"variable": "extractAnn"}, "argument": {"variable": "t"}}}}},
                                                                                                                                                                            "argument": {
                                                                                                                                                                              "application": {
                                                                                                                                                                                "function": {
                                                                                                                                                                                  "application": {
                                                                                                                                                                                    "function": {
                                                                                                                                                                                      "application": {
                                                                                                                                                                                        "function": {
                                                                                                                                                                                          "typeApplication": {
                                                                                                                                                                                            "body": {
                                                                                                                                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.optionals.match"}, "type": {"variable": "hydra.core.model.Term"}}},
                                                                                                                                                                                            "type": {"optional": {"variable": "hydra.core.model.Term"}}}},
                                                                                                                                                                                        "argument": {"application": {"function": {"variable": "extractAnn"}, "argument": {"variable": "t1"}}}}},
                                                                                                                                                                                    "argument": {
                                                                                                                                                                                      "application": {
                                                                                                                                                                                        "function": {
                                                                                                                                                                                          "application": {
                                                                                                                                                                                            "function": {
                                                                                                                                                                                              "application": {
                                                                                                                                                                                                "function": {
                                                                                                                                                                                                  "typeApplication": {
                                                                                                                                                                                                    "body": {
                                                                                                                                                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.optionals.match"}, "type": {"variable": "hydra.core.model.Term"}}},
                                                                                                                                                                                                    "type": {"optional": {"variable": "hydra.core.model.Term"}}}},
                                                                                                                                                                                                "argument": {"application": {"function": {"variable": "extractAnn"}, "argument": {"variable": "t2"}}}}},
                                                                                                                                                                                            "argument": {"application": {"function": {"variable": "extractAnn"}, "argument": {"variable": "t3"}}}}},
                                                                                                                                                                                        "argument": {"lambda": {"parameter": "a", "domain": {"variable": "hydra.core.model.Term"}, "body": {"optional": {"variable": "a"}}}}}}}},
                                                                                                                                                                                "argument": {"lambda": {"parameter": "a", "domain": {"variable": "hydra.core.model.Term"}, "body": {"optional": {"variable": "a"}}}}}}}},
                                                                                                                                                                        "argument": {"lambda": {"parameter": "a", "domain": {"variable": "hydra.core.model.Term"}, "body": {"optional": {"variable": "a"}}}}}}}}}}}}}},
                                                                                                                                                    "typeScheme": {
                                                                                                                                                      "variables": [],
                                                                                                                                                      "body": {
                                                                                                                                                        "function": {"domain": {"variable": "hydra.core.model.Term"}, "codomain": {"optional": {"variable": "hydra.core.model.Term"}}}},
                                                                                                                                                      "constraints": []}}],
                                                                                                                                                "body": {
                                                                                                                                                  "let": {
                                                                                                                                                    "bindings": [
                                                                                                                                                      {
                                                                                                                                                        "name": "originalAnnotations",
                                                                                                                                                        "term": {
                                                                                                                                                          "application": {
                                                                                                                                                            "function": {
                                                                                                                                                              "typeApplication": {
                                                                                                                                                                "body": {
                                                                                                                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.maps.fromList"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                                                                                "type": {"variable": "hydra.core.model.Term"}}},
                                                                                                                                                            "argument": {
                                                                                                                                                              "application": {
                                                                                                                                                                "function": {
                                                                                                                                                                  "typeApplication": {
                                                                                                                                                                    "body": {"variable": "hydra.core.lib.optionals.givens"},
                                                                                                                                                                    "type": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.model.Term"}}}}},
                                                                                                                                                                "argument": {
                                                                                                                                                                  "application": {
                                                                                                                                                                    "function": {
                                                                                                                                                                      "application": {
                                                                                                                                                                        "function": {
                                                                                                                                                                          "typeApplication": {
                                                                                                                                                                            "body": {
                                                                                                                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.model.Binding"}}},
                                                                                                                                                                            "type": {
                                                                                                                                                                              "optional": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.model.Term"}}}}}},
                                                                                                                                                                        "argument": {
                                                                                                                                                                          "lambda": {
                                                                                                                                                                            "parameter": "b",
                                                                                                                                                                            "domain": {"variable": "hydra.core.model.Binding"},
                                                                                                                                                                            "body": {
                                                                                                                                                                              "application": {
                                                                                                                                                                                "function": {
                                                                                                                                                                                  "application": {
                                                                                                                                                                                    "function": {
                                                                                                                                                                                      "application": {
                                                                                                                                                                                        "function": {
                                                                                                                                                                                          "typeApplication": {
                                                                                                                                                                                            "body": {
                                                                                                                                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.optionals.match"}, "type": {"variable": "hydra.core.model.Term"}}},
                                                                                                                                                                                            "type": {
                                                                                                                                                                                              "optional": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.model.Term"}}}}}},
                                                                                                                                                                                        "argument": {
                                                                                                                                                                                          "application": {
                                                                                                                                                                                            "function": {"variable": "findAnn"},
                                                                                                                                                                                            "argument": {
                                                                                                                                                                                              "application": {"function": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "term"}}, "argument": {"variable": "b"}}}}}}},
                                                                                                                                                                                    "argument": {
                                                                                                                                                                                      "typeApplication": {
                                                                                                                                                                                        "body": {"optional": null},
                                                                                                                                                                                        "type": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.model.Term"}}}}}}},
                                                                                                                                                                                "argument": {
                                                                                                                                                                                  "lambda": {
                                                                                                                                                                                    "parameter": "ann",
                                                                                                                                                                                    "domain": {"variable": "hydra.core.model.Term"},
                                                                                                                                                                                    "body": {
                                                                                                                                                                                      "optional": {
                                                                                                                                                                                        "typeApplication": {
                                                                                                                                                                                          "body": {
                                                                                                                                                                                            "typeApplication": {
                                                                                                                                                                                              "body": {
                                                                                                                                                                                                "pair": {
                                                                                                                                                                                                  "first": {
                                                                                                                                                                                                    "application": {"function": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "name"}}, "argument": {"variable": "b"}}},
                                                                                                                                                                                                  "second": {"variable": "ann"}}},
                                                                                                                                                                                              "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                                                                                                          "type": {"variable": "hydra.core.model.Term"}}}}}}}}}}}},
                                                                                                                                                                    "argument": {"variable": "originalBindings"}}}}}}},
                                                                                                                                                        "typeScheme": {
                                                                                                                                                          "variables": [],
                                                                                                                                                          "body": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.Term"}}},
                                                                                                                                                          "constraints": []}}],
                                                                                                                                                    "body": {
                                                                                                                                                      "let": {
                                                                                                                                                        "bindings": [
                                                                                                                                                          {
                                                                                                                                                            "name": "reattachAnnotation",
                                                                                                                                                            "term": {
                                                                                                                                                              "lambda": {
                                                                                                                                                                "parameter": "b",
                                                                                                                                                                "domain": {"variable": "hydra.core.model.Binding"},
                                                                                                                                                                "body": {
                                                                                                                                                                  "application": {
                                                                                                                                                                    "function": {
                                                                                                                                                                      "application": {
                                                                                                                                                                        "function": {
                                                                                                                                                                          "application": {
                                                                                                                                                                            "function": {
                                                                                                                                                                              "typeApplication": {
                                                                                                                                                                                "body": {
                                                                                                                                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.optionals.match"}, "type": {"variable": "hydra.core.model.Term"}}},
                                                                                                                                                                                "type": {"variable": "hydra.core.model.Binding"}}},
                                                                                                                                                                            "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.Term"}}},
                                                                                                                                                                                    "argument": {
                                                                                                                                                                                      "application": {"function": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "name"}}, "argument": {"variable": "b"}}}}},
                                                                                                                                                                                "argument": {"variable": "originalAnnotations"}}}}},
                                                                                                                                                                        "argument": {"variable": "b"}}},
                                                                                                                                                                    "argument": {
                                                                                                                                                                      "lambda": {
                                                                                                                                                                        "parameter": "ann",
                                                                                                                                                                        "domain": {"variable": "hydra.core.model.Term"},
                                                                                                                                                                        "body": {
                                                                                                                                                                          "record": {
                                                                                                                                                                            "typeName": "hydra.core.model.Binding",
                                                                                                                                                                            "fields": [
                                                                                                                                                                              {
                                                                                                                                                                                "name": "name",
                                                                                                                                                                                "term": {
                                                                                                                                                                                  "application": {"function": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "name"}}, "argument": {"variable": "b"}}}},
                                                                                                                                                                              {
                                                                                                                                                                                "name": "term",
                                                                                                                                                                                "term": {
                                                                                                                                                                                  "application": {
                                                                                                                                                                                    "function": {
                                                                                                                                                                                      "cases": {
                                                                                                                                                                                        "typeName": "hydra.core.model.Term",
                                                                                                                                                                                        "default": {
                                                                                                                                                                                          "inject": {
                                                                                                                                                                                            "typeName": "hydra.core.model.Term",
                                                                                                                                                                                            "field": {
                                                                                                                                                                                              "name": "annotated",
                                                                                                                                                                                              "term": {
                                                                                                                                                                                                "record": {
                                                                                                                                                                                                  "typeName": "hydra.core.model.AnnotatedTerm",
                                                                                                                                                                                                  "fields": [
                                                                                                                                                                                                    {
                                                                                                                                                                                                      "name": "body",
                                                                                                                                                                                                      "term": {
                                                                                                                                                                                                        "application": {"function": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "term"}}, "argument": {"variable": "b"}}}},
                                                                                                                                                                                                    {"name": "annotation", "term": {"variable": "ann"}}]}}}}},
                                                                                                                                                                                        "cases": [
                                                                                                                                                                                          {
                                                                                                                                                                                            "name": "annotated",
                                                                                                                                                                                            "handler": {
                                                                                                                                                                                              "lambda": {
                                                                                                                                                                                                "parameter": "at",
                                                                                                                                                                                                "domain": {"variable": "hydra.core.model.AnnotatedTerm"},
                                                                                                                                                                                                "body": {
                                                                                                                                                                                                  "inject": {
                                                                                                                                                                                                    "typeName": "hydra.core.model.Term",
                                                                                                                                                                                                    "field": {
                                                                                                                                                                                                      "name": "annotated",
                                                                                                                                                                                                      "term": {
                                                                                                                                                                                                        "record": {
                                                                                                                                                                                                          "typeName": "hydra.core.model.AnnotatedTerm",
                                                                                                                                                                                                          "fields": [
                                                                                                                                                                                                            {
                                                                                                                                                                                                              "name": "body",
                                                                                                                                                                                                              "term": {
                                                                                                                                                                                                                "application": {
                                                                                                                                                                                                                  "function": {"project": {"typeName": "hydra.core.model.AnnotatedTerm", "fieldName": "body"}},
                                                                                                                                                                                                                  "argument": {"variable": "at"}}}},
                                                                                                                                                                                                            {
                                                                                                                                                                                                              "name": "annotation",
                                                                                                                                                                                                              "term": {
                                                                                                                                                                                                                "application": {
                                                                                                                                                                                                                  "function": {"variable": "hydra.core.annotations.wrapAnnotationMap"},
                                                                                                                                                                                                                  "argument": {
                                                                                                                                                                                                                    "application": {
                                                                                                                                                                                                                      "function": {
                                                                                                                                                                                                                        "application": {
                                                                                                                                                                                                                          "function": {
                                                                                                                                                                                                                            "typeApplication": {
                                                                                                                                                                                                                              "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.union"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                                                                                                                                              "type": {"variable": "hydra.core.model.Term"}}},
                                                                                                                                                                                                                          "argument": {
                                                                                                                                                                                                                            "application": {
                                                                                                                                                                                                                              "function": {"variable": "hydra.core.annotations.getAnnotationMap"},
                                                                                                                                                                                                                              "argument": {
                                                                                                                                                                                                                                "application": {
                                                                                                                                                                                                                                  "function": {"project": {"typeName": "hydra.core.model.AnnotatedTerm", "fieldName": "annotation"}},
                                                                                                                                                                                                                                  "argument": {"variable": "at"}}}}}}},
                                                                                                                                                                                                                      "argument": {"application": {"function": {"variable": "hydra.core.annotations.getAnnotationMap"}, "argument": {"variable": "ann"}}}}}}}}]}}}}}}}}]}},
                                                                                                                                                                                    "argument": {
                                                                                                                                                                                      "application": {"function": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "term"}}, "argument": {"variable": "b"}}}}}},
                                                                                                                                                                              {
                                                                                                                                                                                "name": "typeScheme",
                                                                                                                                                                                "term": {
                                                                                                                                                                                  "application": {
                                                                                                                                                                                    "function": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "typeScheme"}},
                                                                                                                                                                                    "argument": {"variable": "b"}}}}]}}}}}}}},
                                                                                                                                                            "typeScheme": {
                                                                                                                                                              "variables": [],
                                                                                                                                                              "body": {"function": {"domain": {"variable": "hydra.core.model.Binding"}, "codomain": {"variable": "hydra.core.model.Binding"}}},
                                                                                                                                                              "constraints": []}}],
                                                                                                                                                        "body": {
                                                                                                                                                          "let": {
                                                                                                                                                            "bindings": [
                                                                                                                                                              {
                                                                                                                                                                "name": "bins5",
                                                                                                                                                                "term": {
                                                                                                                                                                  "application": {
                                                                                                                                                                    "function": {
                                                                                                                                                                      "application": {
                                                                                                                                                                        "function": {
                                                                                                                                                                          "typeApplication": {
                                                                                                                                                                            "body": {
                                                                                                                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.model.Binding"}}},
                                                                                                                                                                            "type": {"variable": "hydra.core.model.Binding"}}},
                                                                                                                                                                        "argument": {"variable": "reattachAnnotation"}}},
                                                                                                                                                                    "argument": {"variable": "bins5Raw"}}},
                                                                                                                                                                "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Binding"}}, "constraints": []}}],
                                                                                                                                                            "body": {
                                                                                                                                                              "let": {
                                                                                                                                                                "bindings": [
                                                                                                                                                                  {
                                                                                                                                                                    "name": "toDef",
                                                                                                                                                                    "term": {
                                                                                                                                                                      "lambda": {
                                                                                                                                                                        "parameter": "el",
                                                                                                                                                                        "domain": {"variable": "hydra.core.model.Binding"},
                                                                                                                                                                        "body": {
                                                                                                                                                                          "application": {
                                                                                                                                                                            "function": {
                                                                                                                                                                              "application": {
                                                                                                                                                                                "function": {
                                                                                                                                                                                  "typeApplication": {
                                                                                                                                                                                    "body": {
                                                                                                                                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.optionals.map"}, "type": {"variable": "hydra.core.model.TypeScheme"}}},
                                                                                                                                                                                    "type": {"variable": "hydra.core.packaging.TermDefinition"}}},
                                                                                                                                                                                "argument": {
                                                                                                                                                                                  "lambda": {
                                                                                                                                                                                    "parameter": "ts",
                                                                                                                                                                                    "domain": {"variable": "hydra.core.model.TypeScheme"},
                                                                                                                                                                                    "body": {
                                                                                                                                                                                      "record": {
                                                                                                                                                                                        "typeName": "hydra.core.packaging.TermDefinition",
                                                                                                                                                                                        "fields": [
                                                                                                                                                                                          {
                                                                                                                                                                                            "name": "name",
                                                                                                                                                                                            "term": {
                                                                                                                                                                                              "application": {"function": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "name"}}, "argument": {"variable": "el"}}}},
                                                                                                                                                                                          {
                                                                                                                                                                                            "name": "metadata",
                                                                                                                                                                                            "term": {"typeApplication": {"body": {"optional": null}, "type": {"variable": "hydra.core.packaging.EntityMetadata"}}}},
                                                                                                                                                                                          {
                                                                                                                                                                                            "name": "signature",
                                                                                                                                                                                            "term": {
                                                                                                                                                                                              "optional": {
                                                                                                                                                                                                "application": {"function": {"variable": "hydra.core.scoping.typeSchemeToTermSignature"}, "argument": {"variable": "ts"}}}}},
                                                                                                                                                                                          {
                                                                                                                                                                                            "name": "body",
                                                                                                                                                                                            "term": {
                                                                                                                                                                                              "application": {"function": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "term"}}, "argument": {"variable": "el"}}}}]}}}}}},
                                                                                                                                                                            "argument": {
                                                                                                                                                                              "application": {
                                                                                                                                                                                "function": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "typeScheme"}},
                                                                                                                                                                                "argument": {"variable": "el"}}}}}}},
                                                                                                                                                                    "typeScheme": {
                                                                                                                                                                      "variables": [],
                                                                                                                                                                      "body": {
                                                                                                                                                                        "function": {
                                                                                                                                                                          "domain": {"variable": "hydra.core.model.Binding"},
                                                                                                                                                                          "codomain": {"optional": {"variable": "hydra.core.packaging.TermDefinition"}}}},
                                                                                                                                                                      "constraints": []}}],
                                                                                                                                                                "body": {
                                                                                                                                                                  "let": {
                                                                                                                                                                    "bindings": [
                                                                                                                                                                      {
                                                                                                                                                                        "name": "selectedElements",
                                                                                                                                                                        "term": {
                                                                                                                                                                          "application": {
                                                                                                                                                                            "function": {
                                                                                                                                                                              "application": {
                                                                                                                                                                                "function": {
                                                                                                                                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.lists.filter"}, "type": {"variable": "hydra.core.model.Binding"}}},
                                                                                                                                                                                "argument": {
                                                                                                                                                                                  "lambda": {
                                                                                                                                                                                    "parameter": "el",
                                                                                                                                                                                    "domain": {"variable": "hydra.core.model.Binding"},
                                                                                                                                                                                    "body": {
                                                                                                                                                                                      "application": {
                                                                                                                                                                                        "function": {
                                                                                                                                                                                          "application": {
                                                                                                                                                                                            "function": {
                                                                                                                                                                                              "application": {
                                                                                                                                                                                                "function": {
                                                                                                                                                                                                  "typeApplication": {
                                                                                                                                                                                                    "body": {
                                                                                                                                                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.optionals.match"}, "type": {"variable": "hydra.core.packaging.ModuleName"}}},
                                                                                                                                                                                                    "type": {"literal": "boolean"}}},
                                                                                                                                                                                                "argument": {
                                                                                                                                                                                                  "application": {
                                                                                                                                                                                                    "function": {"variable": "hydra.core.names.moduleNameOf"},
                                                                                                                                                                                                    "argument": {
                                                                                                                                                                                                      "application": {"function": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "name"}}, "argument": {"variable": "el"}}}}}}},
                                                                                                                                                                                            "argument": {"literal": {"boolean": false}}}},
                                                                                                                                                                                        "argument": {
                                                                                                                                                                                          "lambda": {
                                                                                                                                                                                            "parameter": "ns",
                                                                                                                                                                                            "domain": {"variable": "hydra.core.packaging.ModuleName"},
                                                                                                                                                                                            "body": {
                                                                                                                                                                                              "application": {
                                                                                                                                                                                                "function": {
                                                                                                                                                                                                  "application": {
                                                                                                                                                                                                    "function": {
                                                                                                                                                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.sets.member"}, "type": {"variable": "hydra.core.packaging.ModuleName"}}},
                                                                                                                                                                                                    "argument": {"variable": "ns"}}},
                                                                                                                                                                                                "argument": {"variable": "namespacesSet"}}}}}}}}}}},
                                                                                                                                                                            "argument": {"variable": "bins5"}}},
                                                                                                                                                                        "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Binding"}}, "constraints": []}}],
                                                                                                                                                                    "body": {
                                                                                                                                                                      "let": {
                                                                                                                                                                        "bindings": [
                                                                                                                                                                          {
                                                                                                                                                                            "name": "elementsByNamespace",
                                                                                                                                                                            "term": {
                                                                                                                                                                              "application": {
                                                                                                                                                                                "function": {
                                                                                                                                                                                  "application": {
                                                                                                                                                                                    "function": {
                                                                                                                                                                                      "application": {
                                                                                                                                                                                        "function": {
                                                                                                                                                                                          "typeApplication": {
                                                                                                                                                                                            "body": {
                                                                                                                                                                                              "typeApplication": {
                                                                                                                                                                                                "body": {"variable": "hydra.core.lib.lists.foldl"},
                                                                                                                                                                                                "type": {
                                                                                                                                                                                                  "map": {"keys": {"variable": "hydra.core.packaging.ModuleName"}, "values": {"list": {"variable": "hydra.core.model.Binding"}}}}}},
                                                                                                                                                                                            "type": {"variable": "hydra.core.model.Binding"}}},
                                                                                                                                                                                        "argument": {
                                                                                                                                                                                          "lambda": {
                                                                                                                                                                                            "parameter": "acc",
                                                                                                                                                                                            "domain": {
                                                                                                                                                                                              "map": {"keys": {"variable": "hydra.core.packaging.ModuleName"}, "values": {"list": {"variable": "hydra.core.model.Binding"}}}},
                                                                                                                                                                                            "body": {
                                                                                                                                                                                              "lambda": {
                                                                                                                                                                                                "parameter": "el",
                                                                                                                                                                                                "domain": {"variable": "hydra.core.model.Binding"},
                                                                                                                                                                                                "body": {
                                                                                                                                                                                                  "application": {
                                                                                                                                                                                                    "function": {
                                                                                                                                                                                                      "application": {
                                                                                                                                                                                                        "function": {
                                                                                                                                                                                                          "application": {
                                                                                                                                                                                                            "function": {
                                                                                                                                                                                                              "typeApplication": {
                                                                                                                                                                                                                "body": {
                                                                                                                                                                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.optionals.match"}, "type": {"variable": "hydra.core.packaging.ModuleName"}}},
                                                                                                                                                                                                                "type": {
                                                                                                                                                                                                                  "map": {"keys": {"variable": "hydra.core.packaging.ModuleName"}, "values": {"list": {"variable": "hydra.core.model.Binding"}}}}}},
                                                                                                                                                                                                            "argument": {
                                                                                                                                                                                                              "application": {
                                                                                                                                                                                                                "function": {"variable": "hydra.core.names.moduleNameOf"},
                                                                                                                                                                                                                "argument": {
                                                                                                                                                                                                                  "application": {"function": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "name"}}, "argument": {"variable": "el"}}}}}}},
                                                                                                                                                                                                        "argument": {"variable": "acc"}}},
                                                                                                                                                                                                    "argument": {
                                                                                                                                                                                                      "lambda": {
                                                                                                                                                                                                        "parameter": "ns",
                                                                                                                                                                                                        "domain": {"variable": "hydra.core.packaging.ModuleName"},
                                                                                                                                                                                                        "body": {
                                                                                                                                                                                                          "let": {
                                                                                                                                                                                                            "bindings": [
                                                                                                                                                                                                              {
                                                                                                                                                                                                                "name": "existing",
                                                                                                                                                                                                                "term": {
                                                                                                                                                                                                                  "application": {
                                                                                                                                                                                                                    "function": {
                                                                                                                                                                                                                      "application": {
                                                                                                                                                                                                                        "function": {
                                                                                                                                                                                                                          "application": {
                                                                                                                                                                                                                            "function": {
                                                                                                                                                                                                                              "typeApplication": {
                                                                                                                                                                                                                                "body": {
                                                                                                                                                                                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.optionals.match"}, "type": {"list": {"variable": "hydra.core.model.Binding"}}}},
                                                                                                                                                                                                                                "type": {"list": {"variable": "hydra.core.model.Binding"}}}},
                                                                                                                                                                                                                            "argument": {
                                                                                                                                                                                                                              "application": {
                                                                                                                                                                                                                                "function": {
                                                                                                                                                                                                                                  "application": {
                                                                                                                                                                                                                                    "function": {
                                                                                                                                                                                                                                      "typeApplication": {
                                                                                                                                                                                                                                        "body": {
                                                                                                                                                                                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.maps.lookup"}, "type": {"variable": "hydra.core.packaging.ModuleName"}}},
                                                                                                                                                                                                                                        "type": {"list": {"variable": "hydra.core.model.Binding"}}}},
                                                                                                                                                                                                                                    "argument": {"variable": "ns"}}},
                                                                                                                                                                                                                                "argument": {"variable": "acc"}}}}},
                                                                                                                                                                                                                        "argument": {"typeApplication": {"body": {"list": []}, "type": {"variable": "hydra.core.model.Binding"}}}}},
                                                                                                                                                                                                                    "argument": {
                                                                                                                                                                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.functions.identity"}, "type": {"list": {"variable": "hydra.core.model.Binding"}}}}}},
                                                                                                                                                                                                                "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Binding"}}, "constraints": []}}],
                                                                                                                                                                                                            "body": {
                                                                                                                                                                                                              "application": {
                                                                                                                                                                                                                "function": {
                                                                                                                                                                                                                  "application": {
                                                                                                                                                                                                                    "function": {
                                                                                                                                                                                                                      "application": {
                                                                                                                                                                                                                        "function": {
                                                                                                                                                                                                                          "typeApplication": {
                                                                                                                                                                                                                            "body": {
                                                                                                                                                                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.maps.insert"}, "type": {"variable": "hydra.core.packaging.ModuleName"}}},
                                                                                                                                                                                                                            "type": {"list": {"variable": "hydra.core.model.Binding"}}}},
                                                                                                                                                                                                                        "argument": {"variable": "ns"}}},
                                                                                                                                                                                                                    "argument": {
                                                                                                                                                                                                                      "application": {
                                                                                                                                                                                                                        "function": {
                                                                                                                                                                                                                          "application": {
                                                                                                                                                                                                                            "function": {
                                                                                                                                                                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.lists.concat2"}, "type": {"variable": "hydra.core.model.Binding"}}},
                                                                                                                                                                                                                            "argument": {"variable": "existing"}}},
                                                                                                                                                                                                                        "argument": {"list": [{"variable": "el"}]}}}}},
                                                                                                                                                                                                                "argument": {"variable": "acc"}}}}}}}}}}}}}}},
                                                                                                                                                                                    "argument": {
                                                                                                                                                                                      "typeApplication": {
                                                                                                                                                                                        "body": {
                                                                                                                                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.maps.empty"}, "type": {"variable": "hydra.core.packaging.ModuleName"}}},
                                                                                                                                                                                        "type": {"list": {"variable": "hydra.core.model.Binding"}}}}}},
                                                                                                                                                                                "argument": {"variable": "selectedElements"}}},
                                                                                                                                                                            "typeScheme": {
                                                                                                                                                                              "variables": [],
                                                                                                                                                                              "body": {
                                                                                                                                                                                "map": {"keys": {"variable": "hydra.core.packaging.ModuleName"}, "values": {"list": {"variable": "hydra.core.model.Binding"}}}},
                                                                                                                                                                              "constraints": []}}],
                                                                                                                                                                        "body": {
                                                                                                                                                                          "let": {
                                                                                                                                                                            "bindings": [
                                                                                                                                                                              {
                                                                                                                                                                                "name": "defsGrouped",
                                                                                                                                                                                "term": {
                                                                                                                                                                                  "application": {
                                                                                                                                                                                    "function": {
                                                                                                                                                                                      "application": {
                                                                                                                                                                                        "function": {
                                                                                                                                                                                          "typeApplication": {
                                                                                                                                                                                            "body": {
                                                                                                                                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.packaging.ModuleName"}}},
                                                                                                                                                                                            "type": {"list": {"variable": "hydra.core.packaging.TermDefinition"}}}},
                                                                                                                                                                                        "argument": {
                                                                                                                                                                                          "lambda": {
                                                                                                                                                                                            "parameter": "ns",
                                                                                                                                                                                            "domain": {"variable": "hydra.core.packaging.ModuleName"},
                                                                                                                                                                                            "body": {
                                                                                                                                                                                              "let": {
                                                                                                                                                                                                "bindings": [
                                                                                                                                                                                                  {
                                                                                                                                                                                                    "name": "elsForNs",
                                                                                                                                                                                                    "term": {
                                                                                                                                                                                                      "application": {
                                                                                                                                                                                                        "function": {
                                                                                                                                                                                                          "application": {
                                                                                                                                                                                                            "function": {
                                                                                                                                                                                                              "application": {
                                                                                                                                                                                                                "function": {
                                                                                                                                                                                                                  "typeApplication": {
                                                                                                                                                                                                                    "body": {
                                                                                                                                                                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.optionals.match"}, "type": {"list": {"variable": "hydra.core.model.Binding"}}}},
                                                                                                                                                                                                                    "type": {"list": {"variable": "hydra.core.model.Binding"}}}},
                                                                                                                                                                                                                "argument": {
                                                                                                                                                                                                                  "application": {
                                                                                                                                                                                                                    "function": {
                                                                                                                                                                                                                      "application": {
                                                                                                                                                                                                                        "function": {
                                                                                                                                                                                                                          "typeApplication": {
                                                                                                                                                                                                                            "body": {
                                                                                                                                                                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.maps.lookup"}, "type": {"variable": "hydra.core.packaging.ModuleName"}}},
                                                                                                                                                                                                                            "type": {"list": {"variable": "hydra.core.model.Binding"}}}},
                                                                                                                                                                                                                        "argument": {"variable": "ns"}}},
                                                                                                                                                                                                                    "argument": {"variable": "elementsByNamespace"}}}}},
                                                                                                                                                                                                            "argument": {"typeApplication": {"body": {"list": []}, "type": {"variable": "hydra.core.model.Binding"}}}}},
                                                                                                                                                                                                        "argument": {
                                                                                                                                                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.functions.identity"}, "type": {"list": {"variable": "hydra.core.model.Binding"}}}}}},
                                                                                                                                                                                                    "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Binding"}}, "constraints": []}}],
                                                                                                                                                                                                "body": {
                                                                                                                                                                                                  "application": {
                                                                                                                                                                                                    "function": {
                                                                                                                                                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.optionals.givens"}, "type": {"variable": "hydra.core.packaging.TermDefinition"}}},
                                                                                                                                                                                                    "argument": {
                                                                                                                                                                                                      "application": {
                                                                                                                                                                                                        "function": {
                                                                                                                                                                                                          "application": {
                                                                                                                                                                                                            "function": {
                                                                                                                                                                                                              "typeApplication": {
                                                                                                                                                                                                                "body": {
                                                                                                                                                                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.model.Binding"}}},
                                                                                                                                                                                                                "type": {"optional": {"variable": "hydra.core.packaging.TermDefinition"}}}},
                                                                                                                                                                                                            "argument": {"variable": "toDef"}}},
                                                                                                                                                                                                        "argument": {"variable": "elsForNs"}}}}}}}}}}},
                                                                                                                                                                                    "argument": {"variable": "namespaces"}}},
                                                                                                                                                                                "typeScheme": {"variables": [], "body": {"list": {"list": {"variable": "hydra.core.packaging.TermDefinition"}}}, "constraints": []}}],
                                                                                                                                                                            "body": {
                                                                                                                                                                              "let": {
                                                                                                                                                                                "bindings": [
                                                                                                                                                                                  {
                                                                                                                                                                                    "name": "g",
                                                                                                                                                                                    "term": {
                                                                                                                                                                                      "application": {
                                                                                                                                                                                        "function": {
                                                                                                                                                                                          "application": {
                                                                                                                                                                                            "function": {"application": {"function": {"variable": "hydra.core.lexical.buildGraph"}, "argument": {"variable": "bins5"}}},
                                                                                                                                                                                            "argument": {
                                                                                                                                                                                              "typeApplication": {
                                                                                                                                                                                                "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.empty"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                                                                                                                "type": {"optional": {"variable": "hydra.core.model.Term"}}}}}},
                                                                                                                                                                                        "argument": {
                                                                                                                                                                                          "application": {
                                                                                                                                                                                            "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "primitives"}},
                                                                                                                                                                                            "argument": {"variable": "adapted"}}}}},
                                                                                                                                                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.graph.Graph"}, "constraints": []}}],
                                                                                                                                                                                "body": {
                                                                                                                                                                                  "typeApplication": {
                                                                                                                                                                                    "body": {
                                                                                                                                                                                      "typeApplication": {
                                                                                                                                                                                        "body": {
                                                                                                                                                                                          "either": {
                                                                                                                                                                                            "right": {
                                                                                                                                                                                              "typeApplication": {
                                                                                                                                                                                                "body": {
                                                                                                                                                                                                  "typeApplication": {
                                                                                                                                                                                                    "body": {
                                                                                                                                                                                                      "pair": {
                                                                                                                                                                                                        "first": {
                                                                                                                                                                                                          "record": {
                                                                                                                                                                                                            "typeName": "hydra.core.graph.Graph",
                                                                                                                                                                                                            "fields": [
                                                                                                                                                                                                              {
                                                                                                                                                                                                                "name": "boundTerms",
                                                                                                                                                                                                                "term": {
                                                                                                                                                                                                                  "application": {
                                                                                                                                                                                                                    "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "boundTerms"}},
                                                                                                                                                                                                                    "argument": {"variable": "g"}}}},
                                                                                                                                                                                                              {
                                                                                                                                                                                                                "name": "boundTypes",
                                                                                                                                                                                                                "term": {
                                                                                                                                                                                                                  "application": {
                                                                                                                                                                                                                    "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "boundTypes"}},
                                                                                                                                                                                                                    "argument": {"variable": "g"}}}},
                                                                                                                                                                                                              {
                                                                                                                                                                                                                "name": "classConstraints",
                                                                                                                                                                                                                "term": {
                                                                                                                                                                                                                  "application": {
                                                                                                                                                                                                                    "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "classConstraints"}},
                                                                                                                                                                                                                    "argument": {"variable": "g"}}}},
                                                                                                                                                                                                              {
                                                                                                                                                                                                                "name": "lambdaVariables",
                                                                                                                                                                                                                "term": {
                                                                                                                                                                                                                  "application": {
                                                                                                                                                                                                                    "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "lambdaVariables"}},
                                                                                                                                                                                                                    "argument": {"variable": "g"}}}},
                                                                                                                                                                                                              {
                                                                                                                                                                                                                "name": "metadata",
                                                                                                                                                                                                                "term": {
                                                                                                                                                                                                                  "application": {
                                                                                                                                                                                                                    "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "metadata"}},
                                                                                                                                                                                                                    "argument": {"variable": "g"}}}},
                                                                                                                                                                                                              {
                                                                                                                                                                                                                "name": "primitives",
                                                                                                                                                                                                                "term": {
                                                                                                                                                                                                                  "application": {
                                                                                                                                                                                                                    "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "primitives"}},
                                                                                                                                                                                                                    "argument": {"variable": "g"}}}},
                                                                                                                                                                                                              {
                                                                                                                                                                                                                "name": "schemaTypes",
                                                                                                                                                                                                                "term": {
                                                                                                                                                                                                                  "application": {
                                                                                                                                                                                                                    "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "schemaTypes"}},
                                                                                                                                                                                                                    "argument": {"variable": "adapted"}}}},
                                                                                                                                                                                                              {
                                                                                                                                                                                                                "name": "typeVariables",
                                                                                                                                                                                                                "term": {
                                                                                                                                                                                                                  "application": {
                                                                                                                                                                                                                    "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "typeVariables"}},
                                                                                                                                                                                                                    "argument": {"variable": "g"}}}}]}},
                                                                                                                                                                                                        "second": {"variable": "defsGrouped"}}},
                                                                                                                                                                                                    "type": {"variable": "hydra.core.graph.Graph"}}},
                                                                                                                                                                                                "type": {"list": {"list": {"variable": "hydra.core.packaging.TermDefinition"}}}}}}},
                                                                                                                                                                                        "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                                                                                                                    "type": {
                                                                                                                                                                                      "pair": {
                                                                                                                                                                                        "first": {"variable": "hydra.core.graph.Graph"},
                                                                                                                                                                                        "second": {"list": {"list": {"variable": "hydra.core.packaging.TermDefinition"}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {
                    "literal": {
                      "string": "Given a data graph along with language constraints, original ordered bindings, and a designated list of namespaces, adapt the graph to the language constraints, then return the processed graph along with term definitions grouped by namespace (in the order of the input namespaces). Inference is performed before adaptation if bindings lack type annotations. Hoisting must preserve type schemes; if any binding loses its type scheme after hoisting, the pipeline fails. Adaptation preserves type application/lambda wrappers and adapts embedded types. Post-adaptation inference is performed to ensure binding TypeSchemes are fully consistent. The doExpand flag controls eta expansion. The doHoistCaseStatements flag controls case statement hoisting (needed for Python). The doHoistPolymorphicLetBindings flag controls polymorphic let binding hoisting (needed for Java). The originalBindings parameter provides the original ordered bindings (from module elements)."}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.adapt.literalTypeSupported",
        "signature": {
          "typeParameters": [],
          "parameters": [
            {"name": "arg0", "type": {"variable": "hydra.core.coders.LanguageConstraints"}, "isLazy": false},
            {"name": "arg1", "type": {"variable": "hydra.core.model.LiteralType"}, "isLazy": false}],
          "result": {"type": {"literal": "boolean"}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "constraints",
                "domain": {"variable": "hydra.core.coders.LanguageConstraints"},
                "body": {
                  "lambda": {
                    "parameter": "lt",
                    "domain": {"variable": "hydra.core.model.LiteralType"},
                    "body": {
                      "let": {
                        "bindings": [
                          {
                            "name": "forType",
                            "term": {
                              "lambda": {
                                "parameter": "lt",
                                "domain": {"variable": "hydra.core.model.LiteralType"},
                                "body": {
                                  "application": {
                                    "function": {
                                      "cases": {
                                        "typeName": "hydra.core.model.LiteralType",
                                        "default": {"literal": {"boolean": true}},
                                        "cases": [
                                          {
                                            "name": "float",
                                            "handler": {
                                              "lambda": {
                                                "parameter": "ft",
                                                "domain": {"variable": "hydra.core.model.FloatType"},
                                                "body": {
                                                  "application": {
                                                    "function": {
                                                      "application": {
                                                        "function": {
                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.sets.member"}, "type": {"variable": "hydra.core.model.FloatType"}}},
                                                        "argument": {"variable": "ft"}}},
                                                    "argument": {
                                                      "application": {
                                                        "function": {"project": {"typeName": "hydra.core.coders.LanguageConstraints", "fieldName": "floatTypes"}},
                                                        "argument": {"variable": "constraints"}}}}}}}},
                                          {
                                            "name": "integer",
                                            "handler": {
                                              "lambda": {
                                                "parameter": "it",
                                                "domain": {"variable": "hydra.core.model.IntegerType"},
                                                "body": {
                                                  "application": {
                                                    "function": {
                                                      "application": {
                                                        "function": {
                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.sets.member"}, "type": {"variable": "hydra.core.model.IntegerType"}}},
                                                        "argument": {"variable": "it"}}},
                                                    "argument": {
                                                      "application": {
                                                        "function": {"project": {"typeName": "hydra.core.coders.LanguageConstraints", "fieldName": "integerTypes"}},
                                                        "argument": {"variable": "constraints"}}}}}}}}]}},
                                    "argument": {"variable": "lt"}}}}},
                            "typeScheme": {
                              "variables": [],
                              "body": {"function": {"domain": {"variable": "hydra.core.model.LiteralType"}, "codomain": {"literal": "boolean"}}},
                              "constraints": []}}],
                        "body": {
                          "application": {
                            "function": {
                              "application": {
                                "function": {
                                  "application": {
                                    "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.logic.ifElse"}, "type": {"literal": "boolean"}}},
                                    "argument": {
                                      "application": {
                                        "function": {
                                          "application": {
                                            "function": {
                                              "typeApplication": {"body": {"variable": "hydra.core.lib.sets.member"}, "type": {"variable": "hydra.core.variants.LiteralVariant"}}},
                                            "argument": {"application": {"function": {"variable": "hydra.core.reflect.literalTypeVariant"}, "argument": {"variable": "lt"}}}}},
                                        "argument": {
                                          "application": {
                                            "function": {"project": {"typeName": "hydra.core.coders.LanguageConstraints", "fieldName": "literalVariants"}},
                                            "argument": {"variable": "constraints"}}}}}}},
                                "argument": {"application": {"function": {"variable": "forType"}, "argument": {"variable": "lt"}}}}},
                            "argument": {"literal": {"boolean": false}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {"literal": {"string": "Check if a literal type is supported by the given language constraints"}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.adapt.prepareFloatType",
        "signature": {
          "typeParameters": [{"name": "t0", "constraints": [{"simple": "ordering"}]}],
          "parameters": [{"name": "arg0", "type": {"variable": "hydra.core.model.FloatType"}, "isLazy": false}],
          "result": {
            "type": {
              "pair": {
                "first": {"variable": "hydra.core.model.FloatType"},
                "second": {
                  "pair": {
                    "first": {
                      "function": {"domain": {"variable": "hydra.core.model.FloatValue"}, "codomain": {"variable": "hydra.core.model.FloatValue"}}},
                    "second": {"set": {"variable": "t0"}}}}}}}},
        "body": {
          "typeLambda": {
            "parameter": "t0",
            "body": {
              "annotated": {
                "body": {
                  "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": {
                                      "typeApplication": {
                                        "body": {
                                          "typeApplication": {
                                            "body": {
                                              "pair": {
                                                "first": {"inject": {"typeName": "hydra.core.model.FloatType", "field": {"name": "float32", "term": "unit"}}},
                                                "second": {
                                                  "typeApplication": {
                                                    "body": {
                                                      "typeApplication": {
                                                        "body": {
                                                          "pair": {
                                                            "first": {
                                                              "lambda": {
                                                                "parameter": "v",
                                                                "domain": {"variable": "hydra.core.model.FloatValue"},
                                                                "body": {
                                                                  "application": {
                                                                    "function": {
                                                                      "cases": {
                                                                        "typeName": "hydra.core.model.FloatValue",
                                                                        "default": {"variable": "v"},
                                                                        "cases": [
                                                                          {
                                                                            "name": "float32",
                                                                            "handler": {
                                                                              "lambda": {
                                                                                "parameter": "f",
                                                                                "domain": {"literal": {"float": "float32"}},
                                                                                "body": {"inject": {"typeName": "hydra.core.model.FloatValue", "field": {"name": "float32", "term": {"variable": "f"}}}}}}}]}},
                                                                    "argument": {"variable": "v"}}}}},
                                                            "second": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.empty"}, "type": {"variable": "t0"}}}}},
                                                        "type": {
                                                          "function": {"domain": {"variable": "hydra.core.model.FloatValue"}, "codomain": {"variable": "hydra.core.model.FloatValue"}}}}},
                                                    "type": {"set": {"variable": "t0"}}}}}},
                                            "type": {"variable": "hydra.core.model.FloatType"}}},
                                        "type": {
                                          "pair": {
                                            "first": {
                                              "function": {"domain": {"variable": "hydra.core.model.FloatValue"}, "codomain": {"variable": "hydra.core.model.FloatValue"}}},
                                            "second": {"set": {"variable": "t0"}}}}}}}}},
                              {
                                "name": "float64",
                                "handler": {
                                  "lambda": {
                                    "parameter": "_",
                                    "domain": "unit",
                                    "body": {
                                      "typeApplication": {
                                        "body": {
                                          "typeApplication": {
                                            "body": {
                                              "pair": {
                                                "first": {"inject": {"typeName": "hydra.core.model.FloatType", "field": {"name": "float64", "term": "unit"}}},
                                                "second": {
                                                  "typeApplication": {
                                                    "body": {
                                                      "typeApplication": {
                                                        "body": {
                                                          "pair": {
                                                            "first": {
                                                              "lambda": {
                                                                "parameter": "v",
                                                                "domain": {"variable": "hydra.core.model.FloatValue"},
                                                                "body": {
                                                                  "application": {
                                                                    "function": {
                                                                      "cases": {
                                                                        "typeName": "hydra.core.model.FloatValue",
                                                                        "default": {"variable": "v"},
                                                                        "cases": [
                                                                          {
                                                                            "name": "float64",
                                                                            "handler": {
                                                                              "lambda": {
                                                                                "parameter": "f",
                                                                                "domain": {"literal": {"float": "float64"}},
                                                                                "body": {"inject": {"typeName": "hydra.core.model.FloatValue", "field": {"name": "float64", "term": {"variable": "f"}}}}}}}]}},
                                                                    "argument": {"variable": "v"}}}}},
                                                            "second": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.empty"}, "type": {"variable": "t0"}}}}},
                                                        "type": {
                                                          "function": {"domain": {"variable": "hydra.core.model.FloatValue"}, "codomain": {"variable": "hydra.core.model.FloatValue"}}}}},
                                                    "type": {"set": {"variable": "t0"}}}}}},
                                            "type": {"variable": "hydra.core.model.FloatType"}}},
                                        "type": {
                                          "pair": {
                                            "first": {
                                              "function": {"domain": {"variable": "hydra.core.model.FloatValue"}, "codomain": {"variable": "hydra.core.model.FloatValue"}}},
                                            "second": {"set": {"variable": "t0"}}}}}}}}}]}},
                        "argument": {"variable": "ft"}}}}},
                "annotation": {
                  "map": [
                    {
                      "key": {"variable": "description"},
                      "value": {"literal": {"string": "Prepare a float type, substituting unsupported types"}}}]}}}}}}},
    {
      "term": {
        "name": "hydra.core.adapt.prepareIntegerType",
        "signature": {
          "typeParameters": [],
          "parameters": [{"name": "arg0", "type": {"variable": "hydra.core.model.IntegerType"}, "isLazy": false}],
          "result": {
            "type": {
              "pair": {
                "first": {"variable": "hydra.core.model.IntegerType"},
                "second": {
                  "pair": {
                    "first": {
                      "function": {"domain": {"variable": "hydra.core.model.IntegerValue"}, "codomain": {"variable": "hydra.core.model.IntegerValue"}}},
                    "second": {"set": {"literal": "string"}}}}}}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "it",
                "domain": {"variable": "hydra.core.model.IntegerType"},
                "body": {
                  "application": {
                    "function": {
                      "cases": {
                        "typeName": "hydra.core.model.IntegerType",
                        "default": {
                          "application": {
                            "function": {
                              "typeApplication": {
                                "body": {
                                  "typeApplication": {
                                    "body": {
                                      "typeApplication": {"body": {"variable": "hydra.core.adapt.prepareSame"}, "type": {"variable": "hydra.core.model.IntegerType"}}},
                                    "type": {"variable": "hydra.core.model.IntegerValue"}}},
                                "type": {"literal": "string"}}},
                            "argument": {"variable": "it"}}},
                        "cases": [
                          {
                            "name": "bigint",
                            "handler": {
                              "lambda": {
                                "parameter": "_",
                                "domain": "unit",
                                "body": {
                                  "typeApplication": {
                                    "body": {
                                      "typeApplication": {
                                        "body": {
                                          "pair": {
                                            "first": {"inject": {"typeName": "hydra.core.model.IntegerType", "field": {"name": "int64", "term": "unit"}}},
                                            "second": {
                                              "typeApplication": {
                                                "body": {
                                                  "typeApplication": {
                                                    "body": {
                                                      "pair": {
                                                        "first": {
                                                          "lambda": {
                                                            "parameter": "v",
                                                            "domain": {"variable": "hydra.core.model.IntegerValue"},
                                                            "body": {
                                                              "application": {
                                                                "function": {
                                                                  "cases": {
                                                                    "typeName": "hydra.core.model.IntegerValue",
                                                                    "default": {"variable": "v"},
                                                                    "cases": [
                                                                      {
                                                                        "name": "bigint",
                                                                        "handler": {
                                                                          "lambda": {
                                                                            "parameter": "i",
                                                                            "domain": {"literal": {"integer": "bigint"}},
                                                                            "body": {
                                                                              "inject": {
                                                                                "typeName": "hydra.core.model.IntegerValue",
                                                                                "field": {
                                                                                  "name": "int64",
                                                                                  "term": {"application": {"function": {"variable": "hydra.core.lib.literals.bigintToInt64"}, "argument": {"variable": "i"}}}}}}}}}]}},
                                                                "argument": {"variable": "v"}}}}},
                                                        "second": {
                                                          "application": {
                                                            "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.fromList"}, "type": {"literal": "string"}}},
                                                            "argument": {"list": [{"literal": {"string": "replace arbitrary-precision integers with 64-bit integers"}}]}}}}},
                                                    "type": {
                                                      "function": {"domain": {"variable": "hydra.core.model.IntegerValue"}, "codomain": {"variable": "hydra.core.model.IntegerValue"}}}}},
                                                "type": {"set": {"literal": "string"}}}}}},
                                        "type": {"variable": "hydra.core.model.IntegerType"}}},
                                    "type": {
                                      "pair": {
                                        "first": {
                                          "function": {"domain": {"variable": "hydra.core.model.IntegerValue"}, "codomain": {"variable": "hydra.core.model.IntegerValue"}}},
                                        "second": {"set": {"literal": "string"}}}}}}}}},
                          {
                            "name": "uint8",
                            "handler": {
                              "lambda": {
                                "parameter": "_",
                                "domain": "unit",
                                "body": {
                                  "typeApplication": {
                                    "body": {
                                      "typeApplication": {
                                        "body": {
                                          "pair": {
                                            "first": {"inject": {"typeName": "hydra.core.model.IntegerType", "field": {"name": "int8", "term": "unit"}}},
                                            "second": {
                                              "typeApplication": {
                                                "body": {
                                                  "typeApplication": {
                                                    "body": {
                                                      "pair": {
                                                        "first": {
                                                          "lambda": {
                                                            "parameter": "v",
                                                            "domain": {"variable": "hydra.core.model.IntegerValue"},
                                                            "body": {
                                                              "application": {
                                                                "function": {
                                                                  "cases": {
                                                                    "typeName": "hydra.core.model.IntegerValue",
                                                                    "default": {"variable": "v"},
                                                                    "cases": [
                                                                      {
                                                                        "name": "uint8",
                                                                        "handler": {
                                                                          "lambda": {
                                                                            "parameter": "i",
                                                                            "domain": {"literal": {"integer": "uint8"}},
                                                                            "body": {
                                                                              "inject": {
                                                                                "typeName": "hydra.core.model.IntegerValue",
                                                                                "field": {
                                                                                  "name": "int8",
                                                                                  "term": {
                                                                                    "application": {
                                                                                      "function": {"variable": "hydra.core.lib.literals.bigintToInt8"},
                                                                                      "argument": {"application": {"function": {"variable": "hydra.core.lib.literals.uint8ToBigint"}, "argument": {"variable": "i"}}}}}}}}}}}]}},
                                                                "argument": {"variable": "v"}}}}},
                                                        "second": {
                                                          "application": {
                                                            "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.fromList"}, "type": {"literal": "string"}}},
                                                            "argument": {"list": [{"literal": {"string": "replace unsigned 8-bit integers with signed 8-bit integers"}}]}}}}},
                                                    "type": {
                                                      "function": {"domain": {"variable": "hydra.core.model.IntegerValue"}, "codomain": {"variable": "hydra.core.model.IntegerValue"}}}}},
                                                "type": {"set": {"literal": "string"}}}}}},
                                        "type": {"variable": "hydra.core.model.IntegerType"}}},
                                    "type": {
                                      "pair": {
                                        "first": {
                                          "function": {"domain": {"variable": "hydra.core.model.IntegerValue"}, "codomain": {"variable": "hydra.core.model.IntegerValue"}}},
                                        "second": {"set": {"literal": "string"}}}}}}}}},
                          {
                            "name": "uint32",
                            "handler": {
                              "lambda": {
                                "parameter": "_",
                                "domain": "unit",
                                "body": {
                                  "typeApplication": {
                                    "body": {
                                      "typeApplication": {
                                        "body": {
                                          "pair": {
                                            "first": {"inject": {"typeName": "hydra.core.model.IntegerType", "field": {"name": "int32", "term": "unit"}}},
                                            "second": {
                                              "typeApplication": {
                                                "body": {
                                                  "typeApplication": {
                                                    "body": {
                                                      "pair": {
                                                        "first": {
                                                          "lambda": {
                                                            "parameter": "v",
                                                            "domain": {"variable": "hydra.core.model.IntegerValue"},
                                                            "body": {
                                                              "application": {
                                                                "function": {
                                                                  "cases": {
                                                                    "typeName": "hydra.core.model.IntegerValue",
                                                                    "default": {"variable": "v"},
                                                                    "cases": [
                                                                      {
                                                                        "name": "uint32",
                                                                        "handler": {
                                                                          "lambda": {
                                                                            "parameter": "i",
                                                                            "domain": {"literal": {"integer": "uint32"}},
                                                                            "body": {
                                                                              "inject": {
                                                                                "typeName": "hydra.core.model.IntegerValue",
                                                                                "field": {
                                                                                  "name": "int32",
                                                                                  "term": {
                                                                                    "application": {
                                                                                      "function": {"variable": "hydra.core.lib.literals.bigintToInt32"},
                                                                                      "argument": {"application": {"function": {"variable": "hydra.core.lib.literals.uint32ToBigint"}, "argument": {"variable": "i"}}}}}}}}}}}]}},
                                                                "argument": {"variable": "v"}}}}},
                                                        "second": {
                                                          "application": {
                                                            "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.fromList"}, "type": {"literal": "string"}}},
                                                            "argument": {"list": [{"literal": {"string": "replace unsigned 32-bit integers with signed 32-bit integers"}}]}}}}},
                                                    "type": {
                                                      "function": {"domain": {"variable": "hydra.core.model.IntegerValue"}, "codomain": {"variable": "hydra.core.model.IntegerValue"}}}}},
                                                "type": {"set": {"literal": "string"}}}}}},
                                        "type": {"variable": "hydra.core.model.IntegerType"}}},
                                    "type": {
                                      "pair": {
                                        "first": {
                                          "function": {"domain": {"variable": "hydra.core.model.IntegerValue"}, "codomain": {"variable": "hydra.core.model.IntegerValue"}}},
                                        "second": {"set": {"literal": "string"}}}}}}}}},
                          {
                            "name": "uint64",
                            "handler": {
                              "lambda": {
                                "parameter": "_",
                                "domain": "unit",
                                "body": {
                                  "typeApplication": {
                                    "body": {
                                      "typeApplication": {
                                        "body": {
                                          "pair": {
                                            "first": {"inject": {"typeName": "hydra.core.model.IntegerType", "field": {"name": "int64", "term": "unit"}}},
                                            "second": {
                                              "typeApplication": {
                                                "body": {
                                                  "typeApplication": {
                                                    "body": {
                                                      "pair": {
                                                        "first": {
                                                          "lambda": {
                                                            "parameter": "v",
                                                            "domain": {"variable": "hydra.core.model.IntegerValue"},
                                                            "body": {
                                                              "application": {
                                                                "function": {
                                                                  "cases": {
                                                                    "typeName": "hydra.core.model.IntegerValue",
                                                                    "default": {"variable": "v"},
                                                                    "cases": [
                                                                      {
                                                                        "name": "uint64",
                                                                        "handler": {
                                                                          "lambda": {
                                                                            "parameter": "i",
                                                                            "domain": {"literal": {"integer": "uint64"}},
                                                                            "body": {
                                                                              "inject": {
                                                                                "typeName": "hydra.core.model.IntegerValue",
                                                                                "field": {
                                                                                  "name": "int64",
                                                                                  "term": {
                                                                                    "application": {
                                                                                      "function": {"variable": "hydra.core.lib.literals.bigintToInt64"},
                                                                                      "argument": {"application": {"function": {"variable": "hydra.core.lib.literals.uint64ToBigint"}, "argument": {"variable": "i"}}}}}}}}}}}]}},
                                                                "argument": {"variable": "v"}}}}},
                                                        "second": {
                                                          "application": {
                                                            "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.fromList"}, "type": {"literal": "string"}}},
                                                            "argument": {"list": [{"literal": {"string": "replace unsigned 64-bit integers with signed 64-bit integers"}}]}}}}},
                                                    "type": {
                                                      "function": {"domain": {"variable": "hydra.core.model.IntegerValue"}, "codomain": {"variable": "hydra.core.model.IntegerValue"}}}}},
                                                "type": {"set": {"literal": "string"}}}}}},
                                        "type": {"variable": "hydra.core.model.IntegerType"}}},
                                    "type": {
                                      "pair": {
                                        "first": {
                                          "function": {"domain": {"variable": "hydra.core.model.IntegerValue"}, "codomain": {"variable": "hydra.core.model.IntegerValue"}}},
                                        "second": {"set": {"literal": "string"}}}}}}}}}]}},
                    "argument": {"variable": "it"}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {"literal": {"string": "Prepare an integer type, substituting unsupported types"}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.adapt.prepareLiteralType",
        "signature": {
          "typeParameters": [],
          "parameters": [{"name": "arg0", "type": {"variable": "hydra.core.model.LiteralType"}, "isLazy": false}],
          "result": {
            "type": {
              "pair": {
                "first": {"variable": "hydra.core.model.LiteralType"},
                "second": {
                  "pair": {
                    "first": {"function": {"domain": {"variable": "hydra.core.model.Literal"}, "codomain": {"variable": "hydra.core.model.Literal"}}},
                    "second": {"set": {"literal": "string"}}}}}}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "at",
                "domain": {"variable": "hydra.core.model.LiteralType"},
                "body": {
                  "application": {
                    "function": {
                      "cases": {
                        "typeName": "hydra.core.model.LiteralType",
                        "default": {
                          "application": {
                            "function": {
                              "typeApplication": {
                                "body": {
                                  "typeApplication": {
                                    "body": {
                                      "typeApplication": {"body": {"variable": "hydra.core.adapt.prepareSame"}, "type": {"variable": "hydra.core.model.LiteralType"}}},
                                    "type": {"variable": "hydra.core.model.Literal"}}},
                                "type": {"literal": "string"}}},
                            "argument": {"variable": "at"}}},
                        "cases": [
                          {
                            "name": "binary",
                            "handler": {
                              "lambda": {
                                "parameter": "_",
                                "domain": "unit",
                                "body": {
                                  "typeApplication": {
                                    "body": {
                                      "typeApplication": {
                                        "body": {
                                          "pair": {
                                            "first": {"inject": {"typeName": "hydra.core.model.LiteralType", "field": {"name": "string", "term": "unit"}}},
                                            "second": {
                                              "typeApplication": {
                                                "body": {
                                                  "typeApplication": {
                                                    "body": {
                                                      "pair": {
                                                        "first": {
                                                          "lambda": {
                                                            "parameter": "v",
                                                            "domain": {"variable": "hydra.core.model.Literal"},
                                                            "body": {
                                                              "application": {
                                                                "function": {
                                                                  "cases": {
                                                                    "typeName": "hydra.core.model.Literal",
                                                                    "default": {"variable": "v"},
                                                                    "cases": [
                                                                      {
                                                                        "name": "binary",
                                                                        "handler": {
                                                                          "lambda": {
                                                                            "parameter": "b",
                                                                            "domain": {"literal": "binary"},
                                                                            "body": {
                                                                              "inject": {
                                                                                "typeName": "hydra.core.model.Literal",
                                                                                "field": {
                                                                                  "name": "string",
                                                                                  "term": {"application": {"function": {"variable": "hydra.core.lib.literals.binaryToBase64"}, "argument": {"variable": "b"}}}}}}}}}]}},
                                                                "argument": {"variable": "v"}}}}},
                                                        "second": {
                                                          "application": {
                                                            "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.fromList"}, "type": {"literal": "string"}}},
                                                            "argument": {"list": [{"literal": {"string": "replace binary strings with character strings"}}]}}}}},
                                                    "type": {"function": {"domain": {"variable": "hydra.core.model.Literal"}, "codomain": {"variable": "hydra.core.model.Literal"}}}}},
                                                "type": {"set": {"literal": "string"}}}}}},
                                        "type": {"variable": "hydra.core.model.LiteralType"}}},
                                    "type": {
                                      "pair": {
                                        "first": {"function": {"domain": {"variable": "hydra.core.model.Literal"}, "codomain": {"variable": "hydra.core.model.Literal"}}},
                                        "second": {"set": {"literal": "string"}}}}}}}}},
                          {
                            "name": "decimal",
                            "handler": {
                              "lambda": {
                                "parameter": "_",
                                "domain": "unit",
                                "body": {
                                  "typeApplication": {
                                    "body": {
                                      "typeApplication": {
                                        "body": {
                                          "pair": {
                                            "first": {
                                              "inject": {
                                                "typeName": "hydra.core.model.LiteralType",
                                                "field": {
                                                  "name": "float",
                                                  "term": {"inject": {"typeName": "hydra.core.model.FloatType", "field": {"name": "float64", "term": "unit"}}}}}},
                                            "second": {
                                              "typeApplication": {
                                                "body": {
                                                  "typeApplication": {
                                                    "body": {
                                                      "pair": {
                                                        "first": {
                                                          "lambda": {
                                                            "parameter": "v",
                                                            "domain": {"variable": "hydra.core.model.Literal"},
                                                            "body": {
                                                              "application": {
                                                                "function": {
                                                                  "cases": {
                                                                    "typeName": "hydra.core.model.Literal",
                                                                    "default": {"variable": "v"},
                                                                    "cases": [
                                                                      {
                                                                        "name": "decimal",
                                                                        "handler": {
                                                                          "lambda": {
                                                                            "parameter": "d",
                                                                            "domain": {"literal": "decimal"},
                                                                            "body": {
                                                                              "inject": {
                                                                                "typeName": "hydra.core.model.Literal",
                                                                                "field": {
                                                                                  "name": "float",
                                                                                  "term": {
                                                                                    "inject": {
                                                                                      "typeName": "hydra.core.model.FloatValue",
                                                                                      "field": {
                                                                                        "name": "float64",
                                                                                        "term": {"application": {"function": {"variable": "hydra.core.lib.literals.decimalToFloat64"}, "argument": {"variable": "d"}}}}}}}}}}}}]}},
                                                                "argument": {"variable": "v"}}}}},
                                                        "second": {
                                                          "application": {
                                                            "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.fromList"}, "type": {"literal": "string"}}},
                                                            "argument": {
                                                              "list": [{"literal": {"string": "replace arbitrary-precision decimal numbers with 64-bit floating-point numbers (doubles)"}}]}}}}},
                                                    "type": {"function": {"domain": {"variable": "hydra.core.model.Literal"}, "codomain": {"variable": "hydra.core.model.Literal"}}}}},
                                                "type": {"set": {"literal": "string"}}}}}},
                                        "type": {"variable": "hydra.core.model.LiteralType"}}},
                                    "type": {
                                      "pair": {
                                        "first": {"function": {"domain": {"variable": "hydra.core.model.Literal"}, "codomain": {"variable": "hydra.core.model.Literal"}}},
                                        "second": {"set": {"literal": "string"}}}}}}}}},
                          {
                            "name": "float",
                            "handler": {
                              "lambda": {
                                "parameter": "ft",
                                "domain": {"variable": "hydra.core.model.FloatType"},
                                "body": {
                                  "let": {
                                    "bindings": [
                                      {
                                        "name": "result",
                                        "term": {
                                          "typeLambda": {
                                            "parameter": "t0",
                                            "body": {
                                              "application": {
                                                "function": {"typeApplication": {"body": {"variable": "hydra.core.adapt.prepareFloatType"}, "type": {"variable": "t0"}}},
                                                "argument": {"variable": "ft"}}}}},
                                        "typeScheme": {
                                          "variables": ["t0"],
                                          "body": {
                                            "pair": {
                                              "first": {"variable": "hydra.core.model.FloatType"},
                                              "second": {
                                                "pair": {
                                                  "first": {
                                                    "function": {"domain": {"variable": "hydra.core.model.FloatValue"}, "codomain": {"variable": "hydra.core.model.FloatValue"}}},
                                                  "second": {"set": {"variable": "t0"}}}}}},
                                          "constraints": [{"key": "t0", "value": {"classes": [{"simple": "ordering"}]}}]}},
                                      {
                                        "name": "rtyp",
                                        "term": {
                                          "application": {
                                            "function": {
                                              "typeApplication": {
                                                "body": {
                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"variable": "hydra.core.model.FloatType"}}},
                                                "type": {
                                                  "pair": {
                                                    "first": {
                                                      "function": {"domain": {"variable": "hydra.core.model.FloatValue"}, "codomain": {"variable": "hydra.core.model.FloatValue"}}},
                                                    "second": {"set": "unit"}}}}},
                                            "argument": {"typeApplication": {"body": {"variable": "result"}, "type": "unit"}}}},
                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.FloatType"}, "constraints": []}},
                                      {
                                        "name": "rep",
                                        "term": {
                                          "application": {
                                            "function": {
                                              "typeApplication": {
                                                "body": {
                                                  "typeApplication": {
                                                    "body": {"variable": "hydra.core.lib.pairs.first"},
                                                    "type": {
                                                      "function": {"domain": {"variable": "hydra.core.model.FloatValue"}, "codomain": {"variable": "hydra.core.model.FloatValue"}}}}},
                                                "type": {"set": "unit"}}},
                                            "argument": {
                                              "application": {
                                                "function": {
                                                  "typeApplication": {
                                                    "body": {
                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"variable": "hydra.core.model.FloatType"}}},
                                                    "type": {
                                                      "pair": {
                                                        "first": {
                                                          "function": {"domain": {"variable": "hydra.core.model.FloatValue"}, "codomain": {"variable": "hydra.core.model.FloatValue"}}},
                                                        "second": {"set": "unit"}}}}},
                                                "argument": {"typeApplication": {"body": {"variable": "result"}, "type": "unit"}}}}}},
                                        "typeScheme": {
                                          "variables": [],
                                          "body": {
                                            "function": {"domain": {"variable": "hydra.core.model.FloatValue"}, "codomain": {"variable": "hydra.core.model.FloatValue"}}},
                                          "constraints": []}},
                                      {
                                        "name": "msgs",
                                        "term": {
                                          "typeLambda": {
                                            "parameter": "t0",
                                            "body": {
                                              "application": {
                                                "function": {
                                                  "typeApplication": {
                                                    "body": {
                                                      "typeApplication": {
                                                        "body": {"variable": "hydra.core.lib.pairs.second"},
                                                        "type": {
                                                          "function": {"domain": {"variable": "hydra.core.model.FloatValue"}, "codomain": {"variable": "hydra.core.model.FloatValue"}}}}},
                                                    "type": {"set": {"variable": "t0"}}}},
                                                "argument": {
                                                  "application": {
                                                    "function": {
                                                      "typeApplication": {
                                                        "body": {
                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"variable": "hydra.core.model.FloatType"}}},
                                                        "type": {
                                                          "pair": {
                                                            "first": {
                                                              "function": {"domain": {"variable": "hydra.core.model.FloatValue"}, "codomain": {"variable": "hydra.core.model.FloatValue"}}},
                                                            "second": {"set": {"variable": "t0"}}}}}},
                                                    "argument": {"typeApplication": {"body": {"variable": "result"}, "type": {"variable": "t0"}}}}}}}}},
                                        "typeScheme": {
                                          "variables": ["t0"],
                                          "body": {"set": {"variable": "t0"}},
                                          "constraints": [{"key": "t0", "value": {"classes": [{"simple": "ordering"}]}}]}}],
                                    "body": {
                                      "typeApplication": {
                                        "body": {
                                          "typeApplication": {
                                            "body": {
                                              "pair": {
                                                "first": {"inject": {"typeName": "hydra.core.model.LiteralType", "field": {"name": "float", "term": {"variable": "rtyp"}}}},
                                                "second": {
                                                  "typeApplication": {
                                                    "body": {
                                                      "typeApplication": {
                                                        "body": {
                                                          "pair": {
                                                            "first": {
                                                              "lambda": {
                                                                "parameter": "v",
                                                                "domain": {"variable": "hydra.core.model.Literal"},
                                                                "body": {
                                                                  "application": {
                                                                    "function": {
                                                                      "cases": {
                                                                        "typeName": "hydra.core.model.Literal",
                                                                        "default": {"variable": "v"},
                                                                        "cases": [
                                                                          {
                                                                            "name": "float",
                                                                            "handler": {
                                                                              "lambda": {
                                                                                "parameter": "fv",
                                                                                "domain": {"variable": "hydra.core.model.FloatValue"},
                                                                                "body": {
                                                                                  "inject": {
                                                                                    "typeName": "hydra.core.model.Literal",
                                                                                    "field": {"name": "float", "term": {"application": {"function": {"variable": "rep"}, "argument": {"variable": "fv"}}}}}}}}}]}},
                                                                    "argument": {"variable": "v"}}}}},
                                                            "second": {"typeApplication": {"body": {"variable": "msgs"}, "type": {"literal": "string"}}}}},
                                                        "type": {"function": {"domain": {"variable": "hydra.core.model.Literal"}, "codomain": {"variable": "hydra.core.model.Literal"}}}}},
                                                    "type": {"set": {"literal": "string"}}}}}},
                                            "type": {"variable": "hydra.core.model.LiteralType"}}},
                                        "type": {
                                          "pair": {
                                            "first": {"function": {"domain": {"variable": "hydra.core.model.Literal"}, "codomain": {"variable": "hydra.core.model.Literal"}}},
                                            "second": {"set": {"literal": "string"}}}}}}}}}}},
                          {
                            "name": "integer",
                            "handler": {
                              "lambda": {
                                "parameter": "it",
                                "domain": {"variable": "hydra.core.model.IntegerType"},
                                "body": {
                                  "let": {
                                    "bindings": [
                                      {
                                        "name": "result",
                                        "term": {"application": {"function": {"variable": "hydra.core.adapt.prepareIntegerType"}, "argument": {"variable": "it"}}},
                                        "typeScheme": {
                                          "variables": [],
                                          "body": {
                                            "pair": {
                                              "first": {"variable": "hydra.core.model.IntegerType"},
                                              "second": {
                                                "pair": {
                                                  "first": {
                                                    "function": {"domain": {"variable": "hydra.core.model.IntegerValue"}, "codomain": {"variable": "hydra.core.model.IntegerValue"}}},
                                                  "second": {"set": {"literal": "string"}}}}}},
                                          "constraints": []}},
                                      {
                                        "name": "rtyp",
                                        "term": {
                                          "application": {
                                            "function": {
                                              "typeApplication": {
                                                "body": {
                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"variable": "hydra.core.model.IntegerType"}}},
                                                "type": {
                                                  "pair": {
                                                    "first": {
                                                      "function": {"domain": {"variable": "hydra.core.model.IntegerValue"}, "codomain": {"variable": "hydra.core.model.IntegerValue"}}},
                                                    "second": {"set": {"literal": "string"}}}}}},
                                            "argument": {"variable": "result"}}},
                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.IntegerType"}, "constraints": []}},
                                      {
                                        "name": "rep",
                                        "term": {
                                          "application": {
                                            "function": {
                                              "typeApplication": {
                                                "body": {
                                                  "typeApplication": {
                                                    "body": {"variable": "hydra.core.lib.pairs.first"},
                                                    "type": {
                                                      "function": {"domain": {"variable": "hydra.core.model.IntegerValue"}, "codomain": {"variable": "hydra.core.model.IntegerValue"}}}}},
                                                "type": {"set": {"literal": "string"}}}},
                                            "argument": {
                                              "application": {
                                                "function": {
                                                  "typeApplication": {
                                                    "body": {
                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"variable": "hydra.core.model.IntegerType"}}},
                                                    "type": {
                                                      "pair": {
                                                        "first": {
                                                          "function": {"domain": {"variable": "hydra.core.model.IntegerValue"}, "codomain": {"variable": "hydra.core.model.IntegerValue"}}},
                                                        "second": {"set": {"literal": "string"}}}}}},
                                                "argument": {"variable": "result"}}}}},
                                        "typeScheme": {
                                          "variables": [],
                                          "body": {
                                            "function": {"domain": {"variable": "hydra.core.model.IntegerValue"}, "codomain": {"variable": "hydra.core.model.IntegerValue"}}},
                                          "constraints": []}},
                                      {
                                        "name": "msgs",
                                        "term": {
                                          "application": {
                                            "function": {
                                              "typeApplication": {
                                                "body": {
                                                  "typeApplication": {
                                                    "body": {"variable": "hydra.core.lib.pairs.second"},
                                                    "type": {
                                                      "function": {"domain": {"variable": "hydra.core.model.IntegerValue"}, "codomain": {"variable": "hydra.core.model.IntegerValue"}}}}},
                                                "type": {"set": {"literal": "string"}}}},
                                            "argument": {
                                              "application": {
                                                "function": {
                                                  "typeApplication": {
                                                    "body": {
                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"variable": "hydra.core.model.IntegerType"}}},
                                                    "type": {
                                                      "pair": {
                                                        "first": {
                                                          "function": {"domain": {"variable": "hydra.core.model.IntegerValue"}, "codomain": {"variable": "hydra.core.model.IntegerValue"}}},
                                                        "second": {"set": {"literal": "string"}}}}}},
                                                "argument": {"variable": "result"}}}}},
                                        "typeScheme": {"variables": [], "body": {"set": {"literal": "string"}}, "constraints": []}}],
                                    "body": {
                                      "typeApplication": {
                                        "body": {
                                          "typeApplication": {
                                            "body": {
                                              "pair": {
                                                "first": {"inject": {"typeName": "hydra.core.model.LiteralType", "field": {"name": "integer", "term": {"variable": "rtyp"}}}},
                                                "second": {
                                                  "typeApplication": {
                                                    "body": {
                                                      "typeApplication": {
                                                        "body": {
                                                          "pair": {
                                                            "first": {
                                                              "lambda": {
                                                                "parameter": "v",
                                                                "domain": {"variable": "hydra.core.model.Literal"},
                                                                "body": {
                                                                  "application": {
                                                                    "function": {
                                                                      "cases": {
                                                                        "typeName": "hydra.core.model.Literal",
                                                                        "default": {"variable": "v"},
                                                                        "cases": [
                                                                          {
                                                                            "name": "integer",
                                                                            "handler": {
                                                                              "lambda": {
                                                                                "parameter": "iv",
                                                                                "domain": {"variable": "hydra.core.model.IntegerValue"},
                                                                                "body": {
                                                                                  "inject": {
                                                                                    "typeName": "hydra.core.model.Literal",
                                                                                    "field": {"name": "integer", "term": {"application": {"function": {"variable": "rep"}, "argument": {"variable": "iv"}}}}}}}}}]}},
                                                                    "argument": {"variable": "v"}}}}},
                                                            "second": {"variable": "msgs"}}},
                                                        "type": {"function": {"domain": {"variable": "hydra.core.model.Literal"}, "codomain": {"variable": "hydra.core.model.Literal"}}}}},
                                                    "type": {"set": {"literal": "string"}}}}}},
                                            "type": {"variable": "hydra.core.model.LiteralType"}}},
                                        "type": {
                                          "pair": {
                                            "first": {"function": {"domain": {"variable": "hydra.core.model.Literal"}, "codomain": {"variable": "hydra.core.model.Literal"}}},
                                            "second": {"set": {"literal": "string"}}}}}}}}}}}]}},
                    "argument": {"variable": "at"}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {"literal": {"string": "Prepare a literal type, substituting unsupported types"}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.adapt.prepareSame",
        "signature": {
          "typeParameters": [
            {"name": "t0", "constraints": []},
            {"name": "t1", "constraints": []},
            {"name": "t2", "constraints": [{"simple": "ordering"}]}],
          "parameters": [{"name": "arg0", "type": {"variable": "t0"}, "isLazy": false}],
          "result": {
            "type": {
              "pair": {
                "first": {"variable": "t0"},
                "second": {
                  "pair": {
                    "first": {"function": {"domain": {"variable": "t1"}, "codomain": {"variable": "t1"}}},
                    "second": {"set": {"variable": "t2"}}}}}}}},
        "body": {
          "typeLambda": {
            "parameter": "t0",
            "body": {
              "typeLambda": {
                "parameter": "t1",
                "body": {
                  "typeLambda": {
                    "parameter": "t2",
                    "body": {
                      "annotated": {
                        "body": {
                          "lambda": {
                            "parameter": "x",
                            "domain": {"variable": "t0"},
                            "body": {
                              "typeApplication": {
                                "body": {
                                  "typeApplication": {
                                    "body": {
                                      "pair": {
                                        "first": {"variable": "x"},
                                        "second": {
                                          "typeApplication": {
                                            "body": {
                                              "typeApplication": {
                                                "body": {
                                                  "pair": {
                                                    "first": {"lambda": {"parameter": "y", "domain": {"variable": "t1"}, "body": {"variable": "y"}}},
                                                    "second": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.empty"}, "type": {"variable": "t2"}}}}},
                                                "type": {"function": {"domain": {"variable": "t1"}, "codomain": {"variable": "t1"}}}}},
                                            "type": {"set": {"variable": "t2"}}}}}},
                                    "type": {"variable": "t0"}}},
                                "type": {
                                  "pair": {
                                    "first": {"function": {"domain": {"variable": "t1"}, "codomain": {"variable": "t1"}}},
                                    "second": {"set": {"variable": "t2"}}}}}}}},
                        "annotation": {
                          "map": [
                            {
                              "key": {"variable": "description"},
                              "value": {"literal": {"string": "Return a value unchanged with identity transform and no messages"}}}]}}}}}}}}}}},
    {
      "term": {
        "name": "hydra.core.adapt.prepareType",
        "signature": {
          "typeParameters": [{"name": "t0", "constraints": []}],
          "parameters": [
            {"name": "arg0", "type": {"variable": "t0"}, "isLazy": false},
            {"name": "arg1", "type": {"variable": "hydra.core.model.Type"}, "isLazy": false}],
          "result": {
            "type": {
              "pair": {
                "first": {"variable": "hydra.core.model.Type"},
                "second": {
                  "pair": {
                    "first": {"function": {"domain": {"variable": "hydra.core.model.Term"}, "codomain": {"variable": "hydra.core.model.Term"}}},
                    "second": {"set": {"literal": "string"}}}}}}}},
        "body": {
          "typeLambda": {
            "parameter": "t0",
            "body": {
              "annotated": {
                "body": {
                  "lambda": {
                    "parameter": "cx",
                    "domain": {"variable": "t0"},
                    "body": {
                      "lambda": {
                        "parameter": "typ",
                        "domain": {"variable": "hydra.core.model.Type"},
                        "body": {
                          "application": {
                            "function": {
                              "cases": {
                                "typeName": "hydra.core.model.Type",
                                "default": {
                                  "application": {
                                    "function": {
                                      "typeApplication": {
                                        "body": {
                                          "typeApplication": {
                                            "body": {
                                              "typeApplication": {"body": {"variable": "hydra.core.adapt.prepareSame"}, "type": {"variable": "hydra.core.model.Type"}}},
                                            "type": {"variable": "hydra.core.model.Term"}}},
                                        "type": {"literal": "string"}}},
                                    "argument": {"variable": "typ"}}},
                                "cases": [
                                  {
                                    "name": "literal",
                                    "handler": {
                                      "lambda": {
                                        "parameter": "at",
                                        "domain": {"variable": "hydra.core.model.LiteralType"},
                                        "body": {
                                          "let": {
                                            "bindings": [
                                              {
                                                "name": "result",
                                                "term": {"application": {"function": {"variable": "hydra.core.adapt.prepareLiteralType"}, "argument": {"variable": "at"}}},
                                                "typeScheme": {
                                                  "variables": [],
                                                  "body": {
                                                    "pair": {
                                                      "first": {"variable": "hydra.core.model.LiteralType"},
                                                      "second": {
                                                        "pair": {
                                                          "first": {"function": {"domain": {"variable": "hydra.core.model.Literal"}, "codomain": {"variable": "hydra.core.model.Literal"}}},
                                                          "second": {"set": {"literal": "string"}}}}}},
                                                  "constraints": []}},
                                              {
                                                "name": "rtyp",
                                                "term": {
                                                  "application": {
                                                    "function": {
                                                      "typeApplication": {
                                                        "body": {
                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"variable": "hydra.core.model.LiteralType"}}},
                                                        "type": {
                                                          "pair": {
                                                            "first": {"function": {"domain": {"variable": "hydra.core.model.Literal"}, "codomain": {"variable": "hydra.core.model.Literal"}}},
                                                            "second": {"set": {"literal": "string"}}}}}},
                                                    "argument": {"variable": "result"}}},
                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.LiteralType"}, "constraints": []}},
                                              {
                                                "name": "rep",
                                                "term": {
                                                  "application": {
                                                    "function": {
                                                      "typeApplication": {
                                                        "body": {
                                                          "typeApplication": {
                                                            "body": {"variable": "hydra.core.lib.pairs.first"},
                                                            "type": {"function": {"domain": {"variable": "hydra.core.model.Literal"}, "codomain": {"variable": "hydra.core.model.Literal"}}}}},
                                                        "type": {"set": {"literal": "string"}}}},
                                                    "argument": {
                                                      "application": {
                                                        "function": {
                                                          "typeApplication": {
                                                            "body": {
                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"variable": "hydra.core.model.LiteralType"}}},
                                                            "type": {
                                                              "pair": {
                                                                "first": {"function": {"domain": {"variable": "hydra.core.model.Literal"}, "codomain": {"variable": "hydra.core.model.Literal"}}},
                                                                "second": {"set": {"literal": "string"}}}}}},
                                                        "argument": {"variable": "result"}}}}},
                                                "typeScheme": {
                                                  "variables": [],
                                                  "body": {"function": {"domain": {"variable": "hydra.core.model.Literal"}, "codomain": {"variable": "hydra.core.model.Literal"}}},
                                                  "constraints": []}},
                                              {
                                                "name": "msgs",
                                                "term": {
                                                  "application": {
                                                    "function": {
                                                      "typeApplication": {
                                                        "body": {
                                                          "typeApplication": {
                                                            "body": {"variable": "hydra.core.lib.pairs.second"},
                                                            "type": {"function": {"domain": {"variable": "hydra.core.model.Literal"}, "codomain": {"variable": "hydra.core.model.Literal"}}}}},
                                                        "type": {"set": {"literal": "string"}}}},
                                                    "argument": {
                                                      "application": {
                                                        "function": {
                                                          "typeApplication": {
                                                            "body": {
                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"variable": "hydra.core.model.LiteralType"}}},
                                                            "type": {
                                                              "pair": {
                                                                "first": {"function": {"domain": {"variable": "hydra.core.model.Literal"}, "codomain": {"variable": "hydra.core.model.Literal"}}},
                                                                "second": {"set": {"literal": "string"}}}}}},
                                                        "argument": {"variable": "result"}}}}},
                                                "typeScheme": {"variables": [], "body": {"set": {"literal": "string"}}, "constraints": []}}],
                                            "body": {
                                              "typeApplication": {
                                                "body": {
                                                  "typeApplication": {
                                                    "body": {
                                                      "pair": {
                                                        "first": {"inject": {"typeName": "hydra.core.model.Type", "field": {"name": "literal", "term": {"variable": "rtyp"}}}},
                                                        "second": {
                                                          "typeApplication": {
                                                            "body": {
                                                              "typeApplication": {
                                                                "body": {
                                                                  "pair": {
                                                                    "first": {
                                                                      "lambda": {
                                                                        "parameter": "v",
                                                                        "domain": {"variable": "hydra.core.model.Term"},
                                                                        "body": {
                                                                          "application": {
                                                                            "function": {
                                                                              "cases": {
                                                                                "typeName": "hydra.core.model.Term",
                                                                                "default": {"variable": "v"},
                                                                                "cases": [
                                                                                  {
                                                                                    "name": "literal",
                                                                                    "handler": {
                                                                                      "lambda": {
                                                                                        "parameter": "av",
                                                                                        "domain": {"variable": "hydra.core.model.Literal"},
                                                                                        "body": {
                                                                                          "inject": {
                                                                                            "typeName": "hydra.core.model.Term",
                                                                                            "field": {"name": "literal", "term": {"application": {"function": {"variable": "rep"}, "argument": {"variable": "av"}}}}}}}}}]}},
                                                                            "argument": {"variable": "v"}}}}},
                                                                    "second": {"variable": "msgs"}}},
                                                                "type": {"function": {"domain": {"variable": "hydra.core.model.Term"}, "codomain": {"variable": "hydra.core.model.Term"}}}}},
                                                            "type": {"set": {"literal": "string"}}}}}},
                                                    "type": {"variable": "hydra.core.model.Type"}}},
                                                "type": {
                                                  "pair": {
                                                    "first": {"function": {"domain": {"variable": "hydra.core.model.Term"}, "codomain": {"variable": "hydra.core.model.Term"}}},
                                                    "second": {"set": {"literal": "string"}}}}}}}}}}}]}},
                            "argument": {"application": {"function": {"variable": "hydra.core.strip.deannotateType"}, "argument": {"variable": "typ"}}}}}}}}},
                "annotation": {
                  "map": [
                    {
                      "key": {"variable": "description"},
                      "value": {"literal": {"string": "Prepare a type, substituting unsupported literal types"}}}]}}}}}}},
    {
      "term": {
        "name": "hydra.core.adapt.pushTypeAppsInward",
        "signature": {
          "typeParameters": [],
          "parameters": [{"name": "arg0", "type": {"variable": "hydra.core.model.Term"}, "isLazy": false}],
          "result": {"type": {"variable": "hydra.core.model.Term"}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "term",
                "domain": {"variable": "hydra.core.model.Term"},
                "body": {
                  "let": {
                    "bindings": [
                      {
                        "name": "push",
                        "term": {
                          "lambda": {
                            "parameter": "body",
                            "domain": {"variable": "hydra.core.model.Term"},
                            "body": {
                              "lambda": {
                                "parameter": "typ",
                                "domain": {"variable": "hydra.core.model.Type"},
                                "body": {
                                  "application": {
                                    "function": {
                                      "cases": {
                                        "typeName": "hydra.core.model.Term",
                                        "default": {
                                          "inject": {
                                            "typeName": "hydra.core.model.Term",
                                            "field": {
                                              "name": "typeApplication",
                                              "term": {
                                                "record": {
                                                  "typeName": "hydra.core.model.TypeApplicationTerm",
                                                  "fields": [{"name": "body", "term": {"variable": "body"}}, {"name": "type", "term": {"variable": "typ"}}]}}}}},
                                        "cases": [
                                          {
                                            "name": "annotated",
                                            "handler": {
                                              "lambda": {
                                                "parameter": "at",
                                                "domain": {"variable": "hydra.core.model.AnnotatedTerm"},
                                                "body": {
                                                  "inject": {
                                                    "typeName": "hydra.core.model.Term",
                                                    "field": {
                                                      "name": "annotated",
                                                      "term": {
                                                        "record": {
                                                          "typeName": "hydra.core.model.AnnotatedTerm",
                                                          "fields": [
                                                            {
                                                              "name": "body",
                                                              "term": {
                                                                "application": {
                                                                  "function": {
                                                                    "application": {
                                                                      "function": {"variable": "push"},
                                                                      "argument": {
                                                                        "application": {
                                                                          "function": {"project": {"typeName": "hydra.core.model.AnnotatedTerm", "fieldName": "body"}},
                                                                          "argument": {"variable": "at"}}}}},
                                                                  "argument": {"variable": "typ"}}}},
                                                            {
                                                              "name": "annotation",
                                                              "term": {
                                                                "application": {
                                                                  "function": {"project": {"typeName": "hydra.core.model.AnnotatedTerm", "fieldName": "annotation"}},
                                                                  "argument": {"variable": "at"}}}}]}}}}}}}},
                                          {
                                            "name": "application",
                                            "handler": {
                                              "lambda": {
                                                "parameter": "a",
                                                "domain": {"variable": "hydra.core.model.Application"},
                                                "body": {
                                                  "application": {
                                                    "function": {"variable": "go"},
                                                    "argument": {
                                                      "inject": {
                                                        "typeName": "hydra.core.model.Term",
                                                        "field": {
                                                          "name": "application",
                                                          "term": {
                                                            "record": {
                                                              "typeName": "hydra.core.model.Application",
                                                              "fields": [
                                                                {
                                                                  "name": "function",
                                                                  "term": {
                                                                    "inject": {
                                                                      "typeName": "hydra.core.model.Term",
                                                                      "field": {
                                                                        "name": "typeApplication",
                                                                        "term": {
                                                                          "record": {
                                                                            "typeName": "hydra.core.model.TypeApplicationTerm",
                                                                            "fields": [
                                                                              {
                                                                                "name": "body",
                                                                                "term": {
                                                                                  "application": {
                                                                                    "function": {"project": {"typeName": "hydra.core.model.Application", "fieldName": "function"}},
                                                                                    "argument": {"variable": "a"}}}},
                                                                              {"name": "type", "term": {"variable": "typ"}}]}}}}}},
                                                                {
                                                                  "name": "argument",
                                                                  "term": {
                                                                    "application": {
                                                                      "function": {"project": {"typeName": "hydra.core.model.Application", "fieldName": "argument"}},
                                                                      "argument": {"variable": "a"}}}}]}}}}}}}}}},
                                          {
                                            "name": "lambda",
                                            "handler": {
                                              "lambda": {
                                                "parameter": "l",
                                                "domain": {"variable": "hydra.core.model.Lambda"},
                                                "body": {
                                                  "application": {
                                                    "function": {"variable": "go"},
                                                    "argument": {
                                                      "inject": {
                                                        "typeName": "hydra.core.model.Term",
                                                        "field": {
                                                          "name": "lambda",
                                                          "term": {
                                                            "record": {
                                                              "typeName": "hydra.core.model.Lambda",
                                                              "fields": [
                                                                {
                                                                  "name": "parameter",
                                                                  "term": {
                                                                    "application": {
                                                                      "function": {"project": {"typeName": "hydra.core.model.Lambda", "fieldName": "parameter"}},
                                                                      "argument": {"variable": "l"}}}},
                                                                {
                                                                  "name": "domain",
                                                                  "term": {
                                                                    "application": {"function": {"project": {"typeName": "hydra.core.model.Lambda", "fieldName": "domain"}}, "argument": {"variable": "l"}}}},
                                                                {
                                                                  "name": "body",
                                                                  "term": {
                                                                    "inject": {
                                                                      "typeName": "hydra.core.model.Term",
                                                                      "field": {
                                                                        "name": "typeApplication",
                                                                        "term": {
                                                                          "record": {
                                                                            "typeName": "hydra.core.model.TypeApplicationTerm",
                                                                            "fields": [
                                                                              {
                                                                                "name": "body",
                                                                                "term": {
                                                                                  "application": {"function": {"project": {"typeName": "hydra.core.model.Lambda", "fieldName": "body"}}, "argument": {"variable": "l"}}}},
                                                                              {"name": "type", "term": {"variable": "typ"}}]}}}}}}]}}}}}}}}}},
                                          {
                                            "name": "let",
                                            "handler": {
                                              "lambda": {
                                                "parameter": "lt",
                                                "domain": {"variable": "hydra.core.model.Let"},
                                                "body": {
                                                  "application": {
                                                    "function": {"variable": "go"},
                                                    "argument": {
                                                      "inject": {
                                                        "typeName": "hydra.core.model.Term",
                                                        "field": {
                                                          "name": "let",
                                                          "term": {
                                                            "record": {
                                                              "typeName": "hydra.core.model.Let",
                                                              "fields": [
                                                                {
                                                                  "name": "bindings",
                                                                  "term": {
                                                                    "application": {"function": {"project": {"typeName": "hydra.core.model.Let", "fieldName": "bindings"}}, "argument": {"variable": "lt"}}}},
                                                                {
                                                                  "name": "body",
                                                                  "term": {
                                                                    "inject": {
                                                                      "typeName": "hydra.core.model.Term",
                                                                      "field": {
                                                                        "name": "typeApplication",
                                                                        "term": {
                                                                          "record": {
                                                                            "typeName": "hydra.core.model.TypeApplicationTerm",
                                                                            "fields": [
                                                                              {
                                                                                "name": "body",
                                                                                "term": {
                                                                                  "application": {"function": {"project": {"typeName": "hydra.core.model.Let", "fieldName": "body"}}, "argument": {"variable": "lt"}}}},
                                                                              {"name": "type", "term": {"variable": "typ"}}]}}}}}}]}}}}}}}}}}]}},
                                    "argument": {"variable": "body"}}}}}}},
                        "typeScheme": {
                          "variables": [],
                          "body": {
                            "function": {
                              "domain": {"variable": "hydra.core.model.Term"},
                              "codomain": {"function": {"domain": {"variable": "hydra.core.model.Type"}, "codomain": {"variable": "hydra.core.model.Term"}}}}},
                          "constraints": []}},
                      {
                        "name": "go",
                        "term": {
                          "lambda": {
                            "parameter": "t",
                            "domain": {"variable": "hydra.core.model.Term"},
                            "body": {
                              "let": {
                                "bindings": [
                                  {
                                    "name": "forField",
                                    "term": {
                                      "lambda": {
                                        "parameter": "fld",
                                        "domain": {"variable": "hydra.core.model.Field"},
                                        "body": {
                                          "record": {
                                            "typeName": "hydra.core.model.Field",
                                            "fields": [
                                              {
                                                "name": "name",
                                                "term": {
                                                  "application": {"function": {"project": {"typeName": "hydra.core.model.Field", "fieldName": "name"}}, "argument": {"variable": "fld"}}}},
                                              {
                                                "name": "term",
                                                "term": {
                                                  "application": {
                                                    "function": {"variable": "go"},
                                                    "argument": {
                                                      "application": {"function": {"project": {"typeName": "hydra.core.model.Field", "fieldName": "term"}}, "argument": {"variable": "fld"}}}}}}]}}}},
                                    "typeScheme": {
                                      "variables": [],
                                      "body": {"function": {"domain": {"variable": "hydra.core.model.Field"}, "codomain": {"variable": "hydra.core.model.Field"}}},
                                      "constraints": []}}],
                                "body": {
                                  "let": {
                                    "bindings": [
                                      {
                                        "name": "forCaseAlternative",
                                        "term": {
                                          "lambda": {
                                            "parameter": "alt",
                                            "domain": {"variable": "hydra.core.model.CaseAlternative"},
                                            "body": {
                                              "record": {
                                                "typeName": "hydra.core.model.CaseAlternative",
                                                "fields": [
                                                  {
                                                    "name": "name",
                                                    "term": {
                                                      "application": {
                                                        "function": {"project": {"typeName": "hydra.core.model.CaseAlternative", "fieldName": "name"}},
                                                        "argument": {"variable": "alt"}}}},
                                                  {
                                                    "name": "handler",
                                                    "term": {
                                                      "application": {
                                                        "function": {"variable": "go"},
                                                        "argument": {
                                                          "application": {
                                                            "function": {"project": {"typeName": "hydra.core.model.CaseAlternative", "fieldName": "handler"}},
                                                            "argument": {"variable": "alt"}}}}}}]}}}},
                                        "typeScheme": {
                                          "variables": [],
                                          "body": {
                                            "function": {
                                              "domain": {"variable": "hydra.core.model.CaseAlternative"},
                                              "codomain": {"variable": "hydra.core.model.CaseAlternative"}}},
                                          "constraints": []}}],
                                    "body": {
                                      "let": {
                                        "bindings": [
                                          {
                                            "name": "forLet",
                                            "term": {
                                              "lambda": {
                                                "parameter": "lt",
                                                "domain": {"variable": "hydra.core.model.Let"},
                                                "body": {
                                                  "let": {
                                                    "bindings": [
                                                      {
                                                        "name": "mapBinding",
                                                        "term": {
                                                          "lambda": {
                                                            "parameter": "b",
                                                            "domain": {"variable": "hydra.core.model.Binding"},
                                                            "body": {
                                                              "record": {
                                                                "typeName": "hydra.core.model.Binding",
                                                                "fields": [
                                                                  {
                                                                    "name": "name",
                                                                    "term": {
                                                                      "application": {"function": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "name"}}, "argument": {"variable": "b"}}}},
                                                                  {
                                                                    "name": "term",
                                                                    "term": {
                                                                      "application": {
                                                                        "function": {"variable": "go"},
                                                                        "argument": {
                                                                          "application": {"function": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "term"}}, "argument": {"variable": "b"}}}}}},
                                                                  {
                                                                    "name": "typeScheme",
                                                                    "term": {
                                                                      "application": {
                                                                        "function": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "typeScheme"}},
                                                                        "argument": {"variable": "b"}}}}]}}}},
                                                        "typeScheme": {
                                                          "variables": [],
                                                          "body": {"function": {"domain": {"variable": "hydra.core.model.Binding"}, "codomain": {"variable": "hydra.core.model.Binding"}}},
                                                          "constraints": []}}],
                                                    "body": {
                                                      "record": {
                                                        "typeName": "hydra.core.model.Let",
                                                        "fields": [
                                                          {
                                                            "name": "bindings",
                                                            "term": {
                                                              "application": {
                                                                "function": {
                                                                  "application": {
                                                                    "function": {
                                                                      "typeApplication": {
                                                                        "body": {
                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.model.Binding"}}},
                                                                        "type": {"variable": "hydra.core.model.Binding"}}},
                                                                    "argument": {"variable": "mapBinding"}}},
                                                                "argument": {
                                                                  "application": {"function": {"project": {"typeName": "hydra.core.model.Let", "fieldName": "bindings"}}, "argument": {"variable": "lt"}}}}}},
                                                          {
                                                            "name": "body",
                                                            "term": {
                                                              "application": {
                                                                "function": {"variable": "go"},
                                                                "argument": {
                                                                  "application": {"function": {"project": {"typeName": "hydra.core.model.Let", "fieldName": "body"}}, "argument": {"variable": "lt"}}}}}}]}}}}}},
                                            "typeScheme": {
                                              "variables": [],
                                              "body": {"function": {"domain": {"variable": "hydra.core.model.Let"}, "codomain": {"variable": "hydra.core.model.Let"}}},
                                              "constraints": []}}],
                                        "body": {
                                          "let": {
                                            "bindings": [
                                              {
                                                "name": "forMap",
                                                "term": {
                                                  "lambda": {
                                                    "parameter": "m",
                                                    "domain": {"map": {"keys": {"variable": "hydra.core.model.Term"}, "values": {"variable": "hydra.core.model.Term"}}},
                                                    "body": {
                                                      "let": {
                                                        "bindings": [
                                                          {
                                                            "name": "forPair",
                                                            "term": {
                                                              "lambda": {
                                                                "parameter": "p",
                                                                "domain": {"pair": {"first": {"variable": "hydra.core.model.Term"}, "second": {"variable": "hydra.core.model.Term"}}},
                                                                "body": {
                                                                  "typeApplication": {
                                                                    "body": {
                                                                      "typeApplication": {
                                                                        "body": {
                                                                          "pair": {
                                                                            "first": {
                                                                              "application": {
                                                                                "function": {"variable": "go"},
                                                                                "argument": {
                                                                                  "application": {
                                                                                    "function": {
                                                                                      "typeApplication": {
                                                                                        "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"variable": "hydra.core.model.Term"}}},
                                                                                        "type": {"variable": "hydra.core.model.Term"}}},
                                                                                    "argument": {"variable": "p"}}}}},
                                                                            "second": {
                                                                              "application": {
                                                                                "function": {"variable": "go"},
                                                                                "argument": {
                                                                                  "application": {
                                                                                    "function": {
                                                                                      "typeApplication": {
                                                                                        "body": {
                                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"variable": "hydra.core.model.Term"}}},
                                                                                        "type": {"variable": "hydra.core.model.Term"}}},
                                                                                    "argument": {"variable": "p"}}}}}}},
                                                                        "type": {"variable": "hydra.core.model.Term"}}},
                                                                    "type": {"variable": "hydra.core.model.Term"}}}}},
                                                            "typeScheme": {
                                                              "variables": [],
                                                              "body": {
                                                                "function": {
                                                                  "domain": {"pair": {"first": {"variable": "hydra.core.model.Term"}, "second": {"variable": "hydra.core.model.Term"}}},
                                                                  "codomain": {"pair": {"first": {"variable": "hydra.core.model.Term"}, "second": {"variable": "hydra.core.model.Term"}}}}},
                                                              "constraints": []}}],
                                                        "body": {
                                                          "application": {
                                                            "function": {
                                                              "typeApplication": {
                                                                "body": {
                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.maps.fromList"}, "type": {"variable": "hydra.core.model.Term"}}},
                                                                "type": {"variable": "hydra.core.model.Term"}}},
                                                            "argument": {
                                                              "application": {
                                                                "function": {
                                                                  "application": {
                                                                    "function": {
                                                                      "typeApplication": {
                                                                        "body": {
                                                                          "typeApplication": {
                                                                            "body": {"variable": "hydra.core.lib.lists.map"},
                                                                            "type": {"pair": {"first": {"variable": "hydra.core.model.Term"}, "second": {"variable": "hydra.core.model.Term"}}}}},
                                                                        "type": {"pair": {"first": {"variable": "hydra.core.model.Term"}, "second": {"variable": "hydra.core.model.Term"}}}}},
                                                                    "argument": {"variable": "forPair"}}},
                                                                "argument": {
                                                                  "application": {
                                                                    "function": {
                                                                      "typeApplication": {
                                                                        "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.toList"}, "type": {"variable": "hydra.core.model.Term"}}},
                                                                        "type": {"variable": "hydra.core.model.Term"}}},
                                                                    "argument": {"variable": "m"}}}}}}}}}}},
                                                "typeScheme": {
                                                  "variables": [],
                                                  "body": {
                                                    "function": {
                                                      "domain": {"map": {"keys": {"variable": "hydra.core.model.Term"}, "values": {"variable": "hydra.core.model.Term"}}},
                                                      "codomain": {"map": {"keys": {"variable": "hydra.core.model.Term"}, "values": {"variable": "hydra.core.model.Term"}}}}},
                                                  "constraints": []}}],
                                            "body": {
                                              "application": {
                                                "function": {
                                                  "cases": {
                                                    "typeName": "hydra.core.model.Term",
                                                    "cases": [
                                                      {
                                                        "name": "annotated",
                                                        "handler": {
                                                          "lambda": {
                                                            "parameter": "at",
                                                            "domain": {"variable": "hydra.core.model.AnnotatedTerm"},
                                                            "body": {
                                                              "inject": {
                                                                "typeName": "hydra.core.model.Term",
                                                                "field": {
                                                                  "name": "annotated",
                                                                  "term": {
                                                                    "record": {
                                                                      "typeName": "hydra.core.model.AnnotatedTerm",
                                                                      "fields": [
                                                                        {
                                                                          "name": "body",
                                                                          "term": {
                                                                            "application": {
                                                                              "function": {"variable": "go"},
                                                                              "argument": {
                                                                                "application": {
                                                                                  "function": {"project": {"typeName": "hydra.core.model.AnnotatedTerm", "fieldName": "body"}},
                                                                                  "argument": {"variable": "at"}}}}}},
                                                                        {
                                                                          "name": "annotation",
                                                                          "term": {
                                                                            "application": {
                                                                              "function": {"project": {"typeName": "hydra.core.model.AnnotatedTerm", "fieldName": "annotation"}},
                                                                              "argument": {"variable": "at"}}}}]}}}}}}}},
                                                      {
                                                        "name": "application",
                                                        "handler": {
                                                          "lambda": {
                                                            "parameter": "a",
                                                            "domain": {"variable": "hydra.core.model.Application"},
                                                            "body": {
                                                              "inject": {
                                                                "typeName": "hydra.core.model.Term",
                                                                "field": {
                                                                  "name": "application",
                                                                  "term": {
                                                                    "record": {
                                                                      "typeName": "hydra.core.model.Application",
                                                                      "fields": [
                                                                        {
                                                                          "name": "function",
                                                                          "term": {
                                                                            "application": {
                                                                              "function": {"variable": "go"},
                                                                              "argument": {
                                                                                "application": {
                                                                                  "function": {"project": {"typeName": "hydra.core.model.Application", "fieldName": "function"}},
                                                                                  "argument": {"variable": "a"}}}}}},
                                                                        {
                                                                          "name": "argument",
                                                                          "term": {
                                                                            "application": {
                                                                              "function": {"variable": "go"},
                                                                              "argument": {
                                                                                "application": {
                                                                                  "function": {"project": {"typeName": "hydra.core.model.Application", "fieldName": "argument"}},
                                                                                  "argument": {"variable": "a"}}}}}}]}}}}}}}},
                                                      {
                                                        "name": "cases",
                                                        "handler": {
                                                          "lambda": {
                                                            "parameter": "cs",
                                                            "domain": {"variable": "hydra.core.model.CaseStatement"},
                                                            "body": {
                                                              "inject": {
                                                                "typeName": "hydra.core.model.Term",
                                                                "field": {
                                                                  "name": "cases",
                                                                  "term": {
                                                                    "record": {
                                                                      "typeName": "hydra.core.model.CaseStatement",
                                                                      "fields": [
                                                                        {
                                                                          "name": "typeName",
                                                                          "term": {
                                                                            "application": {
                                                                              "function": {"project": {"typeName": "hydra.core.model.CaseStatement", "fieldName": "typeName"}},
                                                                              "argument": {"variable": "cs"}}}},
                                                                        {
                                                                          "name": "default",
                                                                          "term": {
                                                                            "application": {
                                                                              "function": {
                                                                                "application": {
                                                                                  "function": {
                                                                                    "typeApplication": {
                                                                                      "body": {
                                                                                        "typeApplication": {"body": {"variable": "hydra.core.lib.optionals.map"}, "type": {"variable": "hydra.core.model.Term"}}},
                                                                                      "type": {"variable": "hydra.core.model.Term"}}},
                                                                                  "argument": {"variable": "go"}}},
                                                                              "argument": {
                                                                                "application": {
                                                                                  "function": {"project": {"typeName": "hydra.core.model.CaseStatement", "fieldName": "default"}},
                                                                                  "argument": {"variable": "cs"}}}}}},
                                                                        {
                                                                          "name": "cases",
                                                                          "term": {
                                                                            "application": {
                                                                              "function": {
                                                                                "application": {
                                                                                  "function": {
                                                                                    "typeApplication": {
                                                                                      "body": {
                                                                                        "typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.model.CaseAlternative"}}},
                                                                                      "type": {"variable": "hydra.core.model.CaseAlternative"}}},
                                                                                  "argument": {"variable": "forCaseAlternative"}}},
                                                                              "argument": {
                                                                                "application": {
                                                                                  "function": {"project": {"typeName": "hydra.core.model.CaseStatement", "fieldName": "cases"}},
                                                                                  "argument": {"variable": "cs"}}}}}}]}}}}}}}},
                                                      {
                                                        "name": "either",
                                                        "handler": {
                                                          "lambda": {
                                                            "parameter": "e",
                                                            "domain": {"either": {"left": {"variable": "hydra.core.model.Term"}, "right": {"variable": "hydra.core.model.Term"}}},
                                                            "body": {
                                                              "inject": {
                                                                "typeName": "hydra.core.model.Term",
                                                                "field": {
                                                                  "name": "either",
                                                                  "term": {
                                                                    "application": {
                                                                      "function": {
                                                                        "application": {
                                                                          "function": {
                                                                            "application": {
                                                                              "function": {
                                                                                "typeApplication": {
                                                                                  "body": {
                                                                                    "typeApplication": {
                                                                                      "body": {
                                                                                        "typeApplication": {"body": {"variable": "hydra.core.lib.eithers.either"}, "type": {"variable": "hydra.core.model.Term"}}},
                                                                                      "type": {"variable": "hydra.core.model.Term"}}},
                                                                                  "type": {"either": {"left": {"variable": "hydra.core.model.Term"}, "right": {"variable": "hydra.core.model.Term"}}}}},
                                                                              "argument": {
                                                                                "lambda": {
                                                                                  "parameter": "l",
                                                                                  "domain": {"variable": "hydra.core.model.Term"},
                                                                                  "body": {
                                                                                    "typeApplication": {
                                                                                      "body": {
                                                                                        "typeApplication": {
                                                                                          "body": {"either": {"left": {"application": {"function": {"variable": "go"}, "argument": {"variable": "l"}}}}},
                                                                                          "type": {"variable": "hydra.core.model.Term"}}},
                                                                                      "type": {"variable": "hydra.core.model.Term"}}}}}}},
                                                                          "argument": {
                                                                            "lambda": {
                                                                              "parameter": "r",
                                                                              "domain": {"variable": "hydra.core.model.Term"},
                                                                              "body": {
                                                                                "typeApplication": {
                                                                                  "body": {
                                                                                    "typeApplication": {
                                                                                      "body": {"either": {"right": {"application": {"function": {"variable": "go"}, "argument": {"variable": "r"}}}}},
                                                                                      "type": {"variable": "hydra.core.model.Term"}}},
                                                                                  "type": {"variable": "hydra.core.model.Term"}}}}}}},
                                                                      "argument": {"variable": "e"}}}}}}}}},
                                                      {
                                                        "name": "lambda",
                                                        "handler": {
                                                          "lambda": {
                                                            "parameter": "l",
                                                            "domain": {"variable": "hydra.core.model.Lambda"},
                                                            "body": {
                                                              "inject": {
                                                                "typeName": "hydra.core.model.Term",
                                                                "field": {
                                                                  "name": "lambda",
                                                                  "term": {
                                                                    "record": {
                                                                      "typeName": "hydra.core.model.Lambda",
                                                                      "fields": [
                                                                        {
                                                                          "name": "parameter",
                                                                          "term": {
                                                                            "application": {
                                                                              "function": {"project": {"typeName": "hydra.core.model.Lambda", "fieldName": "parameter"}},
                                                                              "argument": {"variable": "l"}}}},
                                                                        {
                                                                          "name": "domain",
                                                                          "term": {
                                                                            "application": {"function": {"project": {"typeName": "hydra.core.model.Lambda", "fieldName": "domain"}}, "argument": {"variable": "l"}}}},
                                                                        {
                                                                          "name": "body",
                                                                          "term": {
                                                                            "application": {
                                                                              "function": {"variable": "go"},
                                                                              "argument": {
                                                                                "application": {"function": {"project": {"typeName": "hydra.core.model.Lambda", "fieldName": "body"}}, "argument": {"variable": "l"}}}}}}]}}}}}}}},
                                                      {
                                                        "name": "let",
                                                        "handler": {
                                                          "lambda": {
                                                            "parameter": "lt",
                                                            "domain": {"variable": "hydra.core.model.Let"},
                                                            "body": {
                                                              "inject": {
                                                                "typeName": "hydra.core.model.Term",
                                                                "field": {"name": "let", "term": {"application": {"function": {"variable": "forLet"}, "argument": {"variable": "lt"}}}}}}}}},
                                                      {
                                                        "name": "list",
                                                        "handler": {
                                                          "lambda": {
                                                            "parameter": "els",
                                                            "domain": {"list": {"variable": "hydra.core.model.Term"}},
                                                            "body": {
                                                              "inject": {
                                                                "typeName": "hydra.core.model.Term",
                                                                "field": {
                                                                  "name": "list",
                                                                  "term": {
                                                                    "application": {
                                                                      "function": {
                                                                        "application": {
                                                                          "function": {
                                                                            "typeApplication": {
                                                                              "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.model.Term"}}},
                                                                              "type": {"variable": "hydra.core.model.Term"}}},
                                                                          "argument": {"variable": "go"}}},
                                                                      "argument": {"variable": "els"}}}}}}}}},
                                                      {
                                                        "name": "literal",
                                                        "handler": {
                                                          "lambda": {
                                                            "parameter": "v",
                                                            "domain": {"variable": "hydra.core.model.Literal"},
                                                            "body": {"inject": {"typeName": "hydra.core.model.Term", "field": {"name": "literal", "term": {"variable": "v"}}}}}}},
                                                      {
                                                        "name": "map",
                                                        "handler": {
                                                          "lambda": {
                                                            "parameter": "m",
                                                            "domain": {"map": {"keys": {"variable": "hydra.core.model.Term"}, "values": {"variable": "hydra.core.model.Term"}}},
                                                            "body": {
                                                              "inject": {
                                                                "typeName": "hydra.core.model.Term",
                                                                "field": {"name": "map", "term": {"application": {"function": {"variable": "forMap"}, "argument": {"variable": "m"}}}}}}}}},
                                                      {
                                                        "name": "optional",
                                                        "handler": {
                                                          "lambda": {
                                                            "parameter": "m",
                                                            "domain": {"optional": {"variable": "hydra.core.model.Term"}},
                                                            "body": {
                                                              "inject": {
                                                                "typeName": "hydra.core.model.Term",
                                                                "field": {
                                                                  "name": "optional",
                                                                  "term": {
                                                                    "application": {
                                                                      "function": {
                                                                        "application": {
                                                                          "function": {
                                                                            "typeApplication": {
                                                                              "body": {
                                                                                "typeApplication": {"body": {"variable": "hydra.core.lib.optionals.map"}, "type": {"variable": "hydra.core.model.Term"}}},
                                                                              "type": {"variable": "hydra.core.model.Term"}}},
                                                                          "argument": {"variable": "go"}}},
                                                                      "argument": {"variable": "m"}}}}}}}}},
                                                      {
                                                        "name": "pair",
                                                        "handler": {
                                                          "lambda": {
                                                            "parameter": "p",
                                                            "domain": {"pair": {"first": {"variable": "hydra.core.model.Term"}, "second": {"variable": "hydra.core.model.Term"}}},
                                                            "body": {
                                                              "inject": {
                                                                "typeName": "hydra.core.model.Term",
                                                                "field": {
                                                                  "name": "pair",
                                                                  "term": {
                                                                    "typeApplication": {
                                                                      "body": {
                                                                        "typeApplication": {
                                                                          "body": {
                                                                            "pair": {
                                                                              "first": {
                                                                                "application": {
                                                                                  "function": {"variable": "go"},
                                                                                  "argument": {
                                                                                    "application": {
                                                                                      "function": {
                                                                                        "typeApplication": {
                                                                                          "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"variable": "hydra.core.model.Term"}}},
                                                                                          "type": {"variable": "hydra.core.model.Term"}}},
                                                                                      "argument": {"variable": "p"}}}}},
                                                                              "second": {
                                                                                "application": {
                                                                                  "function": {"variable": "go"},
                                                                                  "argument": {
                                                                                    "application": {
                                                                                      "function": {
                                                                                        "typeApplication": {
                                                                                          "body": {
                                                                                            "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"variable": "hydra.core.model.Term"}}},
                                                                                          "type": {"variable": "hydra.core.model.Term"}}},
                                                                                      "argument": {"variable": "p"}}}}}}},
                                                                          "type": {"variable": "hydra.core.model.Term"}}},
                                                                      "type": {"variable": "hydra.core.model.Term"}}}}}}}}},
                                                      {
                                                        "name": "project",
                                                        "handler": {
                                                          "lambda": {
                                                            "parameter": "p",
                                                            "domain": {"variable": "hydra.core.model.Projection"},
                                                            "body": {"inject": {"typeName": "hydra.core.model.Term", "field": {"name": "project", "term": {"variable": "p"}}}}}}},
                                                      {
                                                        "name": "record",
                                                        "handler": {
                                                          "lambda": {
                                                            "parameter": "r",
                                                            "domain": {"variable": "hydra.core.model.Record"},
                                                            "body": {
                                                              "inject": {
                                                                "typeName": "hydra.core.model.Term",
                                                                "field": {
                                                                  "name": "record",
                                                                  "term": {
                                                                    "record": {
                                                                      "typeName": "hydra.core.model.Record",
                                                                      "fields": [
                                                                        {
                                                                          "name": "typeName",
                                                                          "term": {
                                                                            "application": {
                                                                              "function": {"project": {"typeName": "hydra.core.model.Record", "fieldName": "typeName"}},
                                                                              "argument": {"variable": "r"}}}},
                                                                        {
                                                                          "name": "fields",
                                                                          "term": {
                                                                            "application": {
                                                                              "function": {
                                                                                "application": {
                                                                                  "function": {
                                                                                    "typeApplication": {
                                                                                      "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.model.Field"}}},
                                                                                      "type": {"variable": "hydra.core.model.Field"}}},
                                                                                  "argument": {"variable": "forField"}}},
                                                                              "argument": {
                                                                                "application": {"function": {"project": {"typeName": "hydra.core.model.Record", "fieldName": "fields"}}, "argument": {"variable": "r"}}}}}}]}}}}}}}},
                                                      {
                                                        "name": "set",
                                                        "handler": {
                                                          "lambda": {
                                                            "parameter": "s",
                                                            "domain": {"set": {"variable": "hydra.core.model.Term"}},
                                                            "body": {
                                                              "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": {
                                                                        "application": {
                                                                          "function": {
                                                                            "application": {
                                                                              "function": {
                                                                                "typeApplication": {
                                                                                  "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.model.Term"}}},
                                                                                  "type": {"variable": "hydra.core.model.Term"}}},
                                                                              "argument": {"variable": "go"}}},
                                                                          "argument": {
                                                                            "application": {
                                                                              "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.toList"}, "type": {"variable": "hydra.core.model.Term"}}},
                                                                              "argument": {"variable": "s"}}}}}}}}}}}}},
                                                      {
                                                        "name": "typeApplication",
                                                        "handler": {
                                                          "lambda": {
                                                            "parameter": "tt",
                                                            "domain": {"variable": "hydra.core.model.TypeApplicationTerm"},
                                                            "body": {
                                                              "let": {
                                                                "bindings": [
                                                                  {
                                                                    "name": "body1",
                                                                    "term": {
                                                                      "application": {
                                                                        "function": {"variable": "go"},
                                                                        "argument": {
                                                                          "application": {
                                                                            "function": {"project": {"typeName": "hydra.core.model.TypeApplicationTerm", "fieldName": "body"}},
                                                                            "argument": {"variable": "tt"}}}}},
                                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                                                "body": {
                                                                  "application": {
                                                                    "function": {"application": {"function": {"variable": "push"}, "argument": {"variable": "body1"}}},
                                                                    "argument": {
                                                                      "application": {
                                                                        "function": {"project": {"typeName": "hydra.core.model.TypeApplicationTerm", "fieldName": "type"}},
                                                                        "argument": {"variable": "tt"}}}}}}}}}},
                                                      {
                                                        "name": "typeLambda",
                                                        "handler": {
                                                          "lambda": {
                                                            "parameter": "ta",
                                                            "domain": {"variable": "hydra.core.model.TypeLambda"},
                                                            "body": {
                                                              "inject": {
                                                                "typeName": "hydra.core.model.Term",
                                                                "field": {
                                                                  "name": "typeLambda",
                                                                  "term": {
                                                                    "record": {
                                                                      "typeName": "hydra.core.model.TypeLambda",
                                                                      "fields": [
                                                                        {
                                                                          "name": "parameter",
                                                                          "term": {
                                                                            "application": {
                                                                              "function": {"project": {"typeName": "hydra.core.model.TypeLambda", "fieldName": "parameter"}},
                                                                              "argument": {"variable": "ta"}}}},
                                                                        {
                                                                          "name": "body",
                                                                          "term": {
                                                                            "application": {
                                                                              "function": {"variable": "go"},
                                                                              "argument": {
                                                                                "application": {
                                                                                  "function": {"project": {"typeName": "hydra.core.model.TypeLambda", "fieldName": "body"}},
                                                                                  "argument": {"variable": "ta"}}}}}}]}}}}}}}},
                                                      {
                                                        "name": "inject",
                                                        "handler": {
                                                          "lambda": {
                                                            "parameter": "i",
                                                            "domain": {"variable": "hydra.core.model.Injection"},
                                                            "body": {
                                                              "inject": {
                                                                "typeName": "hydra.core.model.Term",
                                                                "field": {
                                                                  "name": "inject",
                                                                  "term": {
                                                                    "record": {
                                                                      "typeName": "hydra.core.model.Injection",
                                                                      "fields": [
                                                                        {
                                                                          "name": "typeName",
                                                                          "term": {
                                                                            "application": {
                                                                              "function": {"project": {"typeName": "hydra.core.model.Injection", "fieldName": "typeName"}},
                                                                              "argument": {"variable": "i"}}}},
                                                                        {
                                                                          "name": "field",
                                                                          "term": {
                                                                            "application": {
                                                                              "function": {"variable": "forField"},
                                                                              "argument": {
                                                                                "application": {
                                                                                  "function": {"project": {"typeName": "hydra.core.model.Injection", "fieldName": "field"}},
                                                                                  "argument": {"variable": "i"}}}}}}]}}}}}}}},
                                                      {
                                                        "name": "unit",
                                                        "handler": {
                                                          "lambda": {
                                                            "parameter": "_",
                                                            "domain": "unit",
                                                            "body": {"inject": {"typeName": "hydra.core.model.Term", "field": {"name": "unit", "term": "unit"}}}}}},
                                                      {
                                                        "name": "unwrap",
                                                        "handler": {
                                                          "lambda": {
                                                            "parameter": "n",
                                                            "domain": {"variable": "hydra.core.model.Name"},
                                                            "body": {"inject": {"typeName": "hydra.core.model.Term", "field": {"name": "unwrap", "term": {"variable": "n"}}}}}}},
                                                      {
                                                        "name": "variable",
                                                        "handler": {
                                                          "lambda": {
                                                            "parameter": "v",
                                                            "domain": {"variable": "hydra.core.model.Name"},
                                                            "body": {"inject": {"typeName": "hydra.core.model.Term", "field": {"name": "variable", "term": {"variable": "v"}}}}}}},
                                                      {
                                                        "name": "wrap",
                                                        "handler": {
                                                          "lambda": {
                                                            "parameter": "wt",
                                                            "domain": {"variable": "hydra.core.model.WrappedTerm"},
                                                            "body": {
                                                              "inject": {
                                                                "typeName": "hydra.core.model.Term",
                                                                "field": {
                                                                  "name": "wrap",
                                                                  "term": {
                                                                    "record": {
                                                                      "typeName": "hydra.core.model.WrappedTerm",
                                                                      "fields": [
                                                                        {
                                                                          "name": "typeName",
                                                                          "term": {
                                                                            "application": {
                                                                              "function": {"project": {"typeName": "hydra.core.model.WrappedTerm", "fieldName": "typeName"}},
                                                                              "argument": {"variable": "wt"}}}},
                                                                        {
                                                                          "name": "body",
                                                                          "term": {
                                                                            "application": {
                                                                              "function": {"variable": "go"},
                                                                              "argument": {
                                                                                "application": {
                                                                                  "function": {"project": {"typeName": "hydra.core.model.WrappedTerm", "fieldName": "body"}},
                                                                                  "argument": {"variable": "wt"}}}}}}]}}}}}}}}]}},
                                                "argument": {"variable": "t"}}}}}}}}}}}}},
                        "typeScheme": {
                          "variables": [],
                          "body": {"function": {"domain": {"variable": "hydra.core.model.Term"}, "codomain": {"variable": "hydra.core.model.Term"}}},
                          "constraints": []}}],
                    "body": {"application": {"function": {"variable": "go"}, "argument": {"variable": "term"}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {
                    "literal": {
                      "string": "Normalize a term by pushing TermTypeApplication inward past TermApplication and TermLambda. This corrects structures produced by poly-let hoisting and eta expansion, where type applications from inference end up wrapping term applications or lambda abstractions instead of being directly on the polymorphic variable."}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.adapt.schemaGraphToDefinitions",
        "signature": {
          "typeParameters": [{"name": "t0", "constraints": []}],
          "parameters": [
            {"name": "arg0", "type": {"variable": "hydra.core.coders.LanguageConstraints"}, "isLazy": false},
            {"name": "arg1", "type": {"variable": "hydra.core.graph.Graph"}, "isLazy": false},
            {"name": "arg2", "type": {"list": {"list": {"variable": "hydra.core.model.Name"}}}, "isLazy": false},
            {"name": "arg3", "type": {"variable": "t0"}, "isLazy": false}],
          "result": {
            "type": {
              "either": {
                "left": {"variable": "hydra.core.errors.Error"},
                "right": {
                  "pair": {
                    "first": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.Type"}}},
                    "second": {"list": {"list": {"variable": "hydra.core.packaging.TypeDefinition"}}}}}}}}},
        "body": {
          "typeLambda": {
            "parameter": "t0",
            "body": {
              "annotated": {
                "body": {
                  "lambda": {
                    "parameter": "constraints",
                    "domain": {"variable": "hydra.core.coders.LanguageConstraints"},
                    "body": {
                      "lambda": {
                        "parameter": "graph",
                        "domain": {"variable": "hydra.core.graph.Graph"},
                        "body": {
                          "lambda": {
                            "parameter": "nameLists",
                            "domain": {"list": {"list": {"variable": "hydra.core.model.Name"}}},
                            "body": {
                              "lambda": {
                                "parameter": "cx",
                                "domain": {"variable": "t0"},
                                "body": {
                                  "let": {
                                    "bindings": [
                                      {
                                        "name": "litmap",
                                        "term": {
                                          "application": {"function": {"variable": "hydra.core.adapt.adaptLiteralTypesMap"}, "argument": {"variable": "constraints"}}},
                                        "typeScheme": {
                                          "variables": [],
                                          "body": {"map": {"keys": {"variable": "hydra.core.model.LiteralType"}, "values": {"variable": "hydra.core.model.LiteralType"}}},
                                          "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": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.Type"}}}}},
                                                "type": {
                                                  "pair": {
                                                    "first": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.Type"}}},
                                                    "second": {"list": {"list": {"variable": "hydra.core.packaging.TypeDefinition"}}}}}}},
                                            "argument": {
                                              "application": {
                                                "function": {
                                                  "application": {
                                                    "function": {
                                                      "application": {
                                                        "function": {
                                                          "typeApplication": {
                                                            "body": {
                                                              "typeApplication": {
                                                                "body": {
                                                                  "typeApplication": {
                                                                    "body": {
                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.eithers.bimap"}, "type": {"variable": "hydra.core.errors.DecodingError"}}},
                                                                    "type": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.Type"}}}}},
                                                                "type": {"variable": "hydra.core.errors.Error"}}},
                                                            "type": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.Type"}}}}},
                                                        "argument": {
                                                          "lambda": {
                                                            "parameter": "e",
                                                            "domain": {"variable": "hydra.core.errors.DecodingError"},
                                                            "body": {"inject": {"typeName": "hydra.core.errors.Error", "field": {"name": "decoding", "term": {"variable": "e"}}}}}}}},
                                                    "argument": {
                                                      "lambda": {
                                                        "parameter": "x",
                                                        "domain": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.Type"}}},
                                                        "body": {"variable": "x"}}}}},
                                                "argument": {
                                                  "application": {
                                                    "function": {"application": {"function": {"variable": "hydra.core.environment.graphAsTypes"}, "argument": {"variable": "graph"}}},
                                                    "argument": {"application": {"function": {"variable": "hydra.core.lexical.graphToBindings"}, "argument": {"variable": "graph"}}}}}}}}},
                                        "argument": {
                                          "lambda": {
                                            "parameter": "tmap0",
                                            "domain": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"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": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.Type"}}}}},
                                                        "type": {
                                                          "pair": {
                                                            "first": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.Type"}}},
                                                            "second": {"list": {"list": {"variable": "hydra.core.packaging.TypeDefinition"}}}}}}},
                                                    "argument": {
                                                      "application": {
                                                        "function": {
                                                          "application": {
                                                            "function": {
                                                              "application": {
                                                                "function": {
                                                                  "typeApplication": {"body": {"variable": "hydra.core.adapt.adaptGraphSchema"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                "argument": {"variable": "constraints"}}},
                                                            "argument": {"variable": "litmap"}}},
                                                        "argument": {"variable": "tmap0"}}}}},
                                                "argument": {
                                                  "lambda": {
                                                    "parameter": "tmap1",
                                                    "domain": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.Type"}}},
                                                    "body": {
                                                      "let": {
                                                        "bindings": [
                                                          {
                                                            "name": "toDef",
                                                            "term": {
                                                              "lambda": {
                                                                "parameter": "pair",
                                                                "domain": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.model.Type"}}},
                                                                "body": {
                                                                  "record": {
                                                                    "typeName": "hydra.core.packaging.TypeDefinition",
                                                                    "fields": [
                                                                      {
                                                                        "name": "name",
                                                                        "term": {
                                                                          "application": {
                                                                            "function": {
                                                                              "typeApplication": {
                                                                                "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                "type": {"variable": "hydra.core.model.Type"}}},
                                                                            "argument": {"variable": "pair"}}}},
                                                                      {
                                                                        "name": "metadata",
                                                                        "term": {"typeApplication": {"body": {"optional": null}, "type": {"variable": "hydra.core.packaging.EntityMetadata"}}}},
                                                                      {
                                                                        "name": "body",
                                                                        "term": {
                                                                          "record": {
                                                                            "typeName": "hydra.core.model.TypeScheme",
                                                                            "fields": [
                                                                              {
                                                                                "name": "variables",
                                                                                "term": {"typeApplication": {"body": {"list": []}, "type": {"variable": "hydra.core.model.Name"}}}},
                                                                              {
                                                                                "name": "body",
                                                                                "term": {
                                                                                  "application": {
                                                                                    "function": {
                                                                                      "typeApplication": {
                                                                                        "body": {
                                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                        "type": {"variable": "hydra.core.model.Type"}}},
                                                                                    "argument": {"variable": "pair"}}}},
                                                                              {
                                                                                "name": "constraints",
                                                                                "term": {
                                                                                  "typeApplication": {
                                                                                    "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.empty"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                    "type": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}]}}}]}}}},
                                                            "typeScheme": {
                                                              "variables": [],
                                                              "body": {
                                                                "function": {
                                                                  "domain": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.model.Type"}}},
                                                                  "codomain": {"variable": "hydra.core.packaging.TypeDefinition"}}},
                                                              "constraints": []}}],
                                                        "body": {
                                                          "typeApplication": {
                                                            "body": {
                                                              "typeApplication": {
                                                                "body": {
                                                                  "either": {
                                                                    "right": {
                                                                      "typeApplication": {
                                                                        "body": {
                                                                          "typeApplication": {
                                                                            "body": {
                                                                              "pair": {
                                                                                "first": {"variable": "tmap1"},
                                                                                "second": {
                                                                                  "application": {
                                                                                    "function": {
                                                                                      "application": {
                                                                                        "function": {
                                                                                          "typeApplication": {
                                                                                            "body": {
                                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"list": {"variable": "hydra.core.model.Name"}}}},
                                                                                            "type": {"list": {"variable": "hydra.core.packaging.TypeDefinition"}}}},
                                                                                        "argument": {
                                                                                          "lambda": {
                                                                                            "parameter": "names",
                                                                                            "domain": {"list": {"variable": "hydra.core.model.Name"}},
                                                                                            "body": {
                                                                                              "application": {
                                                                                                "function": {
                                                                                                  "application": {
                                                                                                    "function": {
                                                                                                      "typeApplication": {
                                                                                                        "body": {
                                                                                                          "typeApplication": {
                                                                                                            "body": {"variable": "hydra.core.lib.lists.map"},
                                                                                                            "type": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.model.Type"}}}}},
                                                                                                        "type": {"variable": "hydra.core.packaging.TypeDefinition"}}},
                                                                                                    "argument": {"variable": "toDef"}}},
                                                                                                "argument": {
                                                                                                  "application": {
                                                                                                    "function": {
                                                                                                      "application": {
                                                                                                        "function": {
                                                                                                          "typeApplication": {
                                                                                                            "body": {
                                                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.optionals.mapOptional"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                            "type": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.model.Type"}}}}},
                                                                                                        "argument": {
                                                                                                          "lambda": {
                                                                                                            "parameter": "n",
                                                                                                            "domain": {"variable": "hydra.core.model.Name"},
                                                                                                            "body": {
                                                                                                              "application": {
                                                                                                                "function": {
                                                                                                                  "application": {
                                                                                                                    "function": {
                                                                                                                      "typeApplication": {
                                                                                                                        "body": {
                                                                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.optionals.map"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                                                                        "type": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.model.Type"}}}}},
                                                                                                                    "argument": {
                                                                                                                      "lambda": {
                                                                                                                        "parameter": "t",
                                                                                                                        "domain": {"variable": "hydra.core.model.Type"},
                                                                                                                        "body": {
                                                                                                                          "typeApplication": {
                                                                                                                            "body": {
                                                                                                                              "typeApplication": {
                                                                                                                                "body": {"pair": {"first": {"variable": "n"}, "second": {"variable": "t"}}},
                                                                                                                                "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                                            "type": {"variable": "hydra.core.model.Type"}}}}}}},
                                                                                                                "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": "n"}}},
                                                                                                                    "argument": {"variable": "tmap1"}}}}}}}}},
                                                                                                    "argument": {"variable": "names"}}}}}}}}},
                                                                                    "argument": {"variable": "nameLists"}}}}},
                                                                            "type": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.Type"}}}}},
                                                                        "type": {"list": {"list": {"variable": "hydra.core.packaging.TypeDefinition"}}}}}}},
                                                                "type": {"variable": "hydra.core.errors.Error"}}},
                                                            "type": {
                                                              "pair": {
                                                                "first": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.Type"}}},
                                                                "second": {"list": {"list": {"variable": "hydra.core.packaging.TypeDefinition"}}}}}}}}}}}}}}}}}}}}}}}}}}},
                "annotation": {
                  "map": [
                    {
                      "key": {"variable": "description"},
                      "value": {
                        "literal": {
                          "string": "Given a schema graph along with language constraints and a designated list of element names, adapt the graph to the language constraints, then return a corresponding type definition for each element name."}}}]}}}}}}},
    {
      "term": {
        "name": "hydra.core.adapt.simpleLanguageAdapter",
        "signature": {
          "typeParameters": [{"name": "t0", "constraints": []}],
          "parameters": [
            {"name": "arg0", "type": {"variable": "hydra.core.coders.Language"}, "isLazy": false},
            {"name": "arg1", "type": {"variable": "t0"}, "isLazy": false},
            {"name": "arg2", "type": {"variable": "hydra.core.graph.Graph"}, "isLazy": false},
            {"name": "arg3", "type": {"variable": "hydra.core.model.Type"}, "isLazy": false}],
          "result": {
            "type": {
              "either": {
                "left": {"variable": "hydra.core.errors.Error"},
                "right": {
                  "application": {
                    "function": {
                      "application": {
                        "function": {
                          "application": {
                            "function": {
                              "application": {
                                "function": {
                                  "application": {"function": {"variable": "hydra.core.coders.Adapter"}, "argument": {"variable": "hydra.core.model.Type"}}},
                                "argument": {"variable": "hydra.core.model.Type"}}},
                            "argument": {"variable": "hydra.core.model.Term"}}},
                        "argument": {"variable": "hydra.core.model.Term"}}},
                    "argument": {"variable": "hydra.core.errors.Error"}}}}}}},
        "body": {
          "typeLambda": {
            "parameter": "t0",
            "body": {
              "annotated": {
                "body": {
                  "lambda": {
                    "parameter": "lang",
                    "domain": {"variable": "hydra.core.coders.Language"},
                    "body": {
                      "lambda": {
                        "parameter": "cx",
                        "domain": {"variable": "t0"},
                        "body": {
                          "lambda": {
                            "parameter": "g",
                            "domain": {"variable": "hydra.core.graph.Graph"},
                            "body": {
                              "lambda": {
                                "parameter": "typ",
                                "domain": {"variable": "hydra.core.model.Type"},
                                "body": {
                                  "let": {
                                    "bindings": [
                                      {
                                        "name": "constraints",
                                        "term": {
                                          "application": {
                                            "function": {"project": {"typeName": "hydra.core.coders.Language", "fieldName": "constraints"}},
                                            "argument": {"variable": "lang"}}},
                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.coders.LanguageConstraints"}, "constraints": []}}],
                                    "body": {
                                      "let": {
                                        "bindings": [
                                          {
                                            "name": "litmap",
                                            "term": {
                                              "application": {"function": {"variable": "hydra.core.adapt.adaptLiteralTypesMap"}, "argument": {"variable": "constraints"}}},
                                            "typeScheme": {
                                              "variables": [],
                                              "body": {"map": {"keys": {"variable": "hydra.core.model.LiteralType"}, "values": {"variable": "hydra.core.model.LiteralType"}}},
                                              "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": {"variable": "hydra.core.model.Type"}}},
                                                    "type": {
                                                      "application": {
                                                        "function": {
                                                          "application": {
                                                            "function": {
                                                              "application": {
                                                                "function": {
                                                                  "application": {
                                                                    "function": {
                                                                      "application": {"function": {"variable": "hydra.core.coders.Adapter"}, "argument": {"variable": "hydra.core.model.Type"}}},
                                                                    "argument": {"variable": "hydra.core.model.Type"}}},
                                                                "argument": {"variable": "hydra.core.model.Term"}}},
                                                            "argument": {"variable": "hydra.core.model.Term"}}},
                                                        "argument": {"variable": "hydra.core.errors.Error"}}}}},
                                                "argument": {
                                                  "application": {
                                                    "function": {
                                                      "application": {
                                                        "function": {"application": {"function": {"variable": "hydra.core.adapt.adaptType"}, "argument": {"variable": "constraints"}}},
                                                        "argument": {"variable": "litmap"}}},
                                                    "argument": {"variable": "typ"}}}}},
                                            "argument": {
                                              "lambda": {
                                                "parameter": "adaptedType",
                                                "domain": {"variable": "hydra.core.model.Type"},
                                                "body": {
                                                  "typeApplication": {
                                                    "body": {
                                                      "typeApplication": {
                                                        "body": {
                                                          "either": {
                                                            "right": {
                                                              "typeApplication": {
                                                                "body": {
                                                                  "typeApplication": {
                                                                    "body": {
                                                                      "typeApplication": {
                                                                        "body": {
                                                                          "typeApplication": {
                                                                            "body": {
                                                                              "typeApplication": {
                                                                                "body": {
                                                                                  "record": {
                                                                                    "typeName": "hydra.core.coders.Adapter",
                                                                                    "fields": [
                                                                                      {"name": "isLossy", "term": {"literal": {"boolean": false}}},
                                                                                      {"name": "source", "term": {"variable": "typ"}},
                                                                                      {"name": "target", "term": {"variable": "adaptedType"}},
                                                                                      {
                                                                                        "name": "coder",
                                                                                        "term": {
                                                                                          "typeApplication": {
                                                                                            "body": {
                                                                                              "typeApplication": {
                                                                                                "body": {
                                                                                                  "typeApplication": {
                                                                                                    "body": {
                                                                                                      "record": {
                                                                                                        "typeName": "hydra.core.coders.Coder",
                                                                                                        "fields": [
                                                                                                          {
                                                                                                            "name": "encode",
                                                                                                            "term": {
                                                                                                              "lambda": {
                                                                                                                "parameter": "term",
                                                                                                                "domain": {"variable": "hydra.core.model.Term"},
                                                                                                                "body": {
                                                                                                                  "application": {
                                                                                                                    "function": {
                                                                                                                      "application": {
                                                                                                                        "function": {
                                                                                                                          "application": {
                                                                                                                            "function": {
                                                                                                                              "application": {
                                                                                                                                "function": {
                                                                                                                                  "application": {
                                                                                                                                    "function": {"typeApplication": {"body": {"variable": "hydra.core.adapt.adaptTerm"}, "type": {"variable": "t0"}}},
                                                                                                                                    "argument": {"variable": "constraints"}}},
                                                                                                                                "argument": {"variable": "litmap"}}},
                                                                                                                            "argument": {"variable": "cx"}}},
                                                                                                                        "argument": {"variable": "g"}}},
                                                                                                                    "argument": {"variable": "term"}}}}}},
                                                                                                          {
                                                                                                            "name": "decode",
                                                                                                            "term": {
                                                                                                              "lambda": {
                                                                                                                "parameter": "term",
                                                                                                                "domain": {"variable": "hydra.core.model.Term"},
                                                                                                                "body": {
                                                                                                                  "typeApplication": {
                                                                                                                    "body": {
                                                                                                                      "typeApplication": {"body": {"either": {"right": {"variable": "term"}}}, "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                                                    "type": {"variable": "hydra.core.model.Term"}}}}}}]}},
                                                                                                    "type": {"variable": "hydra.core.model.Term"}}},
                                                                                                "type": {"variable": "hydra.core.model.Term"}}},
                                                                                            "type": {"variable": "hydra.core.errors.Error"}}}}]}},
                                                                                "type": {"variable": "hydra.core.model.Type"}}},
                                                                            "type": {"variable": "hydra.core.model.Type"}}},
                                                                        "type": {"variable": "hydra.core.model.Term"}}},
                                                                    "type": {"variable": "hydra.core.model.Term"}}},
                                                                "type": {"variable": "hydra.core.errors.Error"}}}}},
                                                        "type": {"variable": "hydra.core.errors.Error"}}},
                                                    "type": {
                                                      "application": {
                                                        "function": {
                                                          "application": {
                                                            "function": {
                                                              "application": {
                                                                "function": {
                                                                  "application": {
                                                                    "function": {
                                                                      "application": {"function": {"variable": "hydra.core.coders.Adapter"}, "argument": {"variable": "hydra.core.model.Type"}}},
                                                                    "argument": {"variable": "hydra.core.model.Type"}}},
                                                                "argument": {"variable": "hydra.core.model.Term"}}},
                                                            "argument": {"variable": "hydra.core.model.Term"}}},
                                                        "argument": {"variable": "hydra.core.errors.Error"}}}}}}}}}}}}}}}}}}}}},
                "annotation": {
                  "map": [
                    {
                      "key": {"variable": "description"},
                      "value": {
                        "literal": {
                          "string": "Given a target language and a source type, produce an adapter which rewrites the type and its terms according to the language's constraints. The encode direction adapts terms; the decode direction is identity."}}}]}}}}}}},
    {
      "term": {
        "name": "hydra.core.adapt.termAlternatives",
        "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": {"variable": "hydra.core.model.Term"}, "isLazy": false}],
          "result": {
            "type": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"list": {"variable": "hydra.core.model.Term"}}}}}},
        "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": "term",
                            "domain": {"variable": "hydra.core.model.Term"},
                            "body": {
                              "application": {
                                "function": {
                                  "cases": {
                                    "typeName": "hydra.core.model.Term",
                                    "default": {
                                      "typeApplication": {
                                        "body": {
                                          "typeApplication": {
                                            "body": {"either": {"right": {"typeApplication": {"body": {"list": []}, "type": {"variable": "hydra.core.model.Term"}}}}},
                                            "type": {"variable": "hydra.core.errors.Error"}}},
                                        "type": {"list": {"variable": "hydra.core.model.Term"}}}},
                                    "cases": [
                                      {
                                        "name": "annotated",
                                        "handler": {
                                          "lambda": {
                                            "parameter": "at",
                                            "domain": {"variable": "hydra.core.model.AnnotatedTerm"},
                                            "body": {
                                              "let": {
                                                "bindings": [
                                                  {
                                                    "name": "term2",
                                                    "term": {
                                                      "application": {
                                                        "function": {"project": {"typeName": "hydra.core.model.AnnotatedTerm", "fieldName": "body"}},
                                                        "argument": {"variable": "at"}}},
                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                                "body": {
                                                  "typeApplication": {
                                                    "body": {
                                                      "typeApplication": {"body": {"either": {"right": {"list": [{"variable": "term2"}]}}}, "type": {"variable": "hydra.core.errors.Error"}}},
                                                    "type": {"list": {"variable": "hydra.core.model.Term"}}}}}}}}},
                                      {
                                        "name": "optional",
                                        "handler": {
                                          "lambda": {
                                            "parameter": "ot",
                                            "domain": {"optional": {"variable": "hydra.core.model.Term"}},
                                            "body": {
                                              "typeApplication": {
                                                "body": {
                                                  "typeApplication": {
                                                    "body": {
                                                      "either": {
                                                        "right": {
                                                          "list": [
                                                            {
                                                              "inject": {
                                                                "typeName": "hydra.core.model.Term",
                                                                "field": {
                                                                  "name": "list",
                                                                  "term": {
                                                                    "application": {
                                                                      "function": {
                                                                        "application": {
                                                                          "function": {
                                                                            "application": {
                                                                              "function": {
                                                                                "typeApplication": {
                                                                                  "body": {
                                                                                    "typeApplication": {"body": {"variable": "hydra.core.lib.optionals.match"}, "type": {"variable": "hydra.core.model.Term"}}},
                                                                                  "type": {"list": {"variable": "hydra.core.model.Term"}}}},
                                                                              "argument": {"variable": "ot"}}},
                                                                          "argument": {"typeApplication": {"body": {"list": []}, "type": {"variable": "hydra.core.model.Term"}}}}},
                                                                      "argument": {
                                                                        "lambda": {"parameter": "term2", "domain": {"variable": "hydra.core.model.Term"}, "body": {"list": [{"variable": "term2"}]}}}}}}}}]}}},
                                                    "type": {"variable": "hydra.core.errors.Error"}}},
                                                "type": {"list": {"variable": "hydra.core.model.Term"}}}}}}},
                                      {
                                        "name": "typeLambda",
                                        "handler": {
                                          "lambda": {
                                            "parameter": "abs",
                                            "domain": {"variable": "hydra.core.model.TypeLambda"},
                                            "body": {
                                              "let": {
                                                "bindings": [
                                                  {
                                                    "name": "term2",
                                                    "term": {
                                                      "application": {
                                                        "function": {"project": {"typeName": "hydra.core.model.TypeLambda", "fieldName": "body"}},
                                                        "argument": {"variable": "abs"}}},
                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                                "body": {
                                                  "typeApplication": {
                                                    "body": {
                                                      "typeApplication": {"body": {"either": {"right": {"list": [{"variable": "term2"}]}}}, "type": {"variable": "hydra.core.errors.Error"}}},
                                                    "type": {"list": {"variable": "hydra.core.model.Term"}}}}}}}}},
                                      {
                                        "name": "typeApplication",
                                        "handler": {
                                          "lambda": {
                                            "parameter": "ta",
                                            "domain": {"variable": "hydra.core.model.TypeApplicationTerm"},
                                            "body": {
                                              "let": {
                                                "bindings": [
                                                  {
                                                    "name": "term2",
                                                    "term": {
                                                      "application": {
                                                        "function": {"project": {"typeName": "hydra.core.model.TypeApplicationTerm", "fieldName": "body"}},
                                                        "argument": {"variable": "ta"}}},
                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                                "body": {
                                                  "typeApplication": {
                                                    "body": {
                                                      "typeApplication": {"body": {"either": {"right": {"list": [{"variable": "term2"}]}}}, "type": {"variable": "hydra.core.errors.Error"}}},
                                                    "type": {"list": {"variable": "hydra.core.model.Term"}}}}}}}}},
                                      {
                                        "name": "inject",
                                        "handler": {
                                          "lambda": {
                                            "parameter": "inj",
                                            "domain": {"variable": "hydra.core.model.Injection"},
                                            "body": {
                                              "let": {
                                                "bindings": [
                                                  {
                                                    "name": "tname",
                                                    "term": {
                                                      "application": {
                                                        "function": {"project": {"typeName": "hydra.core.model.Injection", "fieldName": "typeName"}},
                                                        "argument": {"variable": "inj"}}},
                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Name"}, "constraints": []}}],
                                                "body": {
                                                  "let": {
                                                    "bindings": [
                                                      {
                                                        "name": "field",
                                                        "term": {
                                                          "application": {
                                                            "function": {"project": {"typeName": "hydra.core.model.Injection", "fieldName": "field"}},
                                                            "argument": {"variable": "inj"}}},
                                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Field"}, "constraints": []}}],
                                                    "body": {
                                                      "let": {
                                                        "bindings": [
                                                          {
                                                            "name": "fname",
                                                            "term": {
                                                              "application": {
                                                                "function": {"project": {"typeName": "hydra.core.model.Field", "fieldName": "name"}},
                                                                "argument": {"variable": "field"}}},
                                                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Name"}, "constraints": []}}],
                                                        "body": {
                                                          "let": {
                                                            "bindings": [
                                                              {
                                                                "name": "fterm",
                                                                "term": {
                                                                  "application": {
                                                                    "function": {"project": {"typeName": "hydra.core.model.Field", "fieldName": "term"}},
                                                                    "argument": {"variable": "field"}}},
                                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                                            "body": {
                                                              "let": {
                                                                "bindings": [
                                                                  {
                                                                    "name": "forFieldType",
                                                                    "term": {
                                                                      "lambda": {
                                                                        "parameter": "ft",
                                                                        "domain": {"variable": "hydra.core.model.FieldType"},
                                                                        "body": {
                                                                          "let": {
                                                                            "bindings": [
                                                                              {
                                                                                "name": "ftname",
                                                                                "term": {
                                                                                  "application": {
                                                                                    "function": {"project": {"typeName": "hydra.core.model.FieldType", "fieldName": "name"}},
                                                                                    "argument": {"variable": "ft"}}},
                                                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Name"}, "constraints": []}}],
                                                                            "body": {
                                                                              "record": {
                                                                                "typeName": "hydra.core.model.Field",
                                                                                "fields": [
                                                                                  {"name": "name", "term": {"variable": "fname"}},
                                                                                  {
                                                                                    "name": "term",
                                                                                    "term": {
                                                                                      "inject": {
                                                                                        "typeName": "hydra.core.model.Term",
                                                                                        "field": {
                                                                                          "name": "optional",
                                                                                          "term": {
                                                                                            "application": {
                                                                                              "function": {
                                                                                                "application": {
                                                                                                  "function": {
                                                                                                    "application": {
                                                                                                      "function": {
                                                                                                        "typeApplication": {"body": {"variable": "hydra.core.lib.logic.ifElse"}, "type": {"optional": {"variable": "hydra.core.model.Term"}}}},
                                                                                                      "argument": {
                                                                                                        "application": {
                                                                                                          "function": {
                                                                                                            "application": {
                                                                                                              "function": {
                                                                                                                "typeApplication": {"body": {"variable": "hydra.core.lib.equality.equal"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                              "argument": {"variable": "ftname"}}},
                                                                                                          "argument": {"variable": "fname"}}}}},
                                                                                                  "argument": {"optional": {"variable": "fterm"}}}},
                                                                                              "argument": {"typeApplication": {"body": {"optional": null}, "type": {"variable": "hydra.core.model.Term"}}}}}}}}}]}}}}}},
                                                                    "typeScheme": {
                                                                      "variables": [],
                                                                      "body": {"function": {"domain": {"variable": "hydra.core.model.FieldType"}, "codomain": {"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.FieldType"}}}},
                                                                            "type": {"list": {"variable": "hydra.core.model.Term"}}}},
                                                                        "argument": {
                                                                          "application": {
                                                                            "function": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "application": {
                                                                                    "function": {"typeApplication": {"body": {"variable": "hydra.core.resolution.requireUnionType"}, "type": {"variable": "t0"}}},
                                                                                    "argument": {"variable": "cx"}}},
                                                                                "argument": {"variable": "graph"}}},
                                                                            "argument": {"variable": "tname"}}}}},
                                                                    "argument": {
                                                                      "lambda": {
                                                                        "parameter": "rt",
                                                                        "domain": {"list": {"variable": "hydra.core.model.FieldType"}},
                                                                        "body": {
                                                                          "typeApplication": {
                                                                            "body": {
                                                                              "typeApplication": {
                                                                                "body": {
                                                                                  "either": {
                                                                                    "right": {
                                                                                      "list": [
                                                                                        {
                                                                                          "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": {
                                                                                                        "application": {
                                                                                                          "function": {
                                                                                                            "application": {
                                                                                                              "function": {
                                                                                                                "typeApplication": {
                                                                                                                  "body": {
                                                                                                                    "typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.model.FieldType"}}},
                                                                                                                  "type": {"variable": "hydra.core.model.Field"}}},
                                                                                                              "argument": {"variable": "forFieldType"}}},
                                                                                                          "argument": {"variable": "rt"}}}}]}}}}}]}}},
                                                                                "type": {"variable": "hydra.core.errors.Error"}}},
                                                                            "type": {"list": {"variable": "hydra.core.model.Term"}}}}}}}}}}}}}}}}}}}}},
                                      {
                                        "name": "unit",
                                        "handler": {
                                          "lambda": {
                                            "parameter": "_",
                                            "domain": "unit",
                                            "body": {
                                              "typeApplication": {
                                                "body": {
                                                  "typeApplication": {
                                                    "body": {
                                                      "either": {
                                                        "right": {
                                                          "list": [
                                                            {
                                                              "inject": {
                                                                "typeName": "hydra.core.model.Term",
                                                                "field": {
                                                                  "name": "literal",
                                                                  "term": {
                                                                    "inject": {"typeName": "hydra.core.model.Literal", "field": {"name": "boolean", "term": {"literal": {"boolean": true}}}}}}}}]}}},
                                                    "type": {"variable": "hydra.core.errors.Error"}}},
                                                "type": {"list": {"variable": "hydra.core.model.Term"}}}}}}},
                                      {
                                        "name": "wrap",
                                        "handler": {
                                          "lambda": {
                                            "parameter": "wt",
                                            "domain": {"variable": "hydra.core.model.WrappedTerm"},
                                            "body": {
                                              "let": {
                                                "bindings": [
                                                  {
                                                    "name": "term2",
                                                    "term": {
                                                      "application": {
                                                        "function": {"project": {"typeName": "hydra.core.model.WrappedTerm", "fieldName": "body"}},
                                                        "argument": {"variable": "wt"}}},
                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                                "body": {
                                                  "typeApplication": {
                                                    "body": {
                                                      "typeApplication": {"body": {"either": {"right": {"list": [{"variable": "term2"}]}}}, "type": {"variable": "hydra.core.errors.Error"}}},
                                                    "type": {"list": {"variable": "hydra.core.model.Term"}}}}}}}}}]}},
                                "argument": {"variable": "term"}}}}}}}}},
                "annotation": {
                  "map": [
                    {
                      "key": {"variable": "description"},
                      "value": {"literal": {"string": "Find a list of alternatives for a given term, if any"}}}]}}}}}}},
    {
      "term": {
        "name": "hydra.core.adapt.typeAlternatives",
        "signature": {
          "typeParameters": [],
          "parameters": [{"name": "arg0", "type": {"variable": "hydra.core.model.Type"}, "isLazy": false}],
          "result": {"type": {"list": {"variable": "hydra.core.model.Type"}}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "type",
                "domain": {"variable": "hydra.core.model.Type"},
                "body": {
                  "application": {
                    "function": {
                      "cases": {
                        "typeName": "hydra.core.model.Type",
                        "default": {"typeApplication": {"body": {"list": []}, "type": {"variable": "hydra.core.model.Type"}}},
                        "cases": [
                          {
                            "name": "annotated",
                            "handler": {
                              "lambda": {
                                "parameter": "at",
                                "domain": {"variable": "hydra.core.model.AnnotatedType"},
                                "body": {
                                  "let": {
                                    "bindings": [
                                      {
                                        "name": "type2",
                                        "term": {
                                          "application": {
                                            "function": {"project": {"typeName": "hydra.core.model.AnnotatedType", "fieldName": "body"}},
                                            "argument": {"variable": "at"}}},
                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
                                    "body": {"list": [{"variable": "type2"}]}}}}}},
                          {
                            "name": "effect",
                            "handler": {"lambda": {"parameter": "et", "domain": {"variable": "hydra.core.model.Type"}, "body": {"list": [{"variable": "et"}]}}}},
                          {
                            "name": "optional",
                            "handler": {
                              "lambda": {
                                "parameter": "ot",
                                "domain": {"variable": "hydra.core.model.Type"},
                                "body": {"list": [{"inject": {"typeName": "hydra.core.model.Type", "field": {"name": "list", "term": {"variable": "ot"}}}}]}}}},
                          {
                            "name": "union",
                            "handler": {
                              "lambda": {
                                "parameter": "rt",
                                "domain": {"list": {"variable": "hydra.core.model.FieldType"}},
                                "body": {
                                  "let": {
                                    "bindings": [
                                      {
                                        "name": "toOptField",
                                        "term": {
                                          "lambda": {
                                            "parameter": "f",
                                            "domain": {"variable": "hydra.core.model.FieldType"},
                                            "body": {
                                              "record": {
                                                "typeName": "hydra.core.model.FieldType",
                                                "fields": [
                                                  {
                                                    "name": "name",
                                                    "term": {
                                                      "application": {
                                                        "function": {"project": {"typeName": "hydra.core.model.FieldType", "fieldName": "name"}},
                                                        "argument": {"variable": "f"}}}},
                                                  {
                                                    "name": "type",
                                                    "term": {
                                                      "inject": {
                                                        "typeName": "hydra.core.model.Type",
                                                        "field": {
                                                          "name": "optional",
                                                          "term": {
                                                            "application": {
                                                              "function": {"project": {"typeName": "hydra.core.model.FieldType", "fieldName": "type"}},
                                                              "argument": {"variable": "f"}}}}}}}]}}}},
                                        "typeScheme": {
                                          "variables": [],
                                          "body": {
                                            "function": {"domain": {"variable": "hydra.core.model.FieldType"}, "codomain": {"variable": "hydra.core.model.FieldType"}}},
                                          "constraints": []}}],
                                    "body": {
                                      "let": {
                                        "bindings": [
                                          {
                                            "name": "optFields",
                                            "term": {
                                              "application": {
                                                "function": {
                                                  "application": {
                                                    "function": {
                                                      "typeApplication": {
                                                        "body": {
                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.model.FieldType"}}},
                                                        "type": {"variable": "hydra.core.model.FieldType"}}},
                                                    "argument": {"variable": "toOptField"}}},
                                                "argument": {"variable": "rt"}}},
                                            "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.FieldType"}}, "constraints": []}}],
                                        "body": {
                                          "list": [{"inject": {"typeName": "hydra.core.model.Type", "field": {"name": "record", "term": {"variable": "optFields"}}}}]}}}}}}}},
                          {
                            "name": "unit",
                            "handler": {
                              "lambda": {
                                "parameter": "_",
                                "domain": "unit",
                                "body": {
                                  "list": [
                                    {
                                      "inject": {
                                        "typeName": "hydra.core.model.Type",
                                        "field": {
                                          "name": "literal",
                                          "term": {"inject": {"typeName": "hydra.core.model.LiteralType", "field": {"name": "boolean", "term": "unit"}}}}}}]}}}},
                          {
                            "name": "void",
                            "handler": {
                              "lambda": {
                                "parameter": "_",
                                "domain": "unit",
                                "body": {"list": [{"inject": {"typeName": "hydra.core.model.Type", "field": {"name": "unit", "term": "unit"}}}]}}}}]}},
                    "argument": {"variable": "type"}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {"literal": {"string": "Find a list of alternatives for a given type, if any"}}}]}}}}}]}