packages feed

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

{
  "name": "hydra.core.inference",
  "metadata": {
    "description": "Type inference for Hydra: Hindley-Milner with elaboration to System F. Extends textbook Algorithm W with nominal types, explicit type abstraction and application, and class constraints. See the Inference wiki page for the full picture.",
    "comments": [],
    "seeAlso": [],
    "provisions": []},
  "dependencies": [
    {"module": "hydra.core.checking"},
    {"module": "hydra.core.classes"},
    {"module": "hydra.core.errors"},
    {"module": "hydra.core.extract.model"},
    {"module": "hydra.core.graph"},
    {"module": "hydra.core.lexical"},
    {"module": "hydra.core.lib.eithers"},
    {"module": "hydra.core.lib.equality"},
    {"module": "hydra.core.lib.lists"},
    {"module": "hydra.core.lib.literals"},
    {"module": "hydra.core.lib.logic"},
    {"module": "hydra.core.lib.maps"},
    {"module": "hydra.core.lib.math"},
    {"module": "hydra.core.lib.optionals"},
    {"module": "hydra.core.lib.ordering"},
    {"module": "hydra.core.lib.pairs"},
    {"module": "hydra.core.lib.sets"},
    {"module": "hydra.core.lib.strings"},
    {"module": "hydra.core.model"},
    {"module": "hydra.core.names"},
    {"module": "hydra.core.packaging"},
    {"module": "hydra.core.paths"},
    {"module": "hydra.core.print.model"},
    {"module": "hydra.core.print.typing"},
    {"module": "hydra.core.reflect"},
    {"module": "hydra.core.resolution"},
    {"module": "hydra.core.rewriting"},
    {"module": "hydra.core.scoping"},
    {"module": "hydra.core.sorting"},
    {"module": "hydra.core.substitution"},
    {"module": "hydra.core.typing"},
    {"module": "hydra.core.unification"},
    {"module": "hydra.core.variables"}],
  "definitions": [
    {
      "term": {
        "name": "hydra.core.inference.atOrFail",
        "signature": {
          "typeParameters": [{"name": "t0", "constraints": []}],
          "parameters": [
            {"name": "arg0", "type": {"literal": {"integer": "int32"}}, "isLazy": false},
            {"name": "arg1", "type": {"literal": "string"}, "isLazy": false},
            {"name": "arg2", "type": {"list": {"variable": "t0"}}, "isLazy": false}],
          "result": {"type": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "t0"}}}}},
        "body": {
          "typeLambda": {
            "parameter": "t0",
            "body": {
              "annotated": {
                "body": {
                  "lambda": {
                    "parameter": "i",
                    "domain": {"literal": {"integer": "int32"}},
                    "body": {
                      "lambda": {
                        "parameter": "desc",
                        "domain": {"literal": "string"},
                        "body": {
                          "lambda": {
                            "parameter": "xs",
                            "domain": {"list": {"variable": "t0"}},
                            "body": {
                              "application": {
                                "function": {
                                  "application": {
                                    "function": {
                                      "application": {
                                        "function": {
                                          "typeApplication": {
                                            "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.optionals.match"}, "type": {"variable": "t0"}}},
                                            "type": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "t0"}}}}},
                                        "argument": {
                                          "application": {
                                            "function": {
                                              "application": {
                                                "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.at"}, "type": {"variable": "t0"}}},
                                                "argument": {"variable": "i"}}},
                                            "argument": {"variable": "xs"}}}}},
                                    "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": "atOrFail: "}}}},
                                                              "argument": {"variable": "desc"}}}}}}}}}},
                                            "type": {"variable": "hydra.core.errors.Error"}}},
                                        "type": {"variable": "t0"}}}}},
                                "argument": {
                                  "lambda": {
                                    "parameter": "x",
                                    "domain": {"variable": "t0"},
                                    "body": {
                                      "typeApplication": {
                                        "body": {"typeApplication": {"body": {"either": {"right": {"variable": "x"}}}, "type": {"variable": "hydra.core.errors.Error"}}},
                                        "type": {"variable": "t0"}}}}}}}}}}}}},
                "annotation": {
                  "map": [
                    {
                      "key": {"variable": "description"},
                      "value": {
                        "literal": {"string": "Return the element at the given index, or Left(Other) with the given description if out of range"}}}]}}}}}}},
    {
      "term": {
        "name": "hydra.core.inference.bindConstraints",
        "signature": {
          "typeParameters": [],
          "parameters": [
            {"name": "arg0", "type": {"variable": "hydra.core.typing.InferenceContext"}, "isLazy": false},
            {"name": "arg1", "type": {"variable": "hydra.core.graph.Graph"}, "isLazy": false},
            {"name": "arg2", "type": {"list": {"variable": "hydra.core.typing.TypeConstraint"}}, "isLazy": false}],
          "result": {
            "type": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.typing.TypeSubst"}}}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "flowCx",
                "domain": {"variable": "hydra.core.typing.InferenceContext"},
                "body": {
                  "lambda": {
                    "parameter": "cx",
                    "domain": {"variable": "hydra.core.graph.Graph"},
                    "body": {
                      "lambda": {
                        "parameter": "constraints",
                        "domain": {"list": {"variable": "hydra.core.typing.TypeConstraint"}},
                        "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.TypeSubst"}}},
                                    "type": {"variable": "hydra.core.typing.TypeSubst"}}},
                                "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.UnificationError"}}},
                                                        "type": {"variable": "hydra.core.typing.TypeSubst"}}},
                                                    "type": {"variable": "hydra.core.errors.Error"}}},
                                                "type": {"variable": "hydra.core.typing.TypeSubst"}}},
                                            "argument": {
                                              "lambda": {
                                                "parameter": "_e",
                                                "domain": {"variable": "hydra.core.errors.UnificationError"},
                                                "body": {
                                                  "inject": {
                                                    "typeName": "hydra.core.errors.Error",
                                                    "field": {
                                                      "name": "inference",
                                                      "term": {
                                                        "inject": {
                                                          "typeName": "hydra.core.errors.InferenceError",
                                                          "field": {
                                                            "name": "unification",
                                                            "term": {
                                                              "record": {
                                                                "typeName": "hydra.core.errors.UnificationInferenceError",
                                                                "fields": [
                                                                  {
                                                                    "name": "path",
                                                                    "term": {
                                                                      "wrap": {
                                                                        "typeName": "hydra.core.paths.SubtermPath",
                                                                        "body": {
                                                                          "application": {
                                                                            "function": {
                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.lists.reverse"}, "type": {"variable": "hydra.core.paths.SubtermStep"}}},
                                                                            "argument": {
                                                                              "application": {
                                                                                "function": {"project": {"typeName": "hydra.core.typing.InferenceContext", "fieldName": "trace"}},
                                                                                "argument": {"variable": "flowCx"}}}}}}}},
                                                                  {"name": "cause", "term": {"variable": "_e"}}]}}}}}}}}}}}},
                                        "argument": {"lambda": {"parameter": "_a", "domain": {"variable": "hydra.core.typing.TypeSubst"}, "body": {"variable": "_a"}}}}},
                                    "argument": {
                                      "application": {
                                        "function": {
                                          "application": {
                                            "function": {
                                              "application": {
                                                "function": {
                                                  "typeApplication": {
                                                    "body": {"variable": "hydra.core.unification.unifyTypeConstraints"},
                                                    "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                "argument": {"variable": "flowCx"}}},
                                            "argument": {
                                              "application": {
                                                "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "schemaTypes"}},
                                                "argument": {"variable": "cx"}}}}},
                                        "argument": {"variable": "constraints"}}}}}}},
                            "argument": {
                              "lambda": {
                                "parameter": "s",
                                "domain": {"variable": "hydra.core.typing.TypeSubst"},
                                "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.TypeSubst"}}},
                                            "type": {"variable": "hydra.core.typing.TypeSubst"}}},
                                        "argument": {
                                          "application": {
                                            "function": {
                                              "application": {
                                                "function": {
                                                  "application": {
                                                    "function": {
                                                      "typeApplication": {"body": {"variable": "hydra.core.checking.checkTypeSubst"}, "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                    "argument": {"variable": "flowCx"}}},
                                                "argument": {"variable": "cx"}}},
                                            "argument": {"variable": "s"}}}}},
                                    "argument": {
                                      "lambda": {
                                        "parameter": "_",
                                        "domain": {"variable": "hydra.core.typing.TypeSubst"},
                                        "body": {
                                          "typeApplication": {
                                            "body": {"typeApplication": {"body": {"either": {"right": {"variable": "s"}}}, "type": {"variable": "hydra.core.errors.Error"}}},
                                            "type": {"variable": "hydra.core.typing.TypeSubst"}}}}}}}}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {"literal": {"string": "Unify type constraints and check the substitution"}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.inference.bindUnboundTypeVariables",
        "signature": {
          "typeParameters": [],
          "parameters": [
            {"name": "arg0", "type": {"variable": "hydra.core.graph.Graph"}, "isLazy": false},
            {"name": "arg1", "type": {"variable": "hydra.core.model.Term"}, "isLazy": false}],
          "result": {"type": {"variable": "hydra.core.model.Term"}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "cx",
                "domain": {"variable": "hydra.core.graph.Graph"},
                "body": {
                  "lambda": {
                    "parameter": "term0",
                    "domain": {"variable": "hydra.core.model.Term"},
                    "body": {
                      "let": {
                        "bindings": [
                          {
                            "name": "svars",
                            "term": {
                              "application": {
                                "function": {
                                  "typeApplication": {"body": {"variable": "hydra.core.lib.sets.fromList"}, "type": {"variable": "hydra.core.model.Name"}}},
                                "argument": {
                                  "application": {
                                    "function": {
                                      "typeApplication": {
                                        "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.keys"}, "type": {"variable": "hydra.core.model.Name"}}},
                                        "type": {"variable": "hydra.core.model.TypeScheme"}}},
                                    "argument": {
                                      "application": {
                                        "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "schemaTypes"}},
                                        "argument": {"variable": "cx"}}}}}}},
                            "typeScheme": {"variables": [], "body": {"set": {"variable": "hydra.core.model.Name"}}, "constraints": []}}],
                        "body": {
                          "let": {
                            "bindings": [
                              {
                                "name": "rewrite",
                                "term": {
                                  "lambda": {
                                    "parameter": "recurse",
                                    "domain": {"function": {"domain": {"variable": "hydra.core.model.Term"}, "codomain": {"variable": "hydra.core.model.Term"}}},
                                    "body": {
                                      "lambda": {
                                        "parameter": "term",
                                        "domain": {"variable": "hydra.core.model.Term"},
                                        "body": {
                                          "application": {
                                            "function": {
                                              "cases": {
                                                "typeName": "hydra.core.model.Term",
                                                "default": {"application": {"function": {"variable": "recurse"}, "argument": {"variable": "term"}}},
                                                "cases": [
                                                  {
                                                    "name": "let",
                                                    "handler": {
                                                      "lambda": {
                                                        "parameter": "l",
                                                        "domain": {"variable": "hydra.core.model.Let"},
                                                        "body": {
                                                          "let": {
                                                            "bindings": [
                                                              {
                                                                "name": "forBinding",
                                                                "term": {
                                                                  "lambda": {
                                                                    "parameter": "b",
                                                                    "domain": {"variable": "hydra.core.model.Binding"},
                                                                    "body": {
                                                                      "let": {
                                                                        "bindings": [
                                                                          {
                                                                            "name": "bname",
                                                                            "term": {
                                                                              "application": {"function": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "name"}}, "argument": {"variable": "b"}}},
                                                                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Name"}, "constraints": []}}],
                                                                        "body": {
                                                                          "let": {
                                                                            "bindings": [
                                                                              {
                                                                                "name": "bterm",
                                                                                "term": {
                                                                                  "application": {"function": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "term"}}, "argument": {"variable": "b"}}},
                                                                                "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.TypeScheme"}}},
                                                                                            "type": {"variable": "hydra.core.model.Binding"}}},
                                                                                        "argument": {
                                                                                          "application": {
                                                                                            "function": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "typeScheme"}},
                                                                                            "argument": {"variable": "b"}}}}},
                                                                                    "argument": {
                                                                                      "record": {
                                                                                        "typeName": "hydra.core.model.Binding",
                                                                                        "fields": [
                                                                                          {"name": "name", "term": {"variable": "bname"}},
                                                                                          {
                                                                                            "name": "term",
                                                                                            "term": {
                                                                                              "application": {
                                                                                                "function": {
                                                                                                  "application": {"function": {"variable": "hydra.core.inference.bindUnboundTypeVariables"}, "argument": {"variable": "cx"}}},
                                                                                                "argument": {"variable": "bterm"}}}},
                                                                                          {
                                                                                            "name": "typeScheme",
                                                                                            "term": {"typeApplication": {"body": {"optional": null}, "type": {"variable": "hydra.core.model.TypeScheme"}}}}]}}}},
                                                                                "argument": {
                                                                                  "lambda": {
                                                                                    "parameter": "ts",
                                                                                    "domain": {"variable": "hydra.core.model.TypeScheme"},
                                                                                    "body": {
                                                                                      "let": {
                                                                                        "bindings": [
                                                                                          {
                                                                                            "name": "bvars",
                                                                                            "term": {
                                                                                              "application": {
                                                                                                "function": {
                                                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.sets.fromList"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                "argument": {
                                                                                                  "application": {
                                                                                                    "function": {"project": {"typeName": "hydra.core.model.TypeScheme", "fieldName": "variables"}},
                                                                                                    "argument": {"variable": "ts"}}}}},
                                                                                            "typeScheme": {"variables": [], "body": {"set": {"variable": "hydra.core.model.Name"}}, "constraints": []}}],
                                                                                        "body": {
                                                                                          "let": {
                                                                                            "bindings": [
                                                                                              {
                                                                                                "name": "excluded",
                                                                                                "term": {
                                                                                                  "application": {
                                                                                                    "function": {
                                                                                                      "application": {
                                                                                                        "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.union"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                        "argument": {"variable": "svars"}}},
                                                                                                    "argument": {"variable": "bvars"}}},
                                                                                                "typeScheme": {"variables": [], "body": {"set": {"variable": "hydra.core.model.Name"}}, "constraints": []}}],
                                                                                            "body": {
                                                                                              "let": {
                                                                                                "bindings": [
                                                                                                  {
                                                                                                    "name": "inType",
                                                                                                    "term": {
                                                                                                      "application": {
                                                                                                        "function": {
                                                                                                          "application": {
                                                                                                            "function": {
                                                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.sets.difference"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                            "argument": {
                                                                                                              "application": {
                                                                                                                "function": {"variable": "hydra.core.variables.freeVariablesInType"},
                                                                                                                "argument": {
                                                                                                                  "application": {
                                                                                                                    "function": {"project": {"typeName": "hydra.core.model.TypeScheme", "fieldName": "body"}},
                                                                                                                    "argument": {"variable": "ts"}}}}}}},
                                                                                                        "argument": {"variable": "excluded"}}},
                                                                                                    "typeScheme": {"variables": [], "body": {"set": {"variable": "hydra.core.model.Name"}}, "constraints": []}}],
                                                                                                "body": {
                                                                                                  "let": {
                                                                                                    "bindings": [
                                                                                                      {
                                                                                                        "name": "phantoms",
                                                                                                        "term": {
                                                                                                          "application": {
                                                                                                            "function": {
                                                                                                              "application": {
                                                                                                                "function": {
                                                                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.sets.difference"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                                "argument": {
                                                                                                                  "application": {"function": {"variable": "hydra.core.variables.freeTypeVariablesInTerm"}, "argument": {"variable": "bterm"}}}}},
                                                                                                            "argument": {
                                                                                                              "application": {
                                                                                                                "function": {
                                                                                                                  "application": {
                                                                                                                    "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.union"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                                    "argument": {"variable": "excluded"}}},
                                                                                                                "argument": {"variable": "inType"}}}}},
                                                                                                        "typeScheme": {"variables": [], "body": {"set": {"variable": "hydra.core.model.Name"}}, "constraints": []}}],
                                                                                                    "body": {
                                                                                                      "let": {
                                                                                                        "bindings": [
                                                                                                          {
                                                                                                            "name": "phantomSubst",
                                                                                                            "term": {
                                                                                                              "wrap": {
                                                                                                                "typeName": "hydra.core.typing.TypeSubst",
                                                                                                                "body": {
                                                                                                                  "application": {
                                                                                                                    "function": {
                                                                                                                      "typeApplication": {
                                                                                                                        "body": {
                                                                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.maps.fromList"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                                        "type": {"variable": "hydra.core.model.Type"}}},
                                                                                                                    "argument": {
                                                                                                                      "application": {
                                                                                                                        "function": {
                                                                                                                          "application": {
                                                                                                                            "function": {
                                                                                                                              "typeApplication": {
                                                                                                                                "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                                                "type": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.model.Type"}}}}},
                                                                                                                            "argument": {
                                                                                                                              "lambda": {
                                                                                                                                "parameter": "v",
                                                                                                                                "domain": {"variable": "hydra.core.model.Name"},
                                                                                                                                "body": {
                                                                                                                                  "typeApplication": {
                                                                                                                                    "body": {
                                                                                                                                      "typeApplication": {
                                                                                                                                        "body": {
                                                                                                                                          "pair": {
                                                                                                                                            "first": {"variable": "v"},
                                                                                                                                            "second": {"inject": {"typeName": "hydra.core.model.Type", "field": {"name": "unit", "term": "unit"}}}}},
                                                                                                                                        "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                                                    "type": {"variable": "hydra.core.model.Type"}}}}}}},
                                                                                                                        "argument": {
                                                                                                                          "application": {
                                                                                                                            "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.toList"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                                            "argument": {"variable": "phantoms"}}}}}}}}},
                                                                                                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.TypeSubst"}, "constraints": []}}],
                                                                                                        "body": {
                                                                                                          "let": {
                                                                                                            "bindings": [
                                                                                                              {
                                                                                                                "name": "bterm1",
                                                                                                                "term": {
                                                                                                                  "application": {
                                                                                                                    "function": {
                                                                                                                      "application": {"function": {"variable": "hydra.core.substitution.substTypesInTerm"}, "argument": {"variable": "phantomSubst"}}},
                                                                                                                    "argument": {"variable": "bterm"}}},
                                                                                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                                                                                            "body": {
                                                                                                              "let": {
                                                                                                                "bindings": [
                                                                                                                  {
                                                                                                                    "name": "unbound",
                                                                                                                    "term": {
                                                                                                                      "application": {
                                                                                                                        "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.toList"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                                        "argument": {"variable": "inType"}}},
                                                                                                                    "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Name"}}, "constraints": []}}],
                                                                                                                "body": {
                                                                                                                  "let": {
                                                                                                                    "bindings": [
                                                                                                                      {
                                                                                                                        "name": "ts2",
                                                                                                                        "term": {
                                                                                                                          "record": {
                                                                                                                            "typeName": "hydra.core.model.TypeScheme",
                                                                                                                            "fields": [
                                                                                                                              {
                                                                                                                                "name": "variables",
                                                                                                                                "term": {
                                                                                                                                  "application": {
                                                                                                                                    "function": {
                                                                                                                                      "application": {
                                                                                                                                        "function": {
                                                                                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.lists.concat2"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                                                        "argument": {
                                                                                                                                          "application": {
                                                                                                                                            "function": {"project": {"typeName": "hydra.core.model.TypeScheme", "fieldName": "variables"}},
                                                                                                                                            "argument": {"variable": "ts"}}}}},
                                                                                                                                    "argument": {"variable": "unbound"}}}},
                                                                                                                              {
                                                                                                                                "name": "body",
                                                                                                                                "term": {
                                                                                                                                  "application": {
                                                                                                                                    "function": {"project": {"typeName": "hydra.core.model.TypeScheme", "fieldName": "body"}},
                                                                                                                                    "argument": {"variable": "ts"}}}},
                                                                                                                              {
                                                                                                                                "name": "constraints",
                                                                                                                                "term": {
                                                                                                                                  "application": {
                                                                                                                                    "function": {"project": {"typeName": "hydra.core.model.TypeScheme", "fieldName": "constraints"}},
                                                                                                                                    "argument": {"variable": "ts"}}}}]}},
                                                                                                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.TypeScheme"}, "constraints": []}}],
                                                                                                                    "body": {
                                                                                                                      "let": {
                                                                                                                        "bindings": [
                                                                                                                          {
                                                                                                                            "name": "bterm2",
                                                                                                                            "term": {
                                                                                                                              "application": {
                                                                                                                                "function": {
                                                                                                                                  "application": {
                                                                                                                                    "function": {
                                                                                                                                      "application": {
                                                                                                                                        "function": {
                                                                                                                                          "typeApplication": {
                                                                                                                                            "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.foldl"}, "type": {"variable": "hydra.core.model.Term"}}},
                                                                                                                                            "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                                                        "argument": {
                                                                                                                                          "lambda": {
                                                                                                                                            "parameter": "t",
                                                                                                                                            "domain": {"variable": "hydra.core.model.Term"},
                                                                                                                                            "body": {
                                                                                                                                              "lambda": {
                                                                                                                                                "parameter": "v",
                                                                                                                                                "domain": {"variable": "hydra.core.model.Name"},
                                                                                                                                                "body": {
                                                                                                                                                  "inject": {
                                                                                                                                                    "typeName": "hydra.core.model.Term",
                                                                                                                                                    "field": {
                                                                                                                                                      "name": "typeLambda",
                                                                                                                                                      "term": {
                                                                                                                                                        "record": {
                                                                                                                                                          "typeName": "hydra.core.model.TypeLambda",
                                                                                                                                                          "fields": [{"name": "parameter", "term": {"variable": "v"}}, {"name": "body", "term": {"variable": "t"}}]}}}}}}}}}}},
                                                                                                                                    "argument": {"variable": "bterm1"}}},
                                                                                                                                "argument": {"variable": "unbound"}}},
                                                                                                                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                                                                                                        "body": {
                                                                                                                          "record": {
                                                                                                                            "typeName": "hydra.core.model.Binding",
                                                                                                                            "fields": [
                                                                                                                              {"name": "name", "term": {"variable": "bname"}},
                                                                                                                              {"name": "term", "term": {"variable": "bterm2"}},
                                                                                                                              {"name": "typeScheme", "term": {"optional": {"variable": "ts2"}}}]}}}}}}}}}}}}}}}}}}}}}}}}}}}}}},
                                                                "typeScheme": {
                                                                  "variables": [],
                                                                  "body": {"function": {"domain": {"variable": "hydra.core.model.Binding"}, "codomain": {"variable": "hydra.core.model.Binding"}}},
                                                                  "constraints": []}}],
                                                            "body": {
                                                              "inject": {
                                                                "typeName": "hydra.core.model.Term",
                                                                "field": {
                                                                  "name": "let",
                                                                  "term": {
                                                                    "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": "forBinding"}}},
                                                                              "argument": {
                                                                                "application": {"function": {"project": {"typeName": "hydra.core.model.Let", "fieldName": "bindings"}}, "argument": {"variable": "l"}}}}}},
                                                                        {
                                                                          "name": "body",
                                                                          "term": {
                                                                            "application": {
                                                                              "function": {
                                                                                "application": {"function": {"variable": "hydra.core.inference.bindUnboundTypeVariables"}, "argument": {"variable": "cx"}}},
                                                                              "argument": {
                                                                                "application": {"function": {"project": {"typeName": "hydra.core.model.Let", "fieldName": "body"}}, "argument": {"variable": "l"}}}}}}]}}}}}}}}}}]}},
                                            "argument": {"variable": "term"}}}}}}},
                                "typeScheme": {
                                  "variables": [],
                                  "body": {
                                    "function": {
                                      "domain": {"function": {"domain": {"variable": "hydra.core.model.Term"}, "codomain": {"variable": "hydra.core.model.Term"}}},
                                      "codomain": {"function": {"domain": {"variable": "hydra.core.model.Term"}, "codomain": {"variable": "hydra.core.model.Term"}}}}},
                                  "constraints": []}}],
                            "body": {
                              "application": {
                                "function": {"application": {"function": {"variable": "hydra.core.rewriting.rewriteTerm"}, "argument": {"variable": "rewrite"}}},
                                "argument": {"variable": "term0"}}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {
                    "literal": {
                      "string": "Handle unbound type variables under a typed let binding. Variables appearing free in the binding's declared type (but not in schema types or the scheme's own quantified variables) are added to the scheme and the term is wrapped in matching TypeLambdas. Variables appearing only in the term body (at type-application or lambda-domain positions) are phantom — they have no external effect on the binding's type — and are substituted with hydra.core.model.Unit in the body rather than generalized. This keeps downstream stages from seeing vacuous foralls that target languages with non-polymorphic value bindings (e.g. Scala val) cannot express."}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.inference.buildTypeApplicationTerm",
        "signature": {
          "typeParameters": [],
          "parameters": [
            {"name": "arg0", "type": {"list": {"variable": "hydra.core.model.Name"}}, "isLazy": false},
            {"name": "arg1", "type": {"variable": "hydra.core.model.Term"}, "isLazy": false}],
          "result": {"type": {"variable": "hydra.core.model.Term"}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "tvars",
                "domain": {"list": {"variable": "hydra.core.model.Name"}},
                "body": {
                  "lambda": {
                    "parameter": "body",
                    "domain": {"variable": "hydra.core.model.Term"},
                    "body": {
                      "application": {
                        "function": {
                          "application": {
                            "function": {
                              "application": {
                                "function": {
                                  "typeApplication": {
                                    "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.foldl"}, "type": {"variable": "hydra.core.model.Term"}}},
                                    "type": {"variable": "hydra.core.model.Name"}}},
                                "argument": {
                                  "lambda": {
                                    "parameter": "t",
                                    "domain": {"variable": "hydra.core.model.Term"},
                                    "body": {
                                      "lambda": {
                                        "parameter": "v",
                                        "domain": {"variable": "hydra.core.model.Name"},
                                        "body": {
                                          "inject": {
                                            "typeName": "hydra.core.model.Term",
                                            "field": {
                                              "name": "typeApplication",
                                              "term": {
                                                "record": {
                                                  "typeName": "hydra.core.model.TypeApplicationTerm",
                                                  "fields": [
                                                    {"name": "body", "term": {"variable": "t"}},
                                                    {
                                                      "name": "type",
                                                      "term": {"inject": {"typeName": "hydra.core.model.Type", "field": {"name": "variable", "term": {"variable": "v"}}}}}]}}}}}}}}}}},
                            "argument": {"variable": "body"}}},
                        "argument": {"variable": "tvars"}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {"literal": {"string": "Fold a list of type variables over a term to build a type application term"}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.inference.dischargeClassConstraints",
        "signature": {
          "typeParameters": [],
          "parameters": [
            {"name": "arg0", "type": {"variable": "hydra.core.typing.InferenceContext"}, "isLazy": false},
            {"name": "arg1", "type": {"variable": "hydra.core.typing.TypeSubst"}, "isLazy": false},
            {
              "name": "arg2",
              "type": {
                "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}},
              "isLazy": false}],
          "result": {"type": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": "unit"}}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "fcx",
                "domain": {"variable": "hydra.core.typing.InferenceContext"},
                "body": {
                  "lambda": {
                    "parameter": "subst",
                    "domain": {"variable": "hydra.core.typing.TypeSubst"},
                    "body": {
                      "lambda": {
                        "parameter": "constraints",
                        "domain": {
                          "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}},
                        "body": {
                          "let": {
                            "bindings": [
                              {
                                "name": "substMap",
                                "term": {"application": {"function": {"unwrap": "hydra.core.typing.TypeSubst"}, "argument": {"variable": "subst"}}},
                                "typeScheme": {
                                  "variables": [],
                                  "body": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.Type"}}},
                                  "constraints": []}}],
                            "body": {
                              "let": {
                                "bindings": [
                                  {
                                    "name": "checkOne",
                                    "term": {
                                      "lambda": {
                                        "parameter": "pair",
                                        "domain": {
                                          "pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.model.TypeVariableConstraints"}}},
                                        "body": {
                                          "let": {
                                            "bindings": [
                                              {
                                                "name": "varName",
                                                "term": {
                                                  "application": {
                                                    "function": {
                                                      "typeApplication": {
                                                        "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                        "type": {"variable": "hydra.core.model.TypeVariableConstraints"}}},
                                                    "argument": {"variable": "pair"}}},
                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Name"}, "constraints": []}}],
                                            "body": {
                                              "let": {
                                                "bindings": [
                                                  {
                                                    "name": "varConstraints",
                                                    "term": {
                                                      "application": {
                                                        "function": {
                                                          "typeApplication": {
                                                            "body": {
                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                            "type": {"variable": "hydra.core.model.TypeVariableConstraints"}}},
                                                        "argument": {"variable": "pair"}}},
                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.TypeVariableConstraints"}, "constraints": []}}],
                                                "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": "unit"}}}},
                                                            "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": "varName"}}},
                                                                "argument": {"variable": "substMap"}}}}},
                                                        "argument": {
                                                          "typeApplication": {
                                                            "body": {"typeApplication": {"body": {"either": {"right": "unit"}}, "type": {"variable": "hydra.core.errors.Error"}}},
                                                            "type": "unit"}}}},
                                                    "argument": {
                                                      "lambda": {
                                                        "parameter": "resolvedType",
                                                        "domain": {"variable": "hydra.core.model.Type"},
                                                        "body": {
                                                          "let": {
                                                            "bindings": [
                                                              {
                                                                "name": "checkClass",
                                                                "term": {
                                                                  "lambda": {
                                                                    "parameter": "classConstraint",
                                                                    "domain": {"variable": "hydra.core.model.TypeClassConstraint"},
                                                                    "body": {
                                                                      "let": {
                                                                        "bindings": [
                                                                          {
                                                                            "name": "className",
                                                                            "term": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "cases": {
                                                                                    "typeName": "hydra.core.model.TypeClassConstraint",
                                                                                    "cases": [
                                                                                      {
                                                                                        "name": "simple",
                                                                                        "handler": {"lambda": {"parameter": "n", "domain": {"variable": "hydra.core.model.Name"}, "body": {"variable": "n"}}}}]}},
                                                                                "argument": {"variable": "classConstraint"}}},
                                                                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Name"}, "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": "unit"}}}},
                                                                                    "argument": {
                                                                                      "application": {
                                                                                        "function": {
                                                                                          "application": {"function": {"variable": "hydra.core.classes.classIsSatisfiedByType"}, "argument": {"variable": "className"}}},
                                                                                        "argument": {"variable": "resolvedType"}}}}},
                                                                                "argument": {
                                                                                  "typeApplication": {
                                                                                    "body": {"typeApplication": {"body": {"either": {"right": "unit"}}, "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                    "type": "unit"}}}},
                                                                            "argument": {
                                                                              "typeApplication": {
                                                                                "body": {
                                                                                  "typeApplication": {
                                                                                    "body": {
                                                                                      "either": {
                                                                                        "left": {
                                                                                          "inject": {
                                                                                            "typeName": "hydra.core.errors.Error",
                                                                                            "field": {
                                                                                              "name": "inference",
                                                                                              "term": {
                                                                                                "inject": {
                                                                                                  "typeName": "hydra.core.errors.InferenceError",
                                                                                                  "field": {
                                                                                                    "name": "other",
                                                                                                    "term": {
                                                                                                      "record": {
                                                                                                        "typeName": "hydra.core.errors.OtherInferenceError",
                                                                                                        "fields": [
                                                                                                          {
                                                                                                            "name": "path",
                                                                                                            "term": {
                                                                                                              "wrap": {
                                                                                                                "typeName": "hydra.core.paths.SubtermPath",
                                                                                                                "body": {
                                                                                                                  "application": {
                                                                                                                    "function": {
                                                                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.lists.reverse"}, "type": {"variable": "hydra.core.paths.SubtermStep"}}},
                                                                                                                    "argument": {
                                                                                                                      "application": {
                                                                                                                        "function": {"project": {"typeName": "hydra.core.typing.InferenceContext", "fieldName": "trace"}},
                                                                                                                        "argument": {"variable": "fcx"}}}}}}}},
                                                                                                          {
                                                                                                            "name": "message",
                                                                                                            "term": {
                                                                                                              "application": {
                                                                                                                "function": {"variable": "hydra.core.lib.strings.concat"},
                                                                                                                "argument": {
                                                                                                                  "list": [
                                                                                                                    {"literal": {"string": "Type "}},
                                                                                                                    {"application": {"function": {"variable": "hydra.core.print.model.type"}, "argument": {"variable": "resolvedType"}}},
                                                                                                                    {"literal": {"string": " does not satisfy constraint "}},
                                                                                                                    {"application": {"function": {"unwrap": "hydra.core.model.Name"}, "argument": {"variable": "className"}}}]}}}}]}}}}}}}}}},
                                                                                    "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                "type": "unit"}}}}}}}},
                                                                "typeScheme": {
                                                                  "variables": [],
                                                                  "body": {
                                                                    "function": {
                                                                      "domain": {"variable": "hydra.core.model.TypeClassConstraint"},
                                                                      "codomain": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": "unit"}}}},
                                                                  "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": {"set": "unit"}}},
                                                                        "type": "unit"}},
                                                                    "argument": {
                                                                      "application": {
                                                                        "function": {
                                                                          "application": {
                                                                            "function": {
                                                                              "typeApplication": {
                                                                                "body": {
                                                                                  "typeApplication": {
                                                                                    "body": {
                                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.eithers.mapSet"}, "type": {"variable": "hydra.core.model.TypeClassConstraint"}}},
                                                                                    "type": "unit"}},
                                                                                "type": {"variable": "hydra.core.errors.Error"}}},
                                                                            "argument": {"variable": "checkClass"}}},
                                                                        "argument": {
                                                                          "application": {
                                                                            "function": {"project": {"typeName": "hydra.core.model.TypeVariableConstraints", "fieldName": "classes"}},
                                                                            "argument": {"variable": "varConstraints"}}}}}}},
                                                                "argument": {
                                                                  "lambda": {
                                                                    "parameter": "_",
                                                                    "domain": {"set": "unit"},
                                                                    "body": {
                                                                      "typeApplication": {
                                                                        "body": {"typeApplication": {"body": {"either": {"right": "unit"}}, "type": {"variable": "hydra.core.errors.Error"}}},
                                                                        "type": "unit"}}}}}}}}}}}}}}}}}},
                                    "typeScheme": {
                                      "variables": [],
                                      "body": {
                                        "function": {
                                          "domain": {
                                            "pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.model.TypeVariableConstraints"}}},
                                          "codomain": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": "unit"}}}},
                                      "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": "unit"}}},
                                            "type": "unit"}},
                                        "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.model.TypeVariableConstraints"}}}}},
                                                        "type": "unit"}},
                                                    "type": {"variable": "hydra.core.errors.Error"}}},
                                                "argument": {"variable": "checkOne"}}},
                                            "argument": {
                                              "application": {
                                                "function": {
                                                  "typeApplication": {
                                                    "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.toList"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                    "type": {"variable": "hydra.core.model.TypeVariableConstraints"}}},
                                                "argument": {"variable": "constraints"}}}}}}},
                                    "argument": {
                                      "lambda": {
                                        "parameter": "_",
                                        "domain": {"list": "unit"},
                                        "body": {
                                          "typeApplication": {
                                            "body": {"typeApplication": {"body": {"either": {"right": "unit"}}, "type": {"variable": "hydra.core.errors.Error"}}},
                                            "type": "unit"}}}}}}}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {
                    "literal": {
                      "string": "Check that every constrained type variable's final resolved type is an instance of each class it was constrained to."}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.inference.extendContext",
        "signature": {
          "typeParameters": [],
          "parameters": [
            {
              "name": "arg0",
              "type": {
                "list": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.model.TypeScheme"}}}},
              "isLazy": false},
            {"name": "arg1", "type": {"variable": "hydra.core.graph.Graph"}, "isLazy": false}],
          "result": {"type": {"variable": "hydra.core.graph.Graph"}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "pairs",
                "domain": {
                  "list": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.model.TypeScheme"}}}},
                "body": {
                  "lambda": {
                    "parameter": "cx",
                    "domain": {"variable": "hydra.core.graph.Graph"},
                    "body": {
                      "record": {
                        "typeName": "hydra.core.graph.Graph",
                        "fields": [
                          {
                            "name": "boundTerms",
                            "term": {
                              "application": {
                                "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "boundTerms"}},
                                "argument": {"variable": "cx"}}}},
                          {
                            "name": "boundTypes",
                            "term": {
                              "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.TypeScheme"}}},
                                    "argument": {
                                      "application": {
                                        "function": {
                                          "typeApplication": {
                                            "body": {
                                              "typeApplication": {"body": {"variable": "hydra.core.lib.maps.fromList"}, "type": {"variable": "hydra.core.model.Name"}}},
                                            "type": {"variable": "hydra.core.model.TypeScheme"}}},
                                        "argument": {"variable": "pairs"}}}}},
                                "argument": {
                                  "application": {
                                    "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "boundTypes"}},
                                    "argument": {"variable": "cx"}}}}}},
                          {
                            "name": "classConstraints",
                            "term": {
                              "application": {
                                "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "classConstraints"}},
                                "argument": {"variable": "cx"}}}},
                          {
                            "name": "lambdaVariables",
                            "term": {
                              "application": {
                                "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "lambdaVariables"}},
                                "argument": {"variable": "cx"}}}},
                          {
                            "name": "metadata",
                            "term": {
                              "application": {
                                "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "metadata"}},
                                "argument": {"variable": "cx"}}}},
                          {
                            "name": "primitives",
                            "term": {
                              "application": {
                                "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "primitives"}},
                                "argument": {"variable": "cx"}}}},
                          {
                            "name": "schemaTypes",
                            "term": {
                              "application": {
                                "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "schemaTypes"}},
                                "argument": {"variable": "cx"}}}},
                          {
                            "name": "typeVariables",
                            "term": {
                              "application": {
                                "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "typeVariables"}},
                                "argument": {"variable": "cx"}}}}]}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {"literal": {"string": "Add (term variable, type scheme) pairs to the graph's bound types"}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.inference.finalizeInferredTerm",
        "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": {"variable": "hydra.core.model.Term"}}}}},
        "body": {
          "typeLambda": {
            "parameter": "t0",
            "body": {
              "annotated": {
                "body": {
                  "lambda": {
                    "parameter": "flowCx",
                    "domain": {"variable": "t0"},
                    "body": {
                      "lambda": {
                        "parameter": "cx",
                        "domain": {"variable": "hydra.core.graph.Graph"},
                        "body": {
                          "lambda": {
                            "parameter": "term",
                            "domain": {"variable": "hydra.core.model.Term"},
                            "body": {
                              "let": {
                                "bindings": [
                                  {
                                    "name": "term2",
                                    "term": {
                                      "application": {
                                        "function": {
                                          "application": {"function": {"variable": "hydra.core.inference.bindUnboundTypeVariables"}, "argument": {"variable": "cx"}}},
                                        "argument": {"variable": "term"}}},
                                    "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": "unit"}},
                                            "type": {"variable": "hydra.core.model.Term"}}},
                                        "argument": {
                                          "application": {
                                            "function": {
                                              "application": {
                                                "function": {
                                                  "application": {
                                                    "function": {
                                                      "typeApplication": {"body": {"variable": "hydra.core.checking.checkForUnboundTypeVariables"}, "type": {"variable": "t0"}}},
                                                    "argument": {"variable": "flowCx"}}},
                                                "argument": {"variable": "cx"}}},
                                            "argument": {"variable": "term2"}}}}},
                                    "argument": {
                                      "lambda": {
                                        "parameter": "_",
                                        "domain": "unit",
                                        "body": {
                                          "typeApplication": {
                                            "body": {
                                              "typeApplication": {
                                                "body": {
                                                  "either": {
                                                    "right": {
                                                      "application": {"function": {"variable": "hydra.core.variables.normalizeTypeVariablesInTerm"}, "argument": {"variable": "term2"}}}}},
                                                "type": {"variable": "hydra.core.errors.Error"}}},
                                            "type": {"variable": "hydra.core.model.Term"}}}}}}}}}}}}}}},
                "annotation": {
                  "map": [
                    {
                      "key": {"variable": "description"},
                      "value": {
                        "literal": {"string": "Finalize an inferred term by checking for unbound type variables, then normalizing type variables"}}}]}}}}}}},
    {
      "term": {
        "name": "hydra.core.inference.forInferredTerm",
        "signature": {
          "typeParameters": [{"name": "t0", "constraints": []}],
          "parameters": [
            {"name": "arg0", "type": {"variable": "hydra.core.typing.InferenceContext"}, "isLazy": false},
            {"name": "arg1", "type": {"variable": "hydra.core.graph.Graph"}, "isLazy": false},
            {"name": "arg2", "type": {"variable": "hydra.core.model.Term"}, "isLazy": false},
            {"name": "arg3", "type": {"literal": "string"}, "isLazy": false},
            {
              "name": "arg4",
              "type": {"function": {"domain": {"variable": "hydra.core.typing.InferenceResult"}, "codomain": {"variable": "t0"}}},
              "isLazy": false}],
          "result": {
            "type": {
              "either": {
                "left": {"variable": "hydra.core.errors.Error"},
                "right": {"pair": {"first": {"variable": "t0"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}},
        "body": {
          "typeLambda": {
            "parameter": "t0",
            "body": {
              "annotated": {
                "body": {
                  "lambda": {
                    "parameter": "fcx",
                    "domain": {"variable": "hydra.core.typing.InferenceContext"},
                    "body": {
                      "lambda": {
                        "parameter": "cx",
                        "domain": {"variable": "hydra.core.graph.Graph"},
                        "body": {
                          "lambda": {
                            "parameter": "term",
                            "domain": {"variable": "hydra.core.model.Term"},
                            "body": {
                              "lambda": {
                                "parameter": "desc",
                                "domain": {"literal": "string"},
                                "body": {
                                  "lambda": {
                                    "parameter": "f",
                                    "domain": {"function": {"domain": {"variable": "hydra.core.typing.InferenceResult"}, "codomain": {"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.typing.InferenceResult"}}},
                                                "type": {"pair": {"first": {"variable": "t0"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                            "argument": {
                                              "application": {
                                                "function": {
                                                  "application": {
                                                    "function": {
                                                      "application": {
                                                        "function": {"application": {"function": {"variable": "hydra.core.inference.inferTypeOfTerm"}, "argument": {"variable": "fcx"}}},
                                                        "argument": {"variable": "cx"}}},
                                                    "argument": {"variable": "term"}}},
                                                "argument": {"variable": "desc"}}}}},
                                        "argument": {
                                          "lambda": {
                                            "parameter": "rp",
                                            "domain": {"variable": "hydra.core.typing.InferenceResult"},
                                            "body": {
                                              "typeApplication": {
                                                "body": {
                                                  "typeApplication": {
                                                    "body": {
                                                      "either": {
                                                        "right": {
                                                          "typeApplication": {
                                                            "body": {
                                                              "typeApplication": {
                                                                "body": {
                                                                  "pair": {
                                                                    "first": {"application": {"function": {"variable": "f"}, "argument": {"variable": "rp"}}},
                                                                    "second": {
                                                                      "application": {
                                                                        "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "context"}},
                                                                        "argument": {"variable": "rp"}}}}},
                                                                "type": {"variable": "t0"}}},
                                                            "type": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                    "type": {"variable": "hydra.core.errors.Error"}}},
                                                "type": {"pair": {"first": {"variable": "t0"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}}}}}}}}}}}}}},
                "annotation": {
                  "map": [{"key": {"variable": "description"}, "value": {"literal": {"string": "Infer a term's type and map over the result"}}}]}}}}}}},
    {
      "term": {
        "name": "hydra.core.inference.freeVariablesInContext",
        "signature": {
          "typeParameters": [],
          "parameters": [{"name": "arg0", "type": {"variable": "hydra.core.graph.Graph"}, "isLazy": false}],
          "result": {"type": {"set": {"variable": "hydra.core.model.Name"}}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "cx",
                "domain": {"variable": "hydra.core.graph.Graph"},
                "body": {
                  "application": {
                    "function": {
                      "application": {
                        "function": {
                          "application": {
                            "function": {
                              "typeApplication": {
                                "body": {
                                  "typeApplication": {"body": {"variable": "hydra.core.lib.lists.foldl"}, "type": {"set": {"variable": "hydra.core.model.Name"}}}},
                                "type": {"set": {"variable": "hydra.core.model.Name"}}}},
                            "argument": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.union"}, "type": {"variable": "hydra.core.model.Name"}}}}},
                        "argument": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.empty"}, "type": {"variable": "hydra.core.model.Name"}}}}},
                    "argument": {
                      "application": {
                        "function": {
                          "application": {
                            "function": {
                              "typeApplication": {
                                "body": {
                                  "typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.model.TypeScheme"}}},
                                "type": {"set": {"variable": "hydra.core.model.Name"}}}},
                            "argument": {"variable": "hydra.core.variables.freeVariablesInTypeSchemeSimple"}}},
                        "argument": {
                          "application": {
                            "function": {
                              "typeApplication": {
                                "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.elems"}, "type": {"variable": "hydra.core.model.Name"}}},
                                "type": {"variable": "hydra.core.model.TypeScheme"}}},
                            "argument": {
                              "application": {
                                "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "boundTypes"}},
                                "argument": {"variable": "cx"}}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {"literal": {"string": "Get all free variables in a graph's bound types"}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.inference.freshVariableType",
        "signature": {
          "typeParameters": [],
          "parameters": [{"name": "arg0", "type": {"variable": "hydra.core.typing.InferenceContext"}, "isLazy": false}],
          "result": {
            "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "cx",
                "domain": {"variable": "hydra.core.typing.InferenceContext"},
                "body": {
                  "let": {
                    "bindings": [
                      {
                        "name": "result",
                        "term": {"application": {"function": {"variable": "hydra.core.names.freshName"}, "argument": {"variable": "cx"}}},
                        "typeScheme": {
                          "variables": [],
                          "body": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}},
                          "constraints": []}}],
                    "body": {
                      "let": {
                        "bindings": [
                          {
                            "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.typing.InferenceContext"}}},
                                "argument": {"variable": "result"}}},
                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Name"}, "constraints": []}}],
                        "body": {
                          "let": {
                            "bindings": [
                              {
                                "name": "cx2",
                                "term": {
                                  "application": {
                                    "function": {
                                      "typeApplication": {
                                        "body": {
                                          "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"variable": "hydra.core.model.Name"}}},
                                        "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                    "argument": {"variable": "result"}}},
                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "constraints": []}}],
                            "body": {
                              "typeApplication": {
                                "body": {
                                  "typeApplication": {
                                    "body": {
                                      "pair": {
                                        "first": {"inject": {"typeName": "hydra.core.model.Type", "field": {"name": "variable", "term": {"variable": "name"}}}},
                                        "second": {"variable": "cx2"}}},
                                    "type": {"variable": "hydra.core.model.Type"}}},
                                "type": {"variable": "hydra.core.typing.InferenceContext"}}}}}}}}}}},
            "annotation": {"map": [{"key": {"variable": "description"}, "value": {"literal": {"string": "Generate a fresh type variable"}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.inference.generalize",
        "signature": {
          "typeParameters": [],
          "parameters": [
            {"name": "arg0", "type": {"variable": "hydra.core.graph.Graph"}, "isLazy": false},
            {"name": "arg1", "type": {"variable": "hydra.core.model.Type"}, "isLazy": false}],
          "result": {"type": {"variable": "hydra.core.model.TypeScheme"}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "cx",
                "domain": {"variable": "hydra.core.graph.Graph"},
                "body": {
                  "lambda": {
                    "parameter": "typ",
                    "domain": {"variable": "hydra.core.model.Type"},
                    "body": {
                      "let": {
                        "bindings": [
                          {
                            "name": "isTypeVarName",
                            "term": {
                              "lambda": {
                                "parameter": "name",
                                "domain": {"variable": "hydra.core.model.Name"},
                                "body": {
                                  "let": {
                                    "bindings": [
                                      {
                                        "name": "parts",
                                        "term": {
                                          "application": {
                                            "function": {"application": {"function": {"variable": "hydra.core.lib.strings.splitOn"}, "argument": {"literal": {"string": "."}}}},
                                            "argument": {"application": {"function": {"unwrap": "hydra.core.model.Name"}, "argument": {"variable": "name"}}}}},
                                        "typeScheme": {"variables": [], "body": {"list": {"literal": "string"}}, "constraints": []}}],
                                    "body": {
                                      "application": {
                                        "function": {
                                          "application": {
                                            "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.ordering.lte"}, "type": {"literal": {"integer": "int32"}}}},
                                            "argument": {
                                              "application": {
                                                "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.length"}, "type": {"literal": "string"}}},
                                                "argument": {"variable": "parts"}}}}},
                                        "argument": {"literal": {"integer": {"int32": 1}}}}}}}}},
                            "typeScheme": {
                              "variables": [],
                              "body": {"function": {"domain": {"variable": "hydra.core.model.Name"}, "codomain": {"literal": "boolean"}}},
                              "constraints": []}}],
                        "body": {
                          "let": {
                            "bindings": [
                              {
                                "name": "boundFreeVars",
                                "term": {
                                  "application": {"function": {"variable": "hydra.core.inference.freeVariablesInContext"}, "argument": {"variable": "cx"}}},
                                "typeScheme": {"variables": [], "body": {"set": {"variable": "hydra.core.model.Name"}}, "constraints": []}}],
                            "body": {
                              "let": {
                                "bindings": [
                                  {
                                    "name": "isUnboundFast",
                                    "term": {
                                      "lambda": {
                                        "parameter": "v",
                                        "domain": {"variable": "hydra.core.model.Name"},
                                        "body": {
                                          "application": {
                                            "function": {
                                              "application": {
                                                "function": {"variable": "hydra.core.lib.logic.and"},
                                                "argument": {
                                                  "application": {
                                                    "function": {"variable": "hydra.core.lib.logic.not"},
                                                    "argument": {
                                                      "application": {
                                                        "function": {
                                                          "application": {
                                                            "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.member"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                            "argument": {"variable": "v"}}},
                                                        "argument": {"variable": "boundFreeVars"}}}}}}},
                                            "argument": {
                                              "application": {
                                                "function": {"variable": "hydra.core.lib.logic.not"},
                                                "argument": {
                                                  "application": {
                                                    "function": {
                                                      "application": {
                                                        "function": {
                                                          "typeApplication": {
                                                            "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.member"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                            "type": {"variable": "hydra.core.model.TypeScheme"}}},
                                                        "argument": {"variable": "v"}}},
                                                    "argument": {
                                                      "application": {
                                                        "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "schemaTypes"}},
                                                        "argument": {"variable": "cx"}}}}}}}}}}},
                                    "typeScheme": {
                                      "variables": [],
                                      "body": {"function": {"domain": {"variable": "hydra.core.model.Name"}, "codomain": {"literal": "boolean"}}},
                                      "constraints": []}}],
                                "body": {
                                  "let": {
                                    "bindings": [
                                      {
                                        "name": "vars",
                                        "term": {
                                          "application": {
                                            "function": {
                                              "typeApplication": {"body": {"variable": "hydra.core.lib.lists.distinct"}, "type": {"variable": "hydra.core.model.Name"}}},
                                            "argument": {
                                              "application": {
                                                "function": {
                                                  "application": {
                                                    "function": {
                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.lists.filter"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                    "argument": {
                                                      "lambda": {
                                                        "parameter": "v",
                                                        "domain": {"variable": "hydra.core.model.Name"},
                                                        "body": {
                                                          "application": {
                                                            "function": {
                                                              "application": {
                                                                "function": {"variable": "hydra.core.lib.logic.and"},
                                                                "argument": {"application": {"function": {"variable": "isUnboundFast"}, "argument": {"variable": "v"}}}}},
                                                            "argument": {"application": {"function": {"variable": "isTypeVarName"}, "argument": {"variable": "v"}}}}}}}}},
                                                "argument": {
                                                  "application": {"function": {"variable": "hydra.core.variables.freeVariablesInTypeOrdered"}, "argument": {"variable": "typ"}}}}}}},
                                        "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Name"}}, "constraints": []}}],
                                    "body": {
                                      "let": {
                                        "bindings": [
                                          {
                                            "name": "allConstraints",
                                            "term": {
                                              "application": {
                                                "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "classConstraints"}},
                                                "argument": {"variable": "cx"}}},
                                            "typeScheme": {
                                              "variables": [],
                                              "body": {
                                                "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}},
                                              "constraints": []}}],
                                        "body": {
                                          "let": {
                                            "bindings": [
                                              {
                                                "name": "relevantConstraints",
                                                "term": {
                                                  "application": {
                                                    "function": {
                                                      "typeApplication": {
                                                        "body": {
                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.maps.fromList"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                        "type": {"variable": "hydra.core.model.TypeVariableConstraints"}}},
                                                    "argument": {
                                                      "application": {
                                                        "function": {
                                                          "typeApplication": {
                                                            "body": {"variable": "hydra.core.lib.optionals.givens"},
                                                            "type": {
                                                              "pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}},
                                                        "argument": {
                                                          "application": {
                                                            "function": {
                                                              "application": {
                                                                "function": {
                                                                  "typeApplication": {
                                                                    "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                    "type": {
                                                                      "optional": {
                                                                        "pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}},
                                                                "argument": {
                                                                  "lambda": {
                                                                    "parameter": "v",
                                                                    "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.TypeVariableConstraints"}}},
                                                                                "type": {
                                                                                  "pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}},
                                                                            "argument": {
                                                                              "lambda": {
                                                                                "parameter": "meta",
                                                                                "domain": {"variable": "hydra.core.model.TypeVariableConstraints"},
                                                                                "body": {
                                                                                  "typeApplication": {
                                                                                    "body": {
                                                                                      "typeApplication": {
                                                                                        "body": {"pair": {"first": {"variable": "v"}, "second": {"variable": "meta"}}},
                                                                                        "type": {"variable": "hydra.core.model.Name"}}},
                                                                                    "type": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}},
                                                                        "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.TypeVariableConstraints"}}},
                                                                                "argument": {"variable": "v"}}},
                                                                            "argument": {"variable": "allConstraints"}}}}}}}}},
                                                            "argument": {"variable": "vars"}}}}}}},
                                                "typeScheme": {
                                                  "variables": [],
                                                  "body": {
                                                    "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}},
                                                  "constraints": []}}],
                                            "body": {
                                              "record": {
                                                "typeName": "hydra.core.model.TypeScheme",
                                                "fields": [
                                                  {"name": "variables", "term": {"variable": "vars"}},
                                                  {"name": "body", "term": {"variable": "typ"}},
                                                  {"name": "constraints", "term": {"variable": "relevantConstraints"}}]}}}}}}}}}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {"literal": {"string": "Generalize a type to a type scheme. Paper: inference.tex, gen() and rule Gen."}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.inference.headOrFail",
        "signature": {
          "typeParameters": [{"name": "t0", "constraints": []}],
          "parameters": [
            {"name": "arg0", "type": {"literal": "string"}, "isLazy": false},
            {"name": "arg1", "type": {"list": {"variable": "t0"}}, "isLazy": false}],
          "result": {"type": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "t0"}}}}},
        "body": {
          "typeLambda": {
            "parameter": "t0",
            "body": {
              "annotated": {
                "body": {
                  "lambda": {
                    "parameter": "desc",
                    "domain": {"literal": "string"},
                    "body": {
                      "lambda": {
                        "parameter": "xs",
                        "domain": {"list": {"variable": "t0"}},
                        "body": {
                          "application": {
                            "function": {
                              "application": {
                                "function": {
                                  "application": {
                                    "function": {
                                      "typeApplication": {
                                        "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.optionals.match"}, "type": {"variable": "t0"}}},
                                        "type": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "t0"}}}}},
                                    "argument": {
                                      "application": {
                                        "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.head"}, "type": {"variable": "t0"}}},
                                        "argument": {"variable": "xs"}}}}},
                                "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": "headOrFail: "}}}},
                                                          "argument": {"variable": "desc"}}}}}}}}}},
                                        "type": {"variable": "hydra.core.errors.Error"}}},
                                    "type": {"variable": "t0"}}}}},
                            "argument": {
                              "lambda": {
                                "parameter": "x",
                                "domain": {"variable": "t0"},
                                "body": {
                                  "typeApplication": {
                                    "body": {"typeApplication": {"body": {"either": {"right": {"variable": "x"}}}, "type": {"variable": "hydra.core.errors.Error"}}},
                                    "type": {"variable": "t0"}}}}}}}}}}},
                "annotation": {
                  "map": [
                    {
                      "key": {"variable": "description"},
                      "value": {
                        "literal": {"string": "Return the first element of a list, or Left(Other) with the given description if the list is empty"}}}]}}}}}}},
    {
      "term": {
        "name": "hydra.core.inference.inferGraphTypes",
        "signature": {
          "typeParameters": [],
          "parameters": [
            {"name": "arg0", "type": {"variable": "hydra.core.typing.InferenceContext"}, "isLazy": false},
            {"name": "arg1", "type": {"list": {"variable": "hydra.core.model.Binding"}}, "isLazy": false},
            {"name": "arg2", "type": {"variable": "hydra.core.graph.Graph"}, "isLazy": false}],
          "result": {
            "type": {
              "either": {
                "left": {"variable": "hydra.core.errors.Error"},
                "right": {
                  "pair": {
                    "first": {
                      "pair": {"first": {"variable": "hydra.core.graph.Graph"}, "second": {"list": {"variable": "hydra.core.model.Binding"}}}},
                    "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "fcx0",
                "domain": {"variable": "hydra.core.typing.InferenceContext"},
                "body": {
                  "lambda": {
                    "parameter": "bindings0",
                    "domain": {"list": {"variable": "hydra.core.model.Binding"}},
                    "body": {
                      "lambda": {
                        "parameter": "g0",
                        "domain": {"variable": "hydra.core.graph.Graph"},
                        "body": {
                          "let": {
                            "bindings": [
                              {
                                "name": "fcx",
                                "term": {"variable": "fcx0"},
                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "constraints": []}}],
                            "body": {
                              "let": {
                                "bindings": [
                                  {
                                    "name": "let0",
                                    "term": {
                                      "record": {
                                        "typeName": "hydra.core.model.Let",
                                        "fields": [
                                          {"name": "bindings", "term": {"variable": "bindings0"}},
                                          {"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": "fromLetTerm",
                                        "term": {
                                          "lambda": {
                                            "parameter": "l",
                                            "domain": {"variable": "hydra.core.model.Let"},
                                            "body": {
                                              "let": {
                                                "bindings": [
                                                  {
                                                    "name": "bindings",
                                                    "term": {
                                                      "application": {"function": {"project": {"typeName": "hydra.core.model.Let", "fieldName": "bindings"}}, "argument": {"variable": "l"}}},
                                                    "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Binding"}}, "constraints": []}}],
                                                "body": {
                                                  "let": {
                                                    "bindings": [
                                                      {
                                                        "name": "prims",
                                                        "term": {
                                                          "application": {
                                                            "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "primitives"}},
                                                            "argument": {"variable": "g0"}}},
                                                        "typeScheme": {
                                                          "variables": [],
                                                          "body": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.graph.Primitive"}}},
                                                          "constraints": []}}],
                                                    "body": {
                                                      "let": {
                                                        "bindings": [
                                                          {
                                                            "name": "schemaTypes",
                                                            "term": {
                                                              "application": {
                                                                "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "schemaTypes"}},
                                                                "argument": {"variable": "g0"}}},
                                                            "typeScheme": {
                                                              "variables": [],
                                                              "body": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeScheme"}}},
                                                              "constraints": []}}],
                                                        "body": {
                                                          "let": {
                                                            "bindings": [
                                                              {
                                                                "name": "rawG",
                                                                "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": {"variable": "prims"}}},
                                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.graph.Graph"}, "constraints": []}}],
                                                            "body": {
                                                              "let": {
                                                                "bindings": [
                                                                  {
                                                                    "name": "g",
                                                                    "term": {
                                                                      "record": {
                                                                        "typeName": "hydra.core.graph.Graph",
                                                                        "fields": [
                                                                          {
                                                                            "name": "boundTerms",
                                                                            "term": {
                                                                              "application": {
                                                                                "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "boundTerms"}},
                                                                                "argument": {"variable": "rawG"}}}},
                                                                          {
                                                                            "name": "boundTypes",
                                                                            "term": {
                                                                              "application": {
                                                                                "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "boundTypes"}},
                                                                                "argument": {"variable": "rawG"}}}},
                                                                          {
                                                                            "name": "classConstraints",
                                                                            "term": {
                                                                              "application": {
                                                                                "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "classConstraints"}},
                                                                                "argument": {"variable": "rawG"}}}},
                                                                          {
                                                                            "name": "lambdaVariables",
                                                                            "term": {
                                                                              "application": {
                                                                                "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "lambdaVariables"}},
                                                                                "argument": {"variable": "rawG"}}}},
                                                                          {
                                                                            "name": "metadata",
                                                                            "term": {
                                                                              "application": {
                                                                                "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "metadata"}},
                                                                                "argument": {"variable": "rawG"}}}},
                                                                          {
                                                                            "name": "primitives",
                                                                            "term": {
                                                                              "application": {
                                                                                "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "primitives"}},
                                                                                "argument": {"variable": "rawG"}}}},
                                                                          {"name": "schemaTypes", "term": {"variable": "schemaTypes"}},
                                                                          {
                                                                            "name": "typeVariables",
                                                                            "term": {
                                                                              "application": {
                                                                                "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "typeVariables"}},
                                                                                "argument": {"variable": "rawG"}}}}]}},
                                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.graph.Graph"}, "constraints": []}}],
                                                                "body": {
                                                                  "typeApplication": {
                                                                    "body": {
                                                                      "typeApplication": {
                                                                        "body": {"pair": {"first": {"variable": "g"}, "second": {"variable": "bindings"}}},
                                                                        "type": {"variable": "hydra.core.graph.Graph"}}},
                                                                    "type": {"list": {"variable": "hydra.core.model.Binding"}}}}}}}}}}}}}}}},
                                        "typeScheme": {
                                          "variables": [],
                                          "body": {
                                            "function": {
                                              "domain": {"variable": "hydra.core.model.Let"},
                                              "codomain": {
                                                "pair": {"first": {"variable": "hydra.core.graph.Graph"}, "second": {"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": {"variable": "hydra.core.typing.InferenceResult"}}},
                                                "type": {
                                                  "pair": {
                                                    "first": {
                                                      "pair": {"first": {"variable": "hydra.core.graph.Graph"}, "second": {"list": {"variable": "hydra.core.model.Binding"}}}},
                                                    "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                            "argument": {
                                              "application": {
                                                "function": {
                                                  "application": {
                                                    "function": {
                                                      "application": {
                                                        "function": {"application": {"function": {"variable": "hydra.core.inference.inferTypeOfTerm"}, "argument": {"variable": "fcx"}}},
                                                        "argument": {"variable": "g0"}}},
                                                    "argument": {"inject": {"typeName": "hydra.core.model.Term", "field": {"name": "let", "term": {"variable": "let0"}}}}}},
                                                "argument": {"literal": {"string": "graph term"}}}}}},
                                        "argument": {
                                          "lambda": {
                                            "parameter": "result",
                                            "domain": {"variable": "hydra.core.typing.InferenceResult"},
                                            "body": {
                                              "let": {
                                                "bindings": [
                                                  {
                                                    "name": "fcx2",
                                                    "term": {
                                                      "application": {
                                                        "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "context"}},
                                                        "argument": {"variable": "result"}}},
                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "constraints": []}}],
                                                "body": {
                                                  "let": {
                                                    "bindings": [
                                                      {
                                                        "name": "term",
                                                        "term": {
                                                          "application": {
                                                            "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "term"}},
                                                            "argument": {"variable": "result"}}},
                                                        "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": "unit"}},
                                                                "type": {
                                                                  "pair": {
                                                                    "first": {
                                                                      "pair": {"first": {"variable": "hydra.core.graph.Graph"}, "second": {"list": {"variable": "hydra.core.model.Binding"}}}},
                                                                    "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                            "argument": {
                                                              "application": {
                                                                "function": {
                                                                  "application": {
                                                                    "function": {
                                                                      "application": {"function": {"variable": "hydra.core.inference.dischargeClassConstraints"}, "argument": {"variable": "fcx2"}}},
                                                                    "argument": {
                                                                      "application": {
                                                                        "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "subst"}},
                                                                        "argument": {"variable": "result"}}}}},
                                                                "argument": {
                                                                  "application": {
                                                                    "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "classConstraints"}},
                                                                    "argument": {"variable": "result"}}}}}}},
                                                        "argument": {
                                                          "lambda": {
                                                            "parameter": "_",
                                                            "domain": "unit",
                                                            "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": {
                                                                          "pair": {
                                                                            "first": {
                                                                              "pair": {"first": {"variable": "hydra.core.graph.Graph"}, "second": {"list": {"variable": "hydra.core.model.Binding"}}}},
                                                                            "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                    "argument": {
                                                                      "application": {
                                                                        "function": {
                                                                          "application": {
                                                                            "function": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "typeApplication": {
                                                                                    "body": {"variable": "hydra.core.inference.finalizeInferredTerm"},
                                                                                    "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                "argument": {"variable": "fcx2"}}},
                                                                            "argument": {"variable": "g0"}}},
                                                                        "argument": {"variable": "term"}}}}},
                                                                "argument": {
                                                                  "lambda": {
                                                                    "parameter": "finalized",
                                                                    "domain": {"variable": "hydra.core.model.Term"},
                                                                    "body": {
                                                                      "application": {
                                                                        "function": {
                                                                          "cases": {
                                                                            "typeName": "hydra.core.model.Term",
                                                                            "cases": [
                                                                              {
                                                                                "name": "let",
                                                                                "handler": {
                                                                                  "lambda": {
                                                                                    "parameter": "l",
                                                                                    "domain": {"variable": "hydra.core.model.Let"},
                                                                                    "body": {
                                                                                      "typeApplication": {
                                                                                        "body": {
                                                                                          "typeApplication": {
                                                                                            "body": {
                                                                                              "either": {
                                                                                                "right": {
                                                                                                  "typeApplication": {
                                                                                                    "body": {
                                                                                                      "typeApplication": {
                                                                                                        "body": {
                                                                                                          "pair": {
                                                                                                            "first": {"application": {"function": {"variable": "fromLetTerm"}, "argument": {"variable": "l"}}},
                                                                                                            "second": {"variable": "fcx2"}}},
                                                                                                        "type": {
                                                                                                          "pair": {"first": {"variable": "hydra.core.graph.Graph"}, "second": {"list": {"variable": "hydra.core.model.Binding"}}}}}},
                                                                                                    "type": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                            "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                        "type": {
                                                                                          "pair": {
                                                                                            "first": {
                                                                                              "pair": {"first": {"variable": "hydra.core.graph.Graph"}, "second": {"list": {"variable": "hydra.core.model.Binding"}}}},
                                                                                            "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}}},
                                                                              {
                                                                                "name": "variable",
                                                                                "handler": {
                                                                                  "lambda": {
                                                                                    "parameter": "_",
                                                                                    "domain": {"variable": "hydra.core.model.Name"},
                                                                                    "body": {
                                                                                      "typeApplication": {
                                                                                        "body": {
                                                                                          "typeApplication": {
                                                                                            "body": {
                                                                                              "either": {
                                                                                                "left": {
                                                                                                  "inject": {
                                                                                                    "typeName": "hydra.core.errors.Error",
                                                                                                    "field": {
                                                                                                      "name": "inference",
                                                                                                      "term": {
                                                                                                        "inject": {
                                                                                                          "typeName": "hydra.core.errors.InferenceError",
                                                                                                          "field": {
                                                                                                            "name": "other",
                                                                                                            "term": {
                                                                                                              "record": {
                                                                                                                "typeName": "hydra.core.errors.OtherInferenceError",
                                                                                                                "fields": [
                                                                                                                  {
                                                                                                                    "name": "path",
                                                                                                                    "term": {
                                                                                                                      "wrap": {
                                                                                                                        "typeName": "hydra.core.paths.SubtermPath",
                                                                                                                        "body": {
                                                                                                                          "application": {
                                                                                                                            "function": {
                                                                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.lists.reverse"}, "type": {"variable": "hydra.core.paths.SubtermStep"}}},
                                                                                                                            "argument": {
                                                                                                                              "application": {
                                                                                                                                "function": {"project": {"typeName": "hydra.core.typing.InferenceContext", "fieldName": "trace"}},
                                                                                                                                "argument": {"variable": "fcx2"}}}}}}}},
                                                                                                                  {"name": "message", "term": {"literal": {"string": "Expected inferred graph as let term"}}}]}}}}}}}}}},
                                                                                            "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                        "type": {
                                                                                          "pair": {
                                                                                            "first": {
                                                                                              "pair": {"first": {"variable": "hydra.core.graph.Graph"}, "second": {"list": {"variable": "hydra.core.model.Binding"}}}},
                                                                                            "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}}}]}},
                                                                        "argument": {"variable": "finalized"}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {
                    "literal": {
                      "string": "Infer types for all elements in a graph, using the provided ordered bindings. Returns both the inferred graph and the ordered inferred bindings. Paper: inference.tex, the SCC treatment of cycles (section introduction); the whole graph is one mutually recursive let."}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.inference.inferInGraphContext",
        "signature": {
          "typeParameters": [],
          "parameters": [
            {"name": "arg0", "type": {"variable": "hydra.core.typing.InferenceContext"}, "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": {"variable": "hydra.core.typing.InferenceResult"}}}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "fcx",
                "domain": {"variable": "hydra.core.typing.InferenceContext"},
                "body": {
                  "lambda": {
                    "parameter": "cx",
                    "domain": {"variable": "hydra.core.graph.Graph"},
                    "body": {
                      "lambda": {
                        "parameter": "term",
                        "domain": {"variable": "hydra.core.model.Term"},
                        "body": {
                          "application": {
                            "function": {
                              "application": {
                                "function": {
                                  "typeApplication": {
                                    "body": {
                                      "typeApplication": {
                                        "body": {
                                          "typeApplication": {"body": {"variable": "hydra.core.lib.eithers.bind"}, "type": {"variable": "hydra.core.errors.Error"}}},
                                        "type": {"variable": "hydra.core.typing.InferenceResult"}}},
                                    "type": {"variable": "hydra.core.typing.InferenceResult"}}},
                                "argument": {
                                  "application": {
                                    "function": {
                                      "application": {
                                        "function": {
                                          "application": {
                                            "function": {"application": {"function": {"variable": "hydra.core.inference.inferTypeOfTerm"}, "argument": {"variable": "fcx"}}},
                                            "argument": {"variable": "cx"}}},
                                        "argument": {"variable": "term"}}},
                                    "argument": {"literal": {"string": "single term"}}}}}},
                            "argument": {
                              "lambda": {
                                "parameter": "result",
                                "domain": {"variable": "hydra.core.typing.InferenceResult"},
                                "body": {
                                  "let": {
                                    "bindings": [
                                      {
                                        "name": "fcx2",
                                        "term": {
                                          "application": {
                                            "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "context"}},
                                            "argument": {"variable": "result"}}},
                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "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": "unit"}},
                                                "type": {"variable": "hydra.core.typing.InferenceResult"}}},
                                            "argument": {
                                              "application": {
                                                "function": {
                                                  "application": {
                                                    "function": {
                                                      "application": {"function": {"variable": "hydra.core.inference.dischargeClassConstraints"}, "argument": {"variable": "fcx2"}}},
                                                    "argument": {
                                                      "application": {
                                                        "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "subst"}},
                                                        "argument": {"variable": "result"}}}}},
                                                "argument": {
                                                  "application": {
                                                    "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "classConstraints"}},
                                                    "argument": {"variable": "result"}}}}}}},
                                        "argument": {
                                          "lambda": {
                                            "parameter": "_",
                                            "domain": "unit",
                                            "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.typing.InferenceResult"}}},
                                                    "argument": {
                                                      "application": {
                                                        "function": {
                                                          "application": {
                                                            "function": {
                                                              "application": {
                                                                "function": {
                                                                  "typeApplication": {
                                                                    "body": {"variable": "hydra.core.inference.finalizeInferredTerm"},
                                                                    "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                "argument": {"variable": "fcx2"}}},
                                                            "argument": {"variable": "cx"}}},
                                                        "argument": {
                                                          "application": {
                                                            "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "term"}},
                                                            "argument": {"variable": "result"}}}}}}},
                                                "argument": {
                                                  "lambda": {
                                                    "parameter": "finalized",
                                                    "domain": {"variable": "hydra.core.model.Term"},
                                                    "body": {
                                                      "typeApplication": {
                                                        "body": {
                                                          "typeApplication": {
                                                            "body": {
                                                              "either": {
                                                                "right": {
                                                                  "record": {
                                                                    "typeName": "hydra.core.typing.InferenceResult",
                                                                    "fields": [
                                                                      {"name": "term", "term": {"variable": "finalized"}},
                                                                      {
                                                                        "name": "type",
                                                                        "term": {
                                                                          "application": {
                                                                            "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "type"}},
                                                                            "argument": {"variable": "result"}}}},
                                                                      {
                                                                        "name": "subst",
                                                                        "term": {
                                                                          "application": {
                                                                            "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "subst"}},
                                                                            "argument": {"variable": "result"}}}},
                                                                      {
                                                                        "name": "classConstraints",
                                                                        "term": {
                                                                          "application": {
                                                                            "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "classConstraints"}},
                                                                            "argument": {"variable": "result"}}}},
                                                                      {"name": "context", "term": {"variable": "fcx2"}}]}}}},
                                                            "type": {"variable": "hydra.core.errors.Error"}}},
                                                        "type": {"variable": "hydra.core.typing.InferenceResult"}}}}}}}}}}}}}}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {
                    "literal": {
                      "string": "Infer the type of a term in a given inference context, running the same soundness tail (class-constraint discharge and finalization) as the other top-level entry points"}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.inference.inferMany",
        "signature": {
          "typeParameters": [],
          "parameters": [
            {"name": "arg0", "type": {"variable": "hydra.core.typing.InferenceContext"}, "isLazy": false},
            {"name": "arg1", "type": {"variable": "hydra.core.graph.Graph"}, "isLazy": false},
            {
              "name": "arg2",
              "type": {"list": {"pair": {"first": {"variable": "hydra.core.model.Term"}, "second": {"literal": "string"}}}},
              "isLazy": false}],
          "result": {
            "type": {
              "either": {
                "left": {"variable": "hydra.core.errors.Error"},
                "right": {
                  "pair": {
                    "first": {
                      "pair": {
                        "first": {"list": {"variable": "hydra.core.model.Term"}},
                        "second": {
                          "pair": {
                            "first": {"list": {"variable": "hydra.core.model.Type"}},
                            "second": {
                              "pair": {
                                "first": {"variable": "hydra.core.typing.TypeSubst"},
                                "second": {
                                  "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}},
                    "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "fcx",
                "domain": {"variable": "hydra.core.typing.InferenceContext"},
                "body": {
                  "lambda": {
                    "parameter": "cx",
                    "domain": {"variable": "hydra.core.graph.Graph"},
                    "body": {
                      "lambda": {
                        "parameter": "pairs",
                        "domain": {"list": {"pair": {"first": {"variable": "hydra.core.model.Term"}, "second": {"literal": "string"}}}},
                        "body": {
                          "let": {
                            "bindings": [
                              {
                                "name": "emptyResult",
                                "term": {
                                  "typeLambda": {
                                    "parameter": "t0",
                                    "body": {
                                      "typeLambda": {
                                        "parameter": "t1",
                                        "body": {
                                          "typeLambda": {
                                            "parameter": "t2",
                                            "body": {
                                              "typeLambda": {
                                                "parameter": "t3",
                                                "body": {
                                                  "typeLambda": {
                                                    "parameter": "t4",
                                                    "body": {
                                                      "typeApplication": {
                                                        "body": {
                                                          "typeApplication": {
                                                            "body": {
                                                              "either": {
                                                                "right": {
                                                                  "typeApplication": {
                                                                    "body": {
                                                                      "typeApplication": {
                                                                        "body": {
                                                                          "pair": {
                                                                            "first": {
                                                                              "typeApplication": {
                                                                                "body": {
                                                                                  "typeApplication": {
                                                                                    "body": {
                                                                                      "pair": {
                                                                                        "first": {"typeApplication": {"body": {"list": []}, "type": {"variable": "t1"}}},
                                                                                        "second": {
                                                                                          "typeApplication": {
                                                                                            "body": {
                                                                                              "typeApplication": {
                                                                                                "body": {
                                                                                                  "pair": {
                                                                                                    "first": {"typeApplication": {"body": {"list": []}, "type": {"variable": "t2"}}},
                                                                                                    "second": {
                                                                                                      "typeApplication": {
                                                                                                        "body": {
                                                                                                          "typeApplication": {
                                                                                                            "body": {
                                                                                                              "pair": {
                                                                                                                "first": {"variable": "hydra.core.substitution.idTypeSubst"},
                                                                                                                "second": {
                                                                                                                  "typeApplication": {
                                                                                                                    "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.empty"}, "type": {"variable": "t3"}}},
                                                                                                                    "type": {"variable": "t4"}}}}},
                                                                                                            "type": {"variable": "hydra.core.typing.TypeSubst"}}},
                                                                                                        "type": {"map": {"keys": {"variable": "t3"}, "values": {"variable": "t4"}}}}}}},
                                                                                                "type": {"list": {"variable": "t2"}}}},
                                                                                            "type": {
                                                                                              "pair": {
                                                                                                "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                "second": {"map": {"keys": {"variable": "t3"}, "values": {"variable": "t4"}}}}}}}}},
                                                                                    "type": {"list": {"variable": "t1"}}}},
                                                                                "type": {
                                                                                  "pair": {
                                                                                    "first": {"list": {"variable": "t2"}},
                                                                                    "second": {
                                                                                      "pair": {
                                                                                        "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                        "second": {"map": {"keys": {"variable": "t3"}, "values": {"variable": "t4"}}}}}}}}},
                                                                            "second": {"variable": "fcx"}}},
                                                                        "type": {
                                                                          "pair": {
                                                                            "first": {"list": {"variable": "t1"}},
                                                                            "second": {
                                                                              "pair": {
                                                                                "first": {"list": {"variable": "t2"}},
                                                                                "second": {
                                                                                  "pair": {
                                                                                    "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                    "second": {"map": {"keys": {"variable": "t3"}, "values": {"variable": "t4"}}}}}}}}}}},
                                                                    "type": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                            "type": {"variable": "t0"}}},
                                                        "type": {
                                                          "pair": {
                                                            "first": {
                                                              "pair": {
                                                                "first": {"list": {"variable": "t1"}},
                                                                "second": {
                                                                  "pair": {
                                                                    "first": {"list": {"variable": "t2"}},
                                                                    "second": {
                                                                      "pair": {
                                                                        "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                        "second": {"map": {"keys": {"variable": "t3"}, "values": {"variable": "t4"}}}}}}}}},
                                                            "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}}}}}}}}}},
                                "typeScheme": {
                                  "variables": ["t0", "t1", "t2", "t3", "t4"],
                                  "body": {
                                    "either": {
                                      "left": {"variable": "t0"},
                                      "right": {
                                        "pair": {
                                          "first": {
                                            "pair": {
                                              "first": {"list": {"variable": "t1"}},
                                              "second": {
                                                "pair": {
                                                  "first": {"list": {"variable": "t2"}},
                                                  "second": {
                                                    "pair": {
                                                      "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                      "second": {"map": {"keys": {"variable": "t3"}, "values": {"variable": "t4"}}}}}}}}},
                                          "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                  "constraints": []}}],
                            "body": {
                              "application": {
                                "function": {
                                  "application": {
                                    "function": {
                                      "application": {
                                        "function": {
                                          "typeApplication": {
                                            "body": {
                                              "typeApplication": {
                                                "body": {"variable": "hydra.core.lib.optionals.match"},
                                                "type": {
                                                  "pair": {
                                                    "first": {"pair": {"first": {"variable": "hydra.core.model.Term"}, "second": {"literal": "string"}}},
                                                    "second": {"list": {"pair": {"first": {"variable": "hydra.core.model.Term"}, "second": {"literal": "string"}}}}}}}},
                                            "type": {
                                              "either": {
                                                "left": {"variable": "hydra.core.errors.Error"},
                                                "right": {
                                                  "pair": {
                                                    "first": {
                                                      "pair": {
                                                        "first": {"list": {"variable": "hydra.core.model.Term"}},
                                                        "second": {
                                                          "pair": {
                                                            "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                            "second": {
                                                              "pair": {
                                                                "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                "second": {
                                                                  "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}},
                                                    "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}},
                                        "argument": {
                                          "application": {
                                            "function": {
                                              "typeApplication": {
                                                "body": {"variable": "hydra.core.lib.lists.uncons"},
                                                "type": {"pair": {"first": {"variable": "hydra.core.model.Term"}, "second": {"literal": "string"}}}}},
                                            "argument": {"variable": "pairs"}}}}},
                                    "argument": {
                                      "typeApplication": {
                                        "body": {
                                          "typeApplication": {
                                            "body": {
                                              "typeApplication": {
                                                "body": {
                                                  "typeApplication": {
                                                    "body": {"typeApplication": {"body": {"variable": "emptyResult"}, "type": {"variable": "hydra.core.errors.Error"}}},
                                                    "type": {"variable": "hydra.core.model.Term"}}},
                                                "type": {"variable": "hydra.core.model.Type"}}},
                                            "type": {"variable": "hydra.core.model.Name"}}},
                                        "type": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}},
                                "argument": {
                                  "lambda": {
                                    "parameter": "pairsUc",
                                    "domain": {
                                      "pair": {
                                        "first": {"pair": {"first": {"variable": "hydra.core.model.Term"}, "second": {"literal": "string"}}},
                                        "second": {"list": {"pair": {"first": {"variable": "hydra.core.model.Term"}, "second": {"literal": "string"}}}}}},
                                    "body": {
                                      "let": {
                                        "bindings": [
                                          {
                                            "name": "headPair",
                                            "term": {
                                              "application": {
                                                "function": {
                                                  "typeApplication": {
                                                    "body": {
                                                      "typeApplication": {
                                                        "body": {"variable": "hydra.core.lib.pairs.first"},
                                                        "type": {"pair": {"first": {"variable": "hydra.core.model.Term"}, "second": {"literal": "string"}}}}},
                                                    "type": {"list": {"pair": {"first": {"variable": "hydra.core.model.Term"}, "second": {"literal": "string"}}}}}},
                                                "argument": {"variable": "pairsUc"}}},
                                            "typeScheme": {
                                              "variables": [],
                                              "body": {"pair": {"first": {"variable": "hydra.core.model.Term"}, "second": {"literal": "string"}}},
                                              "constraints": []}}],
                                        "body": {
                                          "let": {
                                            "bindings": [
                                              {
                                                "name": "tl",
                                                "term": {
                                                  "application": {
                                                    "function": {
                                                      "typeApplication": {
                                                        "body": {
                                                          "typeApplication": {
                                                            "body": {"variable": "hydra.core.lib.pairs.second"},
                                                            "type": {"pair": {"first": {"variable": "hydra.core.model.Term"}, "second": {"literal": "string"}}}}},
                                                        "type": {"list": {"pair": {"first": {"variable": "hydra.core.model.Term"}, "second": {"literal": "string"}}}}}},
                                                    "argument": {"variable": "pairsUc"}}},
                                                "typeScheme": {
                                                  "variables": [],
                                                  "body": {"list": {"pair": {"first": {"variable": "hydra.core.model.Term"}, "second": {"literal": "string"}}}},
                                                  "constraints": []}}],
                                            "body": {
                                              "let": {
                                                "bindings": [
                                                  {
                                                    "name": "e",
                                                    "term": {
                                                      "application": {
                                                        "function": {
                                                          "typeApplication": {
                                                            "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"variable": "hydra.core.model.Term"}}},
                                                            "type": {"literal": "string"}}},
                                                        "argument": {"variable": "headPair"}}},
                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                                "body": {
                                                  "let": {
                                                    "bindings": [
                                                      {
                                                        "name": "desc",
                                                        "term": {
                                                          "application": {
                                                            "function": {
                                                              "typeApplication": {
                                                                "body": {
                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"variable": "hydra.core.model.Term"}}},
                                                                "type": {"literal": "string"}}},
                                                            "argument": {"variable": "headPair"}}},
                                                        "typeScheme": {"variables": [], "body": {"literal": "string"}, "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.InferenceResult"}}},
                                                                "type": {
                                                                  "pair": {
                                                                    "first": {
                                                                      "pair": {
                                                                        "first": {"list": {"variable": "hydra.core.model.Term"}},
                                                                        "second": {
                                                                          "pair": {
                                                                            "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                            "second": {
                                                                              "pair": {
                                                                                "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                "second": {
                                                                                  "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}},
                                                                    "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                            "argument": {
                                                              "application": {
                                                                "function": {
                                                                  "application": {
                                                                    "function": {
                                                                      "application": {
                                                                        "function": {"application": {"function": {"variable": "hydra.core.inference.inferTypeOfTerm"}, "argument": {"variable": "fcx"}}},
                                                                        "argument": {"variable": "cx"}}},
                                                                    "argument": {"variable": "e"}}},
                                                                "argument": {"variable": "desc"}}}}},
                                                        "argument": {
                                                          "lambda": {
                                                            "parameter": "result1",
                                                            "domain": {"variable": "hydra.core.typing.InferenceResult"},
                                                            "body": {
                                                              "let": {
                                                                "bindings": [
                                                                  {
                                                                    "name": "fcx2",
                                                                    "term": {
                                                                      "application": {
                                                                        "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "context"}},
                                                                        "argument": {"variable": "result1"}}},
                                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "constraints": []}}],
                                                                "body": {
                                                                  "let": {
                                                                    "bindings": [
                                                                      {
                                                                        "name": "e1",
                                                                        "term": {
                                                                          "application": {
                                                                            "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "term"}},
                                                                            "argument": {"variable": "result1"}}},
                                                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                                                    "body": {
                                                                      "let": {
                                                                        "bindings": [
                                                                          {
                                                                            "name": "t1",
                                                                            "term": {
                                                                              "application": {
                                                                                "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "type"}},
                                                                                "argument": {"variable": "result1"}}},
                                                                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
                                                                        "body": {
                                                                          "let": {
                                                                            "bindings": [
                                                                              {
                                                                                "name": "s1",
                                                                                "term": {
                                                                                  "application": {
                                                                                    "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "subst"}},
                                                                                    "argument": {"variable": "result1"}}},
                                                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.TypeSubst"}, "constraints": []}}],
                                                                            "body": {
                                                                              "let": {
                                                                                "bindings": [
                                                                                  {
                                                                                    "name": "c1",
                                                                                    "term": {
                                                                                      "application": {
                                                                                        "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "classConstraints"}},
                                                                                        "argument": {"variable": "result1"}}},
                                                                                    "typeScheme": {
                                                                                      "variables": [],
                                                                                      "body": {
                                                                                        "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}},
                                                                                      "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": {
                                                                                                  "pair": {
                                                                                                    "first": {
                                                                                                      "pair": {
                                                                                                        "first": {"list": {"variable": "hydra.core.model.Term"}},
                                                                                                        "second": {
                                                                                                          "pair": {
                                                                                                            "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                                            "second": {
                                                                                                              "pair": {
                                                                                                                "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                                "second": {
                                                                                                                  "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}},
                                                                                                    "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                            "type": {
                                                                                              "pair": {
                                                                                                "first": {
                                                                                                  "pair": {
                                                                                                    "first": {"list": {"variable": "hydra.core.model.Term"}},
                                                                                                    "second": {
                                                                                                      "pair": {
                                                                                                        "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                                        "second": {
                                                                                                          "pair": {
                                                                                                            "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                            "second": {
                                                                                                              "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}},
                                                                                                "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                        "argument": {
                                                                                          "application": {
                                                                                            "function": {
                                                                                              "application": {
                                                                                                "function": {"application": {"function": {"variable": "hydra.core.inference.inferMany"}, "argument": {"variable": "fcx2"}}},
                                                                                                "argument": {
                                                                                                  "application": {
                                                                                                    "function": {"application": {"function": {"variable": "hydra.core.substitution.substInContext"}, "argument": {"variable": "s1"}}},
                                                                                                    "argument": {"variable": "cx"}}}}},
                                                                                            "argument": {"variable": "tl"}}}}},
                                                                                    "argument": {
                                                                                      "lambda": {
                                                                                        "parameter": "rp2",
                                                                                        "domain": {
                                                                                          "pair": {
                                                                                            "first": {
                                                                                              "pair": {
                                                                                                "first": {"list": {"variable": "hydra.core.model.Term"}},
                                                                                                "second": {
                                                                                                  "pair": {
                                                                                                    "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                                    "second": {
                                                                                                      "pair": {
                                                                                                        "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                        "second": {
                                                                                                          "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}},
                                                                                            "second": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                        "body": {
                                                                                          "let": {
                                                                                            "bindings": [
                                                                                              {
                                                                                                "name": "result2",
                                                                                                "term": {
                                                                                                  "application": {
                                                                                                    "function": {
                                                                                                      "typeApplication": {
                                                                                                        "body": {
                                                                                                          "typeApplication": {
                                                                                                            "body": {"variable": "hydra.core.lib.pairs.first"},
                                                                                                            "type": {
                                                                                                              "pair": {
                                                                                                                "first": {"list": {"variable": "hydra.core.model.Term"}},
                                                                                                                "second": {
                                                                                                                  "pair": {
                                                                                                                    "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                                                    "second": {
                                                                                                                      "pair": {
                                                                                                                        "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                                        "second": {
                                                                                                                          "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}}}},
                                                                                                        "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                                    "argument": {"variable": "rp2"}}},
                                                                                                "typeScheme": {
                                                                                                  "variables": [],
                                                                                                  "body": {
                                                                                                    "pair": {
                                                                                                      "first": {"list": {"variable": "hydra.core.model.Term"}},
                                                                                                      "second": {
                                                                                                        "pair": {
                                                                                                          "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                                          "second": {
                                                                                                            "pair": {
                                                                                                              "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                              "second": {
                                                                                                                "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}},
                                                                                                  "constraints": []}}],
                                                                                            "body": {
                                                                                              "let": {
                                                                                                "bindings": [
                                                                                                  {
                                                                                                    "name": "fcx3",
                                                                                                    "term": {
                                                                                                      "application": {
                                                                                                        "function": {
                                                                                                          "typeApplication": {
                                                                                                            "body": {
                                                                                                              "typeApplication": {
                                                                                                                "body": {"variable": "hydra.core.lib.pairs.second"},
                                                                                                                "type": {
                                                                                                                  "pair": {
                                                                                                                    "first": {"list": {"variable": "hydra.core.model.Term"}},
                                                                                                                    "second": {
                                                                                                                      "pair": {
                                                                                                                        "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                                                        "second": {
                                                                                                                          "pair": {
                                                                                                                            "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                                            "second": {
                                                                                                                              "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}}}},
                                                                                                            "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                                        "argument": {"variable": "rp2"}}},
                                                                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "constraints": []}}],
                                                                                                "body": {
                                                                                                  "let": {
                                                                                                    "bindings": [
                                                                                                      {
                                                                                                        "name": "e2",
                                                                                                        "term": {
                                                                                                          "application": {
                                                                                                            "function": {
                                                                                                              "typeApplication": {
                                                                                                                "body": {
                                                                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"list": {"variable": "hydra.core.model.Term"}}}},
                                                                                                                "type": {
                                                                                                                  "pair": {
                                                                                                                    "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                                                    "second": {
                                                                                                                      "pair": {
                                                                                                                        "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                                        "second": {
                                                                                                                          "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}},
                                                                                                            "argument": {"variable": "result2"}}},
                                                                                                        "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Term"}}, "constraints": []}}],
                                                                                                    "body": {
                                                                                                      "let": {
                                                                                                        "bindings": [
                                                                                                          {
                                                                                                            "name": "t2",
                                                                                                            "term": {
                                                                                                              "application": {
                                                                                                                "function": {
                                                                                                                  "typeApplication": {
                                                                                                                    "body": {
                                                                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                                                                                    "type": {
                                                                                                                      "pair": {
                                                                                                                        "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                                        "second": {
                                                                                                                          "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}},
                                                                                                                "argument": {
                                                                                                                  "application": {
                                                                                                                    "function": {
                                                                                                                      "typeApplication": {
                                                                                                                        "body": {
                                                                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"list": {"variable": "hydra.core.model.Term"}}}},
                                                                                                                        "type": {
                                                                                                                          "pair": {
                                                                                                                            "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                                                            "second": {
                                                                                                                              "pair": {
                                                                                                                                "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                                                "second": {
                                                                                                                                  "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}},
                                                                                                                    "argument": {"variable": "result2"}}}}},
                                                                                                            "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Type"}}, "constraints": []}}],
                                                                                                        "body": {
                                                                                                          "let": {
                                                                                                            "bindings": [
                                                                                                              {
                                                                                                                "name": "s2",
                                                                                                                "term": {
                                                                                                                  "application": {
                                                                                                                    "function": {
                                                                                                                      "typeApplication": {
                                                                                                                        "body": {
                                                                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"variable": "hydra.core.typing.TypeSubst"}}},
                                                                                                                        "type": {
                                                                                                                          "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}},
                                                                                                                    "argument": {
                                                                                                                      "application": {
                                                                                                                        "function": {
                                                                                                                          "typeApplication": {
                                                                                                                            "body": {
                                                                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                                                                                            "type": {
                                                                                                                              "pair": {
                                                                                                                                "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                                                "second": {
                                                                                                                                  "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}},
                                                                                                                        "argument": {
                                                                                                                          "application": {
                                                                                                                            "function": {
                                                                                                                              "typeApplication": {
                                                                                                                                "body": {
                                                                                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"list": {"variable": "hydra.core.model.Term"}}}},
                                                                                                                                "type": {
                                                                                                                                  "pair": {
                                                                                                                                    "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                                                                    "second": {
                                                                                                                                      "pair": {
                                                                                                                                        "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                                                        "second": {
                                                                                                                                          "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}},
                                                                                                                            "argument": {"variable": "result2"}}}}}}},
                                                                                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.TypeSubst"}, "constraints": []}}],
                                                                                                            "body": {
                                                                                                              "let": {
                                                                                                                "bindings": [
                                                                                                                  {
                                                                                                                    "name": "c2",
                                                                                                                    "term": {
                                                                                                                      "application": {
                                                                                                                        "function": {
                                                                                                                          "typeApplication": {
                                                                                                                            "body": {
                                                                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"variable": "hydra.core.typing.TypeSubst"}}},
                                                                                                                            "type": {
                                                                                                                              "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}},
                                                                                                                        "argument": {
                                                                                                                          "application": {
                                                                                                                            "function": {
                                                                                                                              "typeApplication": {
                                                                                                                                "body": {
                                                                                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                                                                                                "type": {
                                                                                                                                  "pair": {
                                                                                                                                    "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                                                    "second": {
                                                                                                                                      "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}},
                                                                                                                            "argument": {
                                                                                                                              "application": {
                                                                                                                                "function": {
                                                                                                                                  "typeApplication": {
                                                                                                                                    "body": {
                                                                                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"list": {"variable": "hydra.core.model.Term"}}}},
                                                                                                                                    "type": {
                                                                                                                                      "pair": {
                                                                                                                                        "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                                                                        "second": {
                                                                                                                                          "pair": {
                                                                                                                                            "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                                                            "second": {
                                                                                                                                              "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}},
                                                                                                                                "argument": {"variable": "result2"}}}}}}},
                                                                                                                    "typeScheme": {
                                                                                                                      "variables": [],
                                                                                                                      "body": {
                                                                                                                        "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}},
                                                                                                                      "constraints": []}}],
                                                                                                                "body": {
                                                                                                                  "let": {
                                                                                                                    "bindings": [
                                                                                                                      {
                                                                                                                        "name": "c1Subst",
                                                                                                                        "term": {
                                                                                                                          "application": {
                                                                                                                            "function": {
                                                                                                                              "application": {"function": {"variable": "hydra.core.substitution.substInClassConstraints"}, "argument": {"variable": "s2"}}},
                                                                                                                            "argument": {"variable": "c1"}}},
                                                                                                                        "typeScheme": {
                                                                                                                          "variables": [],
                                                                                                                          "body": {
                                                                                                                            "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}},
                                                                                                                          "constraints": []}}],
                                                                                                                    "body": {
                                                                                                                      "let": {
                                                                                                                        "bindings": [
                                                                                                                          {
                                                                                                                            "name": "mergedConstraints",
                                                                                                                            "term": {
                                                                                                                              "application": {
                                                                                                                                "function": {
                                                                                                                                  "application": {
                                                                                                                                    "function": {
                                                                                                                                      "typeApplication": {"body": {"variable": "hydra.core.inference.mergeClassConstraints"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                                                    "argument": {"variable": "c1Subst"}}},
                                                                                                                                "argument": {"variable": "c2"}}},
                                                                                                                            "typeScheme": {
                                                                                                                              "variables": [],
                                                                                                                              "body": {
                                                                                                                                "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}},
                                                                                                                              "constraints": []}}],
                                                                                                                        "body": {
                                                                                                                          "typeApplication": {
                                                                                                                            "body": {
                                                                                                                              "typeApplication": {
                                                                                                                                "body": {
                                                                                                                                  "either": {
                                                                                                                                    "right": {
                                                                                                                                      "typeApplication": {
                                                                                                                                        "body": {
                                                                                                                                          "typeApplication": {
                                                                                                                                            "body": {
                                                                                                                                              "pair": {
                                                                                                                                                "first": {
                                                                                                                                                  "typeApplication": {
                                                                                                                                                    "body": {
                                                                                                                                                      "typeApplication": {
                                                                                                                                                        "body": {
                                                                                                                                                          "pair": {
                                                                                                                                                            "first": {
                                                                                                                                                              "application": {
                                                                                                                                                                "function": {
                                                                                                                                                                  "application": {
                                                                                                                                                                    "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.cons"}, "type": {"variable": "hydra.core.model.Term"}}},
                                                                                                                                                                    "argument": {
                                                                                                                                                                      "application": {
                                                                                                                                                                        "function": {"application": {"function": {"variable": "hydra.core.substitution.substTypesInTerm"}, "argument": {"variable": "s2"}}},
                                                                                                                                                                        "argument": {"variable": "e1"}}}}},
                                                                                                                                                                "argument": {"variable": "e2"}}},
                                                                                                                                                            "second": {
                                                                                                                                                              "typeApplication": {
                                                                                                                                                                "body": {
                                                                                                                                                                  "typeApplication": {
                                                                                                                                                                    "body": {
                                                                                                                                                                      "pair": {
                                                                                                                                                                        "first": {
                                                                                                                                                                          "application": {
                                                                                                                                                                            "function": {
                                                                                                                                                                              "application": {
                                                                                                                                                                                "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.cons"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                                                                                                                                "argument": {
                                                                                                                                                                                  "application": {
                                                                                                                                                                                    "function": {"application": {"function": {"variable": "hydra.core.substitution.substInType"}, "argument": {"variable": "s2"}}},
                                                                                                                                                                                    "argument": {"variable": "t1"}}}}},
                                                                                                                                                                            "argument": {"variable": "t2"}}},
                                                                                                                                                                        "second": {
                                                                                                                                                                          "typeApplication": {
                                                                                                                                                                            "body": {
                                                                                                                                                                              "typeApplication": {
                                                                                                                                                                                "body": {
                                                                                                                                                                                  "pair": {
                                                                                                                                                                                    "first": {
                                                                                                                                                                                      "application": {
                                                                                                                                                                                        "function": {"application": {"function": {"variable": "hydra.core.substitution.composeTypeSubst"}, "argument": {"variable": "s1"}}},
                                                                                                                                                                                        "argument": {"variable": "s2"}}},
                                                                                                                                                                                    "second": {"variable": "mergedConstraints"}}},
                                                                                                                                                                                "type": {"variable": "hydra.core.typing.TypeSubst"}}},
                                                                                                                                                                            "type": {
                                                                                                                                                                              "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}},
                                                                                                                                                                    "type": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                                                                                                                                "type": {
                                                                                                                                                                  "pair": {
                                                                                                                                                                    "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                                                                                    "second": {
                                                                                                                                                                      "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}},
                                                                                                                                                        "type": {"list": {"variable": "hydra.core.model.Term"}}}},
                                                                                                                                                    "type": {
                                                                                                                                                      "pair": {
                                                                                                                                                        "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                                                                                        "second": {
                                                                                                                                                          "pair": {
                                                                                                                                                            "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                                                                            "second": {
                                                                                                                                                              "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}},
                                                                                                                                                "second": {"variable": "fcx3"}}},
                                                                                                                                            "type": {
                                                                                                                                              "pair": {
                                                                                                                                                "first": {"list": {"variable": "hydra.core.model.Term"}},
                                                                                                                                                "second": {
                                                                                                                                                  "pair": {
                                                                                                                                                    "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                                                                                    "second": {
                                                                                                                                                      "pair": {
                                                                                                                                                        "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                                                                        "second": {
                                                                                                                                                          "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}}}},
                                                                                                                                        "type": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                                                                "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                                                            "type": {
                                                                                                                              "pair": {
                                                                                                                                "first": {
                                                                                                                                  "pair": {
                                                                                                                                    "first": {"list": {"variable": "hydra.core.model.Term"}},
                                                                                                                                    "second": {
                                                                                                                                      "pair": {
                                                                                                                                        "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                                                                        "second": {
                                                                                                                                          "pair": {
                                                                                                                                            "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                                                            "second": {
                                                                                                                                              "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}},
                                                                                                                                "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {"literal": {"string": "Infer types for multiple terms, propagating class constraints from sub-expressions"}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.inference.inferTypeOf",
        "signature": {
          "typeParameters": [],
          "parameters": [
            {"name": "arg0", "type": {"variable": "hydra.core.typing.InferenceContext"}, "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": {
                  "pair": {
                    "first": {"pair": {"first": {"variable": "hydra.core.model.Term"}, "second": {"variable": "hydra.core.model.TypeScheme"}}},
                    "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "fcx",
                "domain": {"variable": "hydra.core.typing.InferenceContext"},
                "body": {
                  "lambda": {
                    "parameter": "cx",
                    "domain": {"variable": "hydra.core.graph.Graph"},
                    "body": {
                      "lambda": {
                        "parameter": "term",
                        "domain": {"variable": "hydra.core.model.Term"},
                        "body": {
                          "let": {
                            "bindings": [
                              {
                                "name": "letTerm",
                                "term": {
                                  "inject": {
                                    "typeName": "hydra.core.model.Term",
                                    "field": {
                                      "name": "let",
                                      "term": {
                                        "record": {
                                          "typeName": "hydra.core.model.Let",
                                          "fields": [
                                            {
                                              "name": "bindings",
                                              "term": {
                                                "list": [
                                                  {
                                                    "record": {
                                                      "typeName": "hydra.core.model.Binding",
                                                      "fields": [
                                                        {
                                                          "name": "name",
                                                          "term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "ignoredVariableName"}}}}},
                                                        {"name": "term", "term": {"variable": "term"}},
                                                        {
                                                          "name": "typeScheme",
                                                          "term": {"typeApplication": {"body": {"optional": null}, "type": {"variable": "hydra.core.model.TypeScheme"}}}}]}}]}},
                                            {
                                              "name": "body",
                                              "term": {
                                                "inject": {
                                                  "typeName": "hydra.core.model.Term",
                                                  "field": {
                                                    "name": "literal",
                                                    "term": {
                                                      "inject": {"typeName": "hydra.core.model.Literal", "field": {"name": "string", "term": {"literal": {"string": "ignoredBody"}}}}}}}}}]}}}}},
                                "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.typing.InferenceResult"}}},
                                        "type": {
                                          "pair": {
                                            "first": {"pair": {"first": {"variable": "hydra.core.model.Term"}, "second": {"variable": "hydra.core.model.TypeScheme"}}},
                                            "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                    "argument": {
                                      "application": {
                                        "function": {
                                          "application": {
                                            "function": {
                                              "application": {
                                                "function": {"application": {"function": {"variable": "hydra.core.inference.inferTypeOfTerm"}, "argument": {"variable": "fcx"}}},
                                                "argument": {"variable": "cx"}}},
                                            "argument": {"variable": "letTerm"}}},
                                        "argument": {"literal": {"string": "infer type of term"}}}}}},
                                "argument": {
                                  "lambda": {
                                    "parameter": "result",
                                    "domain": {"variable": "hydra.core.typing.InferenceResult"},
                                    "body": {
                                      "let": {
                                        "bindings": [
                                          {
                                            "name": "fcx2",
                                            "term": {
                                              "application": {
                                                "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "context"}},
                                                "argument": {"variable": "result"}}},
                                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "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": "unit"}},
                                                    "type": {
                                                      "pair": {
                                                        "first": {"pair": {"first": {"variable": "hydra.core.model.Term"}, "second": {"variable": "hydra.core.model.TypeScheme"}}},
                                                        "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                "argument": {
                                                  "application": {
                                                    "function": {
                                                      "application": {
                                                        "function": {
                                                          "application": {"function": {"variable": "hydra.core.inference.dischargeClassConstraints"}, "argument": {"variable": "fcx2"}}},
                                                        "argument": {
                                                          "application": {
                                                            "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "subst"}},
                                                            "argument": {"variable": "result"}}}}},
                                                    "argument": {
                                                      "application": {
                                                        "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "classConstraints"}},
                                                        "argument": {"variable": "result"}}}}}}},
                                            "argument": {
                                              "lambda": {
                                                "parameter": "_",
                                                "domain": "unit",
                                                "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": {
                                                              "pair": {
                                                                "first": {"pair": {"first": {"variable": "hydra.core.model.Term"}, "second": {"variable": "hydra.core.model.TypeScheme"}}},
                                                                "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                        "argument": {
                                                          "application": {
                                                            "function": {
                                                              "application": {
                                                                "function": {
                                                                  "application": {
                                                                    "function": {
                                                                      "typeApplication": {
                                                                        "body": {"variable": "hydra.core.inference.finalizeInferredTerm"},
                                                                        "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                    "argument": {"variable": "fcx2"}}},
                                                                "argument": {"variable": "cx"}}},
                                                            "argument": {
                                                              "application": {
                                                                "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "term"}},
                                                                "argument": {"variable": "result"}}}}}}},
                                                    "argument": {
                                                      "lambda": {
                                                        "parameter": "finalized",
                                                        "domain": {"variable": "hydra.core.model.Term"},
                                                        "body": {
                                                          "application": {
                                                            "function": {
                                                              "application": {
                                                                "function": {
                                                                  "typeApplication": {
                                                                    "body": {
                                                                      "typeApplication": {
                                                                        "body": {
                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.eithers.bind"}, "type": {"variable": "hydra.core.errors.Error"}}},
                                                                        "type": {"variable": "hydra.core.model.Let"}}},
                                                                    "type": {
                                                                      "pair": {
                                                                        "first": {"pair": {"first": {"variable": "hydra.core.model.Term"}, "second": {"variable": "hydra.core.model.TypeScheme"}}},
                                                                        "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                "argument": {
                                                                  "application": {
                                                                    "function": {"application": {"function": {"variable": "hydra.core.extract.model.let"}, "argument": {"variable": "cx"}}},
                                                                    "argument": {"variable": "finalized"}}}}},
                                                            "argument": {
                                                              "lambda": {
                                                                "parameter": "letResult",
                                                                "domain": {"variable": "hydra.core.model.Let"},
                                                                "body": {
                                                                  "let": {
                                                                    "bindings": [
                                                                      {
                                                                        "name": "bindings",
                                                                        "term": {
                                                                          "application": {
                                                                            "function": {"project": {"typeName": "hydra.core.model.Let", "fieldName": "bindings"}},
                                                                            "argument": {"variable": "letResult"}}},
                                                                        "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Binding"}}, "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": {
                                                                                          "pair": {
                                                                                            "first": {"pair": {"first": {"variable": "hydra.core.model.Term"}, "second": {"variable": "hydra.core.model.TypeScheme"}}},
                                                                                            "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}},
                                                                                "argument": {
                                                                                  "application": {
                                                                                    "function": {
                                                                                      "application": {
                                                                                        "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.equality.equal"}, "type": {"literal": {"integer": "int32"}}}},
                                                                                        "argument": {"literal": {"integer": {"int32": 1}}}}},
                                                                                    "argument": {
                                                                                      "application": {
                                                                                        "function": {
                                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.lists.length"}, "type": {"variable": "hydra.core.model.Binding"}}},
                                                                                        "argument": {"variable": "bindings"}}}}}}},
                                                                            "argument": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "application": {
                                                                                    "function": {
                                                                                      "typeApplication": {
                                                                                        "body": {
                                                                                          "typeApplication": {
                                                                                            "body": {
                                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.eithers.bind"}, "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                            "type": {"variable": "hydra.core.model.Binding"}}},
                                                                                        "type": {
                                                                                          "pair": {
                                                                                            "first": {"pair": {"first": {"variable": "hydra.core.model.Term"}, "second": {"variable": "hydra.core.model.TypeScheme"}}},
                                                                                            "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                    "argument": {
                                                                                      "application": {
                                                                                        "function": {
                                                                                          "application": {
                                                                                            "function": {
                                                                                              "typeApplication": {"body": {"variable": "hydra.core.inference.headOrFail"}, "type": {"variable": "hydra.core.model.Binding"}}},
                                                                                            "argument": {"literal": {"string": "inferTypeOf: single binding expected"}}}},
                                                                                        "argument": {"variable": "bindings"}}}}},
                                                                                "argument": {
                                                                                  "lambda": {
                                                                                    "parameter": "binding",
                                                                                    "domain": {"variable": "hydra.core.model.Binding"},
                                                                                    "body": {
                                                                                      "let": {
                                                                                        "bindings": [
                                                                                          {
                                                                                            "name": "term1",
                                                                                            "term": {
                                                                                              "application": {
                                                                                                "function": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "term"}},
                                                                                                "argument": {"variable": "binding"}}},
                                                                                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                                                                        "body": {
                                                                                          "let": {
                                                                                            "bindings": [
                                                                                              {
                                                                                                "name": "mts",
                                                                                                "term": {
                                                                                                  "application": {
                                                                                                    "function": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "typeScheme"}},
                                                                                                    "argument": {"variable": "binding"}}},
                                                                                                "typeScheme": {"variables": [], "body": {"optional": {"variable": "hydra.core.model.TypeScheme"}}, "constraints": []}}],
                                                                                            "body": {
                                                                                              "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": {
                                                                                                                  "pair": {
                                                                                                                    "first": {"pair": {"first": {"variable": "hydra.core.model.Term"}, "second": {"variable": "hydra.core.model.TypeScheme"}}},
                                                                                                                    "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}},
                                                                                                        "argument": {"variable": "mts"}}},
                                                                                                    "argument": {
                                                                                                      "typeApplication": {
                                                                                                        "body": {
                                                                                                          "typeApplication": {
                                                                                                            "body": {
                                                                                                              "either": {
                                                                                                                "left": {
                                                                                                                  "inject": {
                                                                                                                    "typeName": "hydra.core.errors.Error",
                                                                                                                    "field": {
                                                                                                                      "name": "inference",
                                                                                                                      "term": {
                                                                                                                        "inject": {
                                                                                                                          "typeName": "hydra.core.errors.InferenceError",
                                                                                                                          "field": {
                                                                                                                            "name": "other",
                                                                                                                            "term": {
                                                                                                                              "record": {
                                                                                                                                "typeName": "hydra.core.errors.OtherInferenceError",
                                                                                                                                "fields": [
                                                                                                                                  {
                                                                                                                                    "name": "path",
                                                                                                                                    "term": {
                                                                                                                                      "wrap": {
                                                                                                                                        "typeName": "hydra.core.paths.SubtermPath",
                                                                                                                                        "body": {
                                                                                                                                          "application": {
                                                                                                                                            "function": {
                                                                                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.lists.reverse"}, "type": {"variable": "hydra.core.paths.SubtermStep"}}},
                                                                                                                                            "argument": {
                                                                                                                                              "application": {
                                                                                                                                                "function": {"project": {"typeName": "hydra.core.typing.InferenceContext", "fieldName": "trace"}},
                                                                                                                                                "argument": {"variable": "fcx2"}}}}}}}},
                                                                                                                                  {"name": "message", "term": {"literal": {"string": "Expected a type scheme"}}}]}}}}}}}}}},
                                                                                                            "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                                        "type": {
                                                                                                          "pair": {
                                                                                                            "first": {"pair": {"first": {"variable": "hydra.core.model.Term"}, "second": {"variable": "hydra.core.model.TypeScheme"}}},
                                                                                                            "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}},
                                                                                                "argument": {
                                                                                                  "lambda": {
                                                                                                    "parameter": "ts",
                                                                                                    "domain": {"variable": "hydra.core.model.TypeScheme"},
                                                                                                    "body": {
                                                                                                      "typeApplication": {
                                                                                                        "body": {
                                                                                                          "typeApplication": {
                                                                                                            "body": {
                                                                                                              "either": {
                                                                                                                "right": {
                                                                                                                  "typeApplication": {
                                                                                                                    "body": {
                                                                                                                      "typeApplication": {
                                                                                                                        "body": {
                                                                                                                          "pair": {
                                                                                                                            "first": {
                                                                                                                              "typeApplication": {
                                                                                                                                "body": {
                                                                                                                                  "typeApplication": {
                                                                                                                                    "body": {"pair": {"first": {"variable": "term1"}, "second": {"variable": "ts"}}},
                                                                                                                                    "type": {"variable": "hydra.core.model.Term"}}},
                                                                                                                                "type": {"variable": "hydra.core.model.TypeScheme"}}},
                                                                                                                            "second": {"variable": "fcx2"}}},
                                                                                                                        "type": {"pair": {"first": {"variable": "hydra.core.model.Term"}, "second": {"variable": "hydra.core.model.TypeScheme"}}}}},
                                                                                                                    "type": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                                            "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                                        "type": {
                                                                                                          "pair": {
                                                                                                            "first": {"pair": {"first": {"variable": "hydra.core.model.Term"}, "second": {"variable": "hydra.core.model.TypeScheme"}}},
                                                                                                            "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}}}}}}}}}}}}}},
                                                                        "argument": {
                                                                          "typeApplication": {
                                                                            "body": {
                                                                              "typeApplication": {
                                                                                "body": {
                                                                                  "either": {
                                                                                    "left": {
                                                                                      "inject": {
                                                                                        "typeName": "hydra.core.errors.Error",
                                                                                        "field": {
                                                                                          "name": "inference",
                                                                                          "term": {
                                                                                            "inject": {
                                                                                              "typeName": "hydra.core.errors.InferenceError",
                                                                                              "field": {
                                                                                                "name": "other",
                                                                                                "term": {
                                                                                                  "record": {
                                                                                                    "typeName": "hydra.core.errors.OtherInferenceError",
                                                                                                    "fields": [
                                                                                                      {
                                                                                                        "name": "path",
                                                                                                        "term": {
                                                                                                          "wrap": {
                                                                                                            "typeName": "hydra.core.paths.SubtermPath",
                                                                                                            "body": {
                                                                                                              "application": {
                                                                                                                "function": {
                                                                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.lists.reverse"}, "type": {"variable": "hydra.core.paths.SubtermStep"}}},
                                                                                                                "argument": {
                                                                                                                  "application": {
                                                                                                                    "function": {"project": {"typeName": "hydra.core.typing.InferenceContext", "fieldName": "trace"}},
                                                                                                                    "argument": {"variable": "fcx2"}}}}}}}},
                                                                                                      {
                                                                                                        "name": "message",
                                                                                                        "term": {
                                                                                                          "application": {
                                                                                                            "function": {"variable": "hydra.core.lib.strings.concat"},
                                                                                                            "argument": {
                                                                                                              "list": [
                                                                                                                {"literal": {"string": "Expected a single binding with a type scheme, but got: "}},
                                                                                                                {
                                                                                                                  "application": {
                                                                                                                    "function": {"variable": "hydra.core.lib.literals.printInt32"},
                                                                                                                    "argument": {
                                                                                                                      "application": {
                                                                                                                        "function": {
                                                                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.lists.length"}, "type": {"variable": "hydra.core.model.Binding"}}},
                                                                                                                        "argument": {"variable": "bindings"}}}}},
                                                                                                                {"literal": {"string": " bindings"}}]}}}}]}}}}}}}}}},
                                                                                "type": {"variable": "hydra.core.errors.Error"}}},
                                                                            "type": {
                                                                              "pair": {
                                                                                "first": {"pair": {"first": {"variable": "hydra.core.model.Term"}, "second": {"variable": "hydra.core.model.TypeScheme"}}},
                                                                                "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {"literal": {"string": "Map a possibly untyped term to a fully typed term and its type"}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.inference.inferTypeOfAnnotatedTerm",
        "signature": {
          "typeParameters": [],
          "parameters": [
            {"name": "arg0", "type": {"variable": "hydra.core.typing.InferenceContext"}, "isLazy": false},
            {"name": "arg1", "type": {"variable": "hydra.core.graph.Graph"}, "isLazy": false},
            {"name": "arg2", "type": {"variable": "hydra.core.model.AnnotatedTerm"}, "isLazy": false}],
          "result": {
            "type": {
              "either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.typing.InferenceResult"}}}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "fcx",
                "domain": {"variable": "hydra.core.typing.InferenceContext"},
                "body": {
                  "lambda": {
                    "parameter": "cx",
                    "domain": {"variable": "hydra.core.graph.Graph"},
                    "body": {
                      "lambda": {
                        "parameter": "at",
                        "domain": {"variable": "hydra.core.model.AnnotatedTerm"},
                        "body": {
                          "let": {
                            "bindings": [
                              {
                                "name": "term",
                                "term": {
                                  "application": {
                                    "function": {"project": {"typeName": "hydra.core.model.AnnotatedTerm", "fieldName": "body"}},
                                    "argument": {"variable": "at"}}},
                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                            "body": {
                              "let": {
                                "bindings": [
                                  {
                                    "name": "ann",
                                    "term": {
                                      "application": {
                                        "function": {"project": {"typeName": "hydra.core.model.AnnotatedTerm", "fieldName": "annotation"}},
                                        "argument": {"variable": "at"}}},
                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                "body": {
                                  "let": {
                                    "bindings": [
                                      {
                                        "name": "fcxBody",
                                        "term": {
                                          "application": {
                                            "function": {
                                              "application": {
                                                "function": {"variable": "hydra.core.names.pushSubtermStep"},
                                                "argument": {"inject": {"typeName": "hydra.core.paths.SubtermStep", "field": {"name": "annotatedBody", "term": "unit"}}}}},
                                            "argument": {"variable": "fcx"}}},
                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "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.InferenceResult"}}},
                                                "type": {"variable": "hydra.core.typing.InferenceResult"}}},
                                            "argument": {
                                              "application": {
                                                "function": {
                                                  "application": {
                                                    "function": {
                                                      "application": {
                                                        "function": {"application": {"function": {"variable": "hydra.core.inference.inferTypeOfTerm"}, "argument": {"variable": "fcxBody"}}},
                                                        "argument": {"variable": "cx"}}},
                                                    "argument": {"variable": "term"}}},
                                                "argument": {"literal": {"string": "annotated term"}}}}}},
                                        "argument": {
                                          "lambda": {
                                            "parameter": "result",
                                            "domain": {"variable": "hydra.core.typing.InferenceResult"},
                                            "body": {
                                              "let": {
                                                "bindings": [
                                                  {
                                                    "name": "fcx2",
                                                    "term": {
                                                      "application": {
                                                        "function": {"application": {"function": {"variable": "hydra.core.names.restoreTrace"}, "argument": {"variable": "fcx"}}},
                                                        "argument": {
                                                          "application": {
                                                            "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "context"}},
                                                            "argument": {"variable": "result"}}}}},
                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "constraints": []}}],
                                                "body": {
                                                  "let": {
                                                    "bindings": [
                                                      {
                                                        "name": "iterm",
                                                        "term": {
                                                          "application": {
                                                            "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "term"}},
                                                            "argument": {"variable": "result"}}},
                                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                                    "body": {
                                                      "let": {
                                                        "bindings": [
                                                          {
                                                            "name": "itype",
                                                            "term": {
                                                              "application": {
                                                                "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "type"}},
                                                                "argument": {"variable": "result"}}},
                                                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
                                                        "body": {
                                                          "let": {
                                                            "bindings": [
                                                              {
                                                                "name": "isubst",
                                                                "term": {
                                                                  "application": {
                                                                    "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "subst"}},
                                                                    "argument": {"variable": "result"}}},
                                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.TypeSubst"}, "constraints": []}}],
                                                            "body": {
                                                              "let": {
                                                                "bindings": [
                                                                  {
                                                                    "name": "iconstraints",
                                                                    "term": {
                                                                      "application": {
                                                                        "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "classConstraints"}},
                                                                        "argument": {"variable": "result"}}},
                                                                    "typeScheme": {
                                                                      "variables": [],
                                                                      "body": {
                                                                        "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}},
                                                                      "constraints": []}}],
                                                                "body": {
                                                                  "typeApplication": {
                                                                    "body": {
                                                                      "typeApplication": {
                                                                        "body": {
                                                                          "either": {
                                                                            "right": {
                                                                              "record": {
                                                                                "typeName": "hydra.core.typing.InferenceResult",
                                                                                "fields": [
                                                                                  {
                                                                                    "name": "term",
                                                                                    "term": {
                                                                                      "inject": {
                                                                                        "typeName": "hydra.core.model.Term",
                                                                                        "field": {
                                                                                          "name": "annotated",
                                                                                          "term": {
                                                                                            "record": {
                                                                                              "typeName": "hydra.core.model.AnnotatedTerm",
                                                                                              "fields": [{"name": "body", "term": {"variable": "iterm"}}, {"name": "annotation", "term": {"variable": "ann"}}]}}}}}},
                                                                                  {"name": "type", "term": {"variable": "itype"}},
                                                                                  {"name": "subst", "term": {"variable": "isubst"}},
                                                                                  {"name": "classConstraints", "term": {"variable": "iconstraints"}},
                                                                                  {"name": "context", "term": {"variable": "fcx2"}}]}}}},
                                                                        "type": {"variable": "hydra.core.errors.Error"}}},
                                                                    "type": {"variable": "hydra.core.typing.InferenceResult"}}}}}}}}}}}}}}}}}}}}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {"literal": {"string": "Infer the type of an annotated term (Either version). Paper: inference.tex, rule Ann."}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.inference.inferTypeOfApplication",
        "signature": {
          "typeParameters": [],
          "parameters": [
            {"name": "arg0", "type": {"variable": "hydra.core.typing.InferenceContext"}, "isLazy": false},
            {"name": "arg1", "type": {"variable": "hydra.core.graph.Graph"}, "isLazy": false},
            {"name": "arg2", "type": {"variable": "hydra.core.model.Application"}, "isLazy": false}],
          "result": {
            "type": {
              "either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.typing.InferenceResult"}}}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "fcx0",
                "domain": {"variable": "hydra.core.typing.InferenceContext"},
                "body": {
                  "lambda": {
                    "parameter": "cx",
                    "domain": {"variable": "hydra.core.graph.Graph"},
                    "body": {
                      "lambda": {
                        "parameter": "app",
                        "domain": {"variable": "hydra.core.model.Application"},
                        "body": {
                          "let": {
                            "bindings": [
                              {
                                "name": "e0",
                                "term": {
                                  "application": {
                                    "function": {"project": {"typeName": "hydra.core.model.Application", "fieldName": "function"}},
                                    "argument": {"variable": "app"}}},
                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                            "body": {
                              "let": {
                                "bindings": [
                                  {
                                    "name": "e1",
                                    "term": {
                                      "application": {
                                        "function": {"project": {"typeName": "hydra.core.model.Application", "fieldName": "argument"}},
                                        "argument": {"variable": "app"}}},
                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                "body": {
                                  "let": {
                                    "bindings": [
                                      {
                                        "name": "fcxFun",
                                        "term": {
                                          "application": {
                                            "function": {
                                              "application": {
                                                "function": {"variable": "hydra.core.names.pushSubtermStep"},
                                                "argument": {"inject": {"typeName": "hydra.core.paths.SubtermStep", "field": {"name": "applicationFunction", "term": "unit"}}}}},
                                            "argument": {"variable": "fcx0"}}},
                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "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.InferenceResult"}}},
                                                "type": {"variable": "hydra.core.typing.InferenceResult"}}},
                                            "argument": {
                                              "application": {
                                                "function": {
                                                  "application": {
                                                    "function": {
                                                      "application": {
                                                        "function": {"application": {"function": {"variable": "hydra.core.inference.inferTypeOfTerm"}, "argument": {"variable": "fcxFun"}}},
                                                        "argument": {"variable": "cx"}}},
                                                    "argument": {"variable": "e0"}}},
                                                "argument": {"literal": {"string": "lhs"}}}}}},
                                        "argument": {
                                          "lambda": {
                                            "parameter": "lhsResult",
                                            "domain": {"variable": "hydra.core.typing.InferenceResult"},
                                            "body": {
                                              "let": {
                                                "bindings": [
                                                  {
                                                    "name": "fcx2",
                                                    "term": {
                                                      "application": {
                                                        "function": {"application": {"function": {"variable": "hydra.core.names.restoreTrace"}, "argument": {"variable": "fcx0"}}},
                                                        "argument": {
                                                          "application": {
                                                            "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "context"}},
                                                            "argument": {"variable": "lhsResult"}}}}},
                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "constraints": []}}],
                                                "body": {
                                                  "let": {
                                                    "bindings": [
                                                      {
                                                        "name": "a",
                                                        "term": {
                                                          "application": {
                                                            "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "term"}},
                                                            "argument": {"variable": "lhsResult"}}},
                                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                                    "body": {
                                                      "let": {
                                                        "bindings": [
                                                          {
                                                            "name": "t0",
                                                            "term": {
                                                              "application": {
                                                                "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "type"}},
                                                                "argument": {"variable": "lhsResult"}}},
                                                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
                                                        "body": {
                                                          "let": {
                                                            "bindings": [
                                                              {
                                                                "name": "s0",
                                                                "term": {
                                                                  "application": {
                                                                    "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "subst"}},
                                                                    "argument": {"variable": "lhsResult"}}},
                                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.TypeSubst"}, "constraints": []}}],
                                                            "body": {
                                                              "let": {
                                                                "bindings": [
                                                                  {
                                                                    "name": "c0",
                                                                    "term": {
                                                                      "application": {
                                                                        "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "classConstraints"}},
                                                                        "argument": {"variable": "lhsResult"}}},
                                                                    "typeScheme": {
                                                                      "variables": [],
                                                                      "body": {
                                                                        "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}},
                                                                      "constraints": []}}],
                                                                "body": {
                                                                  "let": {
                                                                    "bindings": [
                                                                      {
                                                                        "name": "fcxArg",
                                                                        "term": {
                                                                          "application": {
                                                                            "function": {
                                                                              "application": {
                                                                                "function": {"variable": "hydra.core.names.pushSubtermStep"},
                                                                                "argument": {"inject": {"typeName": "hydra.core.paths.SubtermStep", "field": {"name": "applicationArgument", "term": "unit"}}}}},
                                                                            "argument": {"variable": "fcx2"}}},
                                                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "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.InferenceResult"}}},
                                                                                "type": {"variable": "hydra.core.typing.InferenceResult"}}},
                                                                            "argument": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "application": {
                                                                                    "function": {
                                                                                      "application": {
                                                                                        "function": {"application": {"function": {"variable": "hydra.core.inference.inferTypeOfTerm"}, "argument": {"variable": "fcxArg"}}},
                                                                                        "argument": {
                                                                                          "application": {
                                                                                            "function": {"application": {"function": {"variable": "hydra.core.substitution.substInContext"}, "argument": {"variable": "s0"}}},
                                                                                            "argument": {"variable": "cx"}}}}},
                                                                                    "argument": {"variable": "e1"}}},
                                                                                "argument": {"literal": {"string": "rhs"}}}}}},
                                                                        "argument": {
                                                                          "lambda": {
                                                                            "parameter": "rhsResult",
                                                                            "domain": {"variable": "hydra.core.typing.InferenceResult"},
                                                                            "body": {
                                                                              "let": {
                                                                                "bindings": [
                                                                                  {
                                                                                    "name": "fcx3",
                                                                                    "term": {
                                                                                      "application": {
                                                                                        "function": {"application": {"function": {"variable": "hydra.core.names.restoreTrace"}, "argument": {"variable": "fcx0"}}},
                                                                                        "argument": {
                                                                                          "application": {
                                                                                            "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "context"}},
                                                                                            "argument": {"variable": "rhsResult"}}}}},
                                                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "constraints": []}}],
                                                                                "body": {
                                                                                  "let": {
                                                                                    "bindings": [
                                                                                      {
                                                                                        "name": "b",
                                                                                        "term": {
                                                                                          "application": {
                                                                                            "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "term"}},
                                                                                            "argument": {"variable": "rhsResult"}}},
                                                                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                                                                    "body": {
                                                                                      "let": {
                                                                                        "bindings": [
                                                                                          {
                                                                                            "name": "t1",
                                                                                            "term": {
                                                                                              "application": {
                                                                                                "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "type"}},
                                                                                                "argument": {"variable": "rhsResult"}}},
                                                                                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
                                                                                        "body": {
                                                                                          "let": {
                                                                                            "bindings": [
                                                                                              {
                                                                                                "name": "s1",
                                                                                                "term": {
                                                                                                  "application": {
                                                                                                    "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "subst"}},
                                                                                                    "argument": {"variable": "rhsResult"}}},
                                                                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.TypeSubst"}, "constraints": []}}],
                                                                                            "body": {
                                                                                              "let": {
                                                                                                "bindings": [
                                                                                                  {
                                                                                                    "name": "c1",
                                                                                                    "term": {
                                                                                                      "application": {
                                                                                                        "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "classConstraints"}},
                                                                                                        "argument": {"variable": "rhsResult"}}},
                                                                                                    "typeScheme": {
                                                                                                      "variables": [],
                                                                                                      "body": {
                                                                                                        "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}},
                                                                                                      "constraints": []}}],
                                                                                                "body": {
                                                                                                  "let": {
                                                                                                    "bindings": [
                                                                                                      {
                                                                                                        "name": "vResult",
                                                                                                        "term": {"application": {"function": {"variable": "hydra.core.names.freshName"}, "argument": {"variable": "fcx3"}}},
                                                                                                        "typeScheme": {
                                                                                                          "variables": [],
                                                                                                          "body": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                                          "constraints": []}}],
                                                                                                    "body": {
                                                                                                      "let": {
                                                                                                        "bindings": [
                                                                                                          {
                                                                                                            "name": "v",
                                                                                                            "term": {
                                                                                                              "application": {
                                                                                                                "function": {
                                                                                                                  "typeApplication": {
                                                                                                                    "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                                    "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                                                "argument": {"variable": "vResult"}}},
                                                                                                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Name"}, "constraints": []}}],
                                                                                                        "body": {
                                                                                                          "let": {
                                                                                                            "bindings": [
                                                                                                              {
                                                                                                                "name": "fcx4",
                                                                                                                "term": {
                                                                                                                  "application": {
                                                                                                                    "function": {
                                                                                                                      "typeApplication": {
                                                                                                                        "body": {
                                                                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                                        "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                                                    "argument": {"variable": "vResult"}}},
                                                                                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "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.TypeSubst"}}},
                                                                                                                        "type": {"variable": "hydra.core.typing.InferenceResult"}}},
                                                                                                                    "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.UnificationError"}}},
                                                                                                                                            "type": {"variable": "hydra.core.typing.TypeSubst"}}},
                                                                                                                                        "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                                                                    "type": {"variable": "hydra.core.typing.TypeSubst"}}},
                                                                                                                                "argument": {
                                                                                                                                  "lambda": {
                                                                                                                                    "parameter": "_e",
                                                                                                                                    "domain": {"variable": "hydra.core.errors.UnificationError"},
                                                                                                                                    "body": {
                                                                                                                                      "inject": {
                                                                                                                                        "typeName": "hydra.core.errors.Error",
                                                                                                                                        "field": {
                                                                                                                                          "name": "inference",
                                                                                                                                          "term": {
                                                                                                                                            "inject": {
                                                                                                                                              "typeName": "hydra.core.errors.InferenceError",
                                                                                                                                              "field": {
                                                                                                                                                "name": "unification",
                                                                                                                                                "term": {
                                                                                                                                                  "record": {
                                                                                                                                                    "typeName": "hydra.core.errors.UnificationInferenceError",
                                                                                                                                                    "fields": [
                                                                                                                                                      {
                                                                                                                                                        "name": "path",
                                                                                                                                                        "term": {
                                                                                                                                                          "wrap": {
                                                                                                                                                            "typeName": "hydra.core.paths.SubtermPath",
                                                                                                                                                            "body": {
                                                                                                                                                              "application": {
                                                                                                                                                                "function": {
                                                                                                                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.lists.reverse"}, "type": {"variable": "hydra.core.paths.SubtermStep"}}},
                                                                                                                                                                "argument": {
                                                                                                                                                                  "application": {
                                                                                                                                                                    "function": {"project": {"typeName": "hydra.core.typing.InferenceContext", "fieldName": "trace"}},
                                                                                                                                                                    "argument": {"variable": "fcx4"}}}}}}}},
                                                                                                                                                      {"name": "cause", "term": {"variable": "_e"}}]}}}}}}}}}}}},
                                                                                                                            "argument": {"lambda": {"parameter": "_a", "domain": {"variable": "hydra.core.typing.TypeSubst"}, "body": {"variable": "_a"}}}}},
                                                                                                                        "argument": {
                                                                                                                          "application": {
                                                                                                                            "function": {
                                                                                                                              "application": {
                                                                                                                                "function": {
                                                                                                                                  "application": {
                                                                                                                                    "function": {
                                                                                                                                      "application": {
                                                                                                                                        "function": {
                                                                                                                                          "application": {
                                                                                                                                            "function": {
                                                                                                                                              "typeApplication": {"body": {"variable": "hydra.core.unification.unifyTypes"}, "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                                                                            "argument": {"variable": "fcx4"}}},
                                                                                                                                        "argument": {
                                                                                                                                          "application": {
                                                                                                                                            "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "schemaTypes"}},
                                                                                                                                            "argument": {"variable": "cx"}}}}},
                                                                                                                                    "argument": {
                                                                                                                                      "application": {
                                                                                                                                        "function": {"application": {"function": {"variable": "hydra.core.substitution.substInType"}, "argument": {"variable": "s1"}}},
                                                                                                                                        "argument": {"variable": "t0"}}}}},
                                                                                                                                "argument": {
                                                                                                                                  "inject": {
                                                                                                                                    "typeName": "hydra.core.model.Type",
                                                                                                                                    "field": {
                                                                                                                                      "name": "function",
                                                                                                                                      "term": {
                                                                                                                                        "record": {
                                                                                                                                          "typeName": "hydra.core.model.FunctionType",
                                                                                                                                          "fields": [
                                                                                                                                            {"name": "domain", "term": {"variable": "t1"}},
                                                                                                                                            {
                                                                                                                                              "name": "codomain",
                                                                                                                                              "term": {"inject": {"typeName": "hydra.core.model.Type", "field": {"name": "variable", "term": {"variable": "v"}}}}}]}}}}}}},
                                                                                                                            "argument": {"literal": {"string": "application lhs"}}}}}}}},
                                                                                                                "argument": {
                                                                                                                  "lambda": {
                                                                                                                    "parameter": "s2",
                                                                                                                    "domain": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                                    "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.TypeSubst"}}},
                                                                                                                                "type": {"variable": "hydra.core.typing.InferenceResult"}}},
                                                                                                                            "argument": {
                                                                                                                              "application": {
                                                                                                                                "function": {
                                                                                                                                  "application": {
                                                                                                                                    "function": {
                                                                                                                                      "application": {
                                                                                                                                        "function": {
                                                                                                                                          "typeApplication": {"body": {"variable": "hydra.core.checking.checkTypeSubst"}, "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                                                                        "argument": {"variable": "fcx4"}}},
                                                                                                                                    "argument": {"variable": "cx"}}},
                                                                                                                                "argument": {"variable": "s2"}}}}},
                                                                                                                        "argument": {
                                                                                                                          "lambda": {
                                                                                                                            "parameter": "_",
                                                                                                                            "domain": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                                            "body": {
                                                                                                                              "let": {
                                                                                                                                "bindings": [
                                                                                                                                  {
                                                                                                                                    "name": "rExpr",
                                                                                                                                    "term": {
                                                                                                                                      "inject": {
                                                                                                                                        "typeName": "hydra.core.model.Term",
                                                                                                                                        "field": {
                                                                                                                                          "name": "application",
                                                                                                                                          "term": {
                                                                                                                                            "record": {
                                                                                                                                              "typeName": "hydra.core.model.Application",
                                                                                                                                              "fields": [
                                                                                                                                                {
                                                                                                                                                  "name": "function",
                                                                                                                                                  "term": {
                                                                                                                                                    "application": {
                                                                                                                                                      "function": {
                                                                                                                                                        "application": {
                                                                                                                                                          "function": {"variable": "hydra.core.substitution.substTypesInTerm"},
                                                                                                                                                          "argument": {
                                                                                                                                                            "application": {
                                                                                                                                                              "function": {"application": {"function": {"variable": "hydra.core.substitution.composeTypeSubst"}, "argument": {"variable": "s1"}}},
                                                                                                                                                              "argument": {"variable": "s2"}}}}},
                                                                                                                                                      "argument": {"variable": "a"}}}},
                                                                                                                                                {
                                                                                                                                                  "name": "argument",
                                                                                                                                                  "term": {
                                                                                                                                                    "application": {
                                                                                                                                                      "function": {"application": {"function": {"variable": "hydra.core.substitution.substTypesInTerm"}, "argument": {"variable": "s2"}}},
                                                                                                                                                      "argument": {"variable": "b"}}}}]}}}}},
                                                                                                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                                                                                                                "body": {
                                                                                                                                  "let": {
                                                                                                                                    "bindings": [
                                                                                                                                      {
                                                                                                                                        "name": "rType",
                                                                                                                                        "term": {
                                                                                                                                          "application": {
                                                                                                                                            "function": {"application": {"function": {"variable": "hydra.core.substitution.substInType"}, "argument": {"variable": "s2"}}},
                                                                                                                                            "argument": {"inject": {"typeName": "hydra.core.model.Type", "field": {"name": "variable", "term": {"variable": "v"}}}}}},
                                                                                                                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
                                                                                                                                    "body": {
                                                                                                                                      "let": {
                                                                                                                                        "bindings": [
                                                                                                                                          {
                                                                                                                                            "name": "rSubst",
                                                                                                                                            "term": {
                                                                                                                                              "application": {
                                                                                                                                                "function": {"variable": "hydra.core.substitution.composeTypeSubstList"},
                                                                                                                                                "argument": {"list": [{"variable": "s0"}, {"variable": "s1"}, {"variable": "s2"}]}}},
                                                                                                                                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.TypeSubst"}, "constraints": []}}],
                                                                                                                                        "body": {
                                                                                                                                          "let": {
                                                                                                                                            "bindings": [
                                                                                                                                              {
                                                                                                                                                "name": "c0Subst",
                                                                                                                                                "term": {
                                                                                                                                                  "application": {
                                                                                                                                                    "function": {
                                                                                                                                                      "application": {"function": {"variable": "hydra.core.substitution.substInClassConstraints"}, "argument": {"variable": "s2"}}},
                                                                                                                                                    "argument": {
                                                                                                                                                      "application": {
                                                                                                                                                        "function": {
                                                                                                                                                          "application": {"function": {"variable": "hydra.core.substitution.substInClassConstraints"}, "argument": {"variable": "s1"}}},
                                                                                                                                                        "argument": {"variable": "c0"}}}}},
                                                                                                                                                "typeScheme": {
                                                                                                                                                  "variables": [],
                                                                                                                                                  "body": {
                                                                                                                                                    "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}},
                                                                                                                                                  "constraints": []}}],
                                                                                                                                            "body": {
                                                                                                                                              "let": {
                                                                                                                                                "bindings": [
                                                                                                                                                  {
                                                                                                                                                    "name": "c1Subst",
                                                                                                                                                    "term": {
                                                                                                                                                      "application": {
                                                                                                                                                        "function": {
                                                                                                                                                          "application": {"function": {"variable": "hydra.core.substitution.substInClassConstraints"}, "argument": {"variable": "s2"}}},
                                                                                                                                                        "argument": {"variable": "c1"}}},
                                                                                                                                                    "typeScheme": {
                                                                                                                                                      "variables": [],
                                                                                                                                                      "body": {
                                                                                                                                                        "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}},
                                                                                                                                                      "constraints": []}}],
                                                                                                                                                "body": {
                                                                                                                                                  "let": {
                                                                                                                                                    "bindings": [
                                                                                                                                                      {
                                                                                                                                                        "name": "rConstraints",
                                                                                                                                                        "term": {
                                                                                                                                                          "application": {
                                                                                                                                                            "function": {
                                                                                                                                                              "application": {
                                                                                                                                                                "function": {
                                                                                                                                                                  "typeApplication": {"body": {"variable": "hydra.core.inference.mergeClassConstraints"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                                                                                "argument": {"variable": "c0Subst"}}},
                                                                                                                                                            "argument": {"variable": "c1Subst"}}},
                                                                                                                                                        "typeScheme": {
                                                                                                                                                          "variables": [],
                                                                                                                                                          "body": {
                                                                                                                                                            "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}},
                                                                                                                                                          "constraints": []}}],
                                                                                                                                                    "body": {
                                                                                                                                                      "typeApplication": {
                                                                                                                                                        "body": {
                                                                                                                                                          "typeApplication": {
                                                                                                                                                            "body": {
                                                                                                                                                              "either": {
                                                                                                                                                                "right": {
                                                                                                                                                                  "record": {
                                                                                                                                                                    "typeName": "hydra.core.typing.InferenceResult",
                                                                                                                                                                    "fields": [
                                                                                                                                                                      {"name": "term", "term": {"variable": "rExpr"}},
                                                                                                                                                                      {"name": "type", "term": {"variable": "rType"}},
                                                                                                                                                                      {"name": "subst", "term": {"variable": "rSubst"}},
                                                                                                                                                                      {"name": "classConstraints", "term": {"variable": "rConstraints"}},
                                                                                                                                                                      {"name": "context", "term": {"variable": "fcx4"}}]}}}},
                                                                                                                                                            "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                                                                                        "type": {"variable": "hydra.core.typing.InferenceResult"}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {
                    "literal": {
                      "string": "Infer the type of a function application (Either version). Paper: inference.tex, rule App (elaboration form)."}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.inference.inferTypeOfCaseStatement",
        "signature": {
          "typeParameters": [],
          "parameters": [
            {"name": "arg0", "type": {"variable": "hydra.core.typing.InferenceContext"}, "isLazy": false},
            {"name": "arg1", "type": {"variable": "hydra.core.graph.Graph"}, "isLazy": false},
            {"name": "arg2", "type": {"variable": "hydra.core.model.CaseStatement"}, "isLazy": false}],
          "result": {
            "type": {
              "either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.typing.InferenceResult"}}}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "fcx",
                "domain": {"variable": "hydra.core.typing.InferenceContext"},
                "body": {
                  "lambda": {
                    "parameter": "cx",
                    "domain": {"variable": "hydra.core.graph.Graph"},
                    "body": {
                      "lambda": {
                        "parameter": "caseStmt",
                        "domain": {"variable": "hydra.core.model.CaseStatement"},
                        "body": {
                          "let": {
                            "bindings": [
                              {
                                "name": "tname",
                                "term": {
                                  "application": {
                                    "function": {"project": {"typeName": "hydra.core.model.CaseStatement", "fieldName": "typeName"}},
                                    "argument": {"variable": "caseStmt"}}},
                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Name"}, "constraints": []}}],
                            "body": {
                              "let": {
                                "bindings": [
                                  {
                                    "name": "dflt",
                                    "term": {
                                      "application": {
                                        "function": {"project": {"typeName": "hydra.core.model.CaseStatement", "fieldName": "default"}},
                                        "argument": {"variable": "caseStmt"}}},
                                    "typeScheme": {"variables": [], "body": {"optional": {"variable": "hydra.core.model.Term"}}, "constraints": []}}],
                                "body": {
                                  "let": {
                                    "bindings": [
                                      {
                                        "name": "match",
                                        "term": {
                                          "application": {
                                            "function": {"project": {"typeName": "hydra.core.model.CaseStatement", "fieldName": "cases"}},
                                            "argument": {"variable": "caseStmt"}}},
                                        "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.CaseAlternative"}}, "constraints": []}}],
                                    "body": {
                                      "let": {
                                        "bindings": [
                                          {
                                            "name": "fnames",
                                            "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.Name"}}},
                                                    "argument": {"project": {"typeName": "hydra.core.model.CaseAlternative", "fieldName": "name"}}}},
                                                "argument": {"variable": "match"}}},
                                            "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Name"}}, "constraints": []}}],
                                        "body": {
                                          "application": {
                                            "function": {
                                              "application": {
                                                "function": {
                                                  "typeApplication": {
                                                    "body": {
                                                      "typeApplication": {
                                                        "body": {
                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.eithers.bind"}, "type": {"variable": "hydra.core.errors.Error"}}},
                                                        "type": {
                                                          "pair": {"first": {"variable": "hydra.core.model.TypeScheme"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                    "type": {"variable": "hydra.core.typing.InferenceResult"}}},
                                                "argument": {
                                                  "application": {
                                                    "function": {
                                                      "application": {
                                                        "function": {"application": {"function": {"variable": "hydra.core.resolution.requireSchemaType"}, "argument": {"variable": "fcx"}}},
                                                        "argument": {
                                                          "application": {
                                                            "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "schemaTypes"}},
                                                            "argument": {"variable": "cx"}}}}},
                                                    "argument": {"variable": "tname"}}}}},
                                            "argument": {
                                              "lambda": {
                                                "parameter": "stRp",
                                                "domain": {
                                                  "pair": {"first": {"variable": "hydra.core.model.TypeScheme"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                "body": {
                                                  "let": {
                                                    "bindings": [
                                                      {
                                                        "name": "schemaType",
                                                        "term": {
                                                          "application": {
                                                            "function": {
                                                              "typeApplication": {
                                                                "body": {
                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"variable": "hydra.core.model.TypeScheme"}}},
                                                                "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                            "argument": {"variable": "stRp"}}},
                                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.TypeScheme"}, "constraints": []}}],
                                                    "body": {
                                                      "let": {
                                                        "bindings": [
                                                          {
                                                            "name": "fcx2",
                                                            "term": {
                                                              "application": {
                                                                "function": {
                                                                  "typeApplication": {
                                                                    "body": {
                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"variable": "hydra.core.model.TypeScheme"}}},
                                                                    "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                "argument": {"variable": "stRp"}}},
                                                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "constraints": []}}],
                                                        "body": {
                                                          "let": {
                                                            "bindings": [
                                                              {
                                                                "name": "svars",
                                                                "term": {
                                                                  "application": {
                                                                    "function": {"project": {"typeName": "hydra.core.model.TypeScheme", "fieldName": "variables"}},
                                                                    "argument": {"variable": "schemaType"}}},
                                                                "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Name"}}, "constraints": []}}],
                                                            "body": {
                                                              "let": {
                                                                "bindings": [
                                                                  {
                                                                    "name": "stype",
                                                                    "term": {
                                                                      "application": {
                                                                        "function": {"project": {"typeName": "hydra.core.model.TypeScheme", "fieldName": "body"}},
                                                                        "argument": {"variable": "schemaType"}}},
                                                                    "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": {"list": {"variable": "hydra.core.model.FieldType"}}}},
                                                                            "type": {"variable": "hydra.core.typing.InferenceResult"}}},
                                                                        "argument": {
                                                                          "application": {
                                                                            "function": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "typeApplication": {"body": {"variable": "hydra.core.extract.model.unionType"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                "argument": {"variable": "tname"}}},
                                                                            "argument": {"variable": "stype"}}}}},
                                                                    "argument": {
                                                                      "lambda": {
                                                                        "parameter": "sfields",
                                                                        "domain": {"list": {"variable": "hydra.core.model.FieldType"}},
                                                                        "body": {
                                                                          "let": {
                                                                            "bindings": [
                                                                              {
                                                                                "name": "fcxDflt",
                                                                                "term": {
                                                                                  "application": {
                                                                                    "function": {
                                                                                      "application": {
                                                                                        "function": {"variable": "hydra.core.names.pushSubtermStep"},
                                                                                        "argument": {"inject": {"typeName": "hydra.core.paths.SubtermStep", "field": {"name": "casesDefault", "term": "unit"}}}}},
                                                                                    "argument": {"variable": "fcx2"}}},
                                                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "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": {"optional": {"variable": "hydra.core.typing.InferenceResult"}}}},
                                                                                        "type": {"variable": "hydra.core.typing.InferenceResult"}}},
                                                                                    "argument": {
                                                                                      "application": {
                                                                                        "function": {
                                                                                          "application": {
                                                                                            "function": {
                                                                                              "typeApplication": {
                                                                                                "body": {
                                                                                                  "typeApplication": {
                                                                                                    "body": {
                                                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.eithers.mapOptional"}, "type": {"variable": "hydra.core.model.Term"}}},
                                                                                                    "type": {"variable": "hydra.core.typing.InferenceResult"}}},
                                                                                                "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                            "argument": {
                                                                                              "lambda": {
                                                                                                "parameter": "t",
                                                                                                "domain": {"variable": "hydra.core.model.Term"},
                                                                                                "body": {
                                                                                                  "application": {
                                                                                                    "function": {
                                                                                                      "application": {
                                                                                                        "function": {
                                                                                                          "application": {
                                                                                                            "function": {"application": {"function": {"variable": "hydra.core.inference.inferTypeOfTerm"}, "argument": {"variable": "fcxDflt"}}},
                                                                                                            "argument": {"variable": "cx"}}},
                                                                                                        "argument": {"variable": "t"}}},
                                                                                                    "argument": {
                                                                                                      "application": {
                                                                                                        "function": {"variable": "hydra.core.lib.strings.concat"},
                                                                                                        "argument": {
                                                                                                          "list": [
                                                                                                            {"literal": {"string": "case "}},
                                                                                                            {"application": {"function": {"unwrap": "hydra.core.model.Name"}, "argument": {"variable": "tname"}}},
                                                                                                            {"literal": {"string": ".<default>"}}]}}}}}}}}},
                                                                                        "argument": {"variable": "dflt"}}}}},
                                                                                "argument": {
                                                                                  "lambda": {
                                                                                    "parameter": "dfltRp",
                                                                                    "domain": {"optional": {"variable": "hydra.core.typing.InferenceResult"}},
                                                                                    "body": {
                                                                                      "let": {
                                                                                        "bindings": [
                                                                                          {
                                                                                            "name": "dfltResult",
                                                                                            "term": {"variable": "dfltRp"},
                                                                                            "typeScheme": {"variables": [], "body": {"optional": {"variable": "hydra.core.typing.InferenceResult"}}, "constraints": []}}],
                                                                                        "body": {
                                                                                          "let": {
                                                                                            "bindings": [
                                                                                              {
                                                                                                "name": "fcx3",
                                                                                                "term": {
                                                                                                  "application": {
                                                                                                    "function": {
                                                                                                      "application": {
                                                                                                        "function": {
                                                                                                          "typeApplication": {
                                                                                                            "body": {"variable": "hydra.core.lib.optionals.withDefault"},
                                                                                                            "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                                        "argument": {"variable": "fcx2"}}},
                                                                                                    "argument": {
                                                                                                      "application": {
                                                                                                        "function": {
                                                                                                          "application": {
                                                                                                            "function": {
                                                                                                              "typeApplication": {
                                                                                                                "body": {
                                                                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.optionals.map"}, "type": {"variable": "hydra.core.typing.InferenceResult"}}},
                                                                                                                "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                                            "argument": {
                                                                                                              "lambda": {
                                                                                                                "parameter": "_r",
                                                                                                                "domain": {"variable": "hydra.core.typing.InferenceResult"},
                                                                                                                "body": {
                                                                                                                  "application": {
                                                                                                                    "function": {"application": {"function": {"variable": "hydra.core.names.restoreTrace"}, "argument": {"variable": "fcx2"}}},
                                                                                                                    "argument": {
                                                                                                                      "application": {
                                                                                                                        "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "context"}},
                                                                                                                        "argument": {"variable": "_r"}}}}}}}}},
                                                                                                        "argument": {"variable": "dfltRp"}}}}},
                                                                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "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": {
                                                                                                              "pair": {
                                                                                                                "first": {
                                                                                                                  "pair": {
                                                                                                                    "first": {"list": {"variable": "hydra.core.model.Term"}},
                                                                                                                    "second": {
                                                                                                                      "pair": {
                                                                                                                        "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                                                        "second": {
                                                                                                                          "pair": {
                                                                                                                            "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                                            "second": {
                                                                                                                              "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}},
                                                                                                                "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                                        "type": {"variable": "hydra.core.typing.InferenceResult"}}},
                                                                                                    "argument": {
                                                                                                      "application": {
                                                                                                        "function": {
                                                                                                          "application": {
                                                                                                            "function": {"application": {"function": {"variable": "hydra.core.inference.inferMany"}, "argument": {"variable": "fcx3"}}},
                                                                                                            "argument": {"variable": "cx"}}},
                                                                                                        "argument": {
                                                                                                          "application": {
                                                                                                            "function": {
                                                                                                              "application": {
                                                                                                                "function": {
                                                                                                                  "typeApplication": {
                                                                                                                    "body": {
                                                                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.model.CaseAlternative"}}},
                                                                                                                    "type": {"pair": {"first": {"variable": "hydra.core.model.Term"}, "second": {"literal": "string"}}}}},
                                                                                                                "argument": {
                                                                                                                  "lambda": {
                                                                                                                    "parameter": "f",
                                                                                                                    "domain": {"variable": "hydra.core.model.CaseAlternative"},
                                                                                                                    "body": {
                                                                                                                      "typeApplication": {
                                                                                                                        "body": {
                                                                                                                          "typeApplication": {
                                                                                                                            "body": {
                                                                                                                              "pair": {
                                                                                                                                "first": {
                                                                                                                                  "application": {
                                                                                                                                    "function": {"project": {"typeName": "hydra.core.model.CaseAlternative", "fieldName": "handler"}},
                                                                                                                                    "argument": {"variable": "f"}}},
                                                                                                                                "second": {
                                                                                                                                  "application": {
                                                                                                                                    "function": {"variable": "hydra.core.lib.strings.concat"},
                                                                                                                                    "argument": {
                                                                                                                                      "list": [
                                                                                                                                        {"literal": {"string": "case "}},
                                                                                                                                        {"application": {"function": {"unwrap": "hydra.core.model.Name"}, "argument": {"variable": "tname"}}},
                                                                                                                                        {"literal": {"string": "."}},
                                                                                                                                        {
                                                                                                                                          "application": {
                                                                                                                                            "function": {"unwrap": "hydra.core.model.Name"},
                                                                                                                                            "argument": {
                                                                                                                                              "application": {
                                                                                                                                                "function": {"project": {"typeName": "hydra.core.model.CaseAlternative", "fieldName": "name"}},
                                                                                                                                                "argument": {"variable": "f"}}}}}]}}}}},
                                                                                                                            "type": {"variable": "hydra.core.model.Term"}}},
                                                                                                                        "type": {"literal": "string"}}}}}}},
                                                                                                            "argument": {"variable": "match"}}}}}}},
                                                                                                "argument": {
                                                                                                  "lambda": {
                                                                                                    "parameter": "caseRp",
                                                                                                    "domain": {
                                                                                                      "pair": {
                                                                                                        "first": {
                                                                                                          "pair": {
                                                                                                            "first": {"list": {"variable": "hydra.core.model.Term"}},
                                                                                                            "second": {
                                                                                                              "pair": {
                                                                                                                "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                                                "second": {
                                                                                                                  "pair": {
                                                                                                                    "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                                    "second": {
                                                                                                                      "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}},
                                                                                                        "second": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                                    "body": {
                                                                                                      "let": {
                                                                                                        "bindings": [
                                                                                                          {
                                                                                                            "name": "caseResults",
                                                                                                            "term": {
                                                                                                              "application": {
                                                                                                                "function": {
                                                                                                                  "typeApplication": {
                                                                                                                    "body": {
                                                                                                                      "typeApplication": {
                                                                                                                        "body": {"variable": "hydra.core.lib.pairs.first"},
                                                                                                                        "type": {
                                                                                                                          "pair": {
                                                                                                                            "first": {"list": {"variable": "hydra.core.model.Term"}},
                                                                                                                            "second": {
                                                                                                                              "pair": {
                                                                                                                                "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                                                                "second": {
                                                                                                                                  "pair": {
                                                                                                                                    "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                                                    "second": {
                                                                                                                                      "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}}}},
                                                                                                                    "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                                                "argument": {"variable": "caseRp"}}},
                                                                                                            "typeScheme": {
                                                                                                              "variables": [],
                                                                                                              "body": {
                                                                                                                "pair": {
                                                                                                                  "first": {"list": {"variable": "hydra.core.model.Term"}},
                                                                                                                  "second": {
                                                                                                                    "pair": {
                                                                                                                      "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                                                      "second": {
                                                                                                                        "pair": {
                                                                                                                          "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                                          "second": {
                                                                                                                            "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}},
                                                                                                              "constraints": []}}],
                                                                                                        "body": {
                                                                                                          "let": {
                                                                                                            "bindings": [
                                                                                                              {
                                                                                                                "name": "fcx4",
                                                                                                                "term": {
                                                                                                                  "application": {
                                                                                                                    "function": {
                                                                                                                      "typeApplication": {
                                                                                                                        "body": {
                                                                                                                          "typeApplication": {
                                                                                                                            "body": {"variable": "hydra.core.lib.pairs.second"},
                                                                                                                            "type": {
                                                                                                                              "pair": {
                                                                                                                                "first": {"list": {"variable": "hydra.core.model.Term"}},
                                                                                                                                "second": {
                                                                                                                                  "pair": {
                                                                                                                                    "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                                                                    "second": {
                                                                                                                                      "pair": {
                                                                                                                                        "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                                                        "second": {
                                                                                                                                          "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}}}},
                                                                                                                        "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                                                    "argument": {"variable": "caseRp"}}},
                                                                                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "constraints": []}}],
                                                                                                            "body": {
                                                                                                              "let": {
                                                                                                                "bindings": [
                                                                                                                  {
                                                                                                                    "name": "iterms",
                                                                                                                    "term": {
                                                                                                                      "application": {
                                                                                                                        "function": {
                                                                                                                          "typeApplication": {
                                                                                                                            "body": {
                                                                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"list": {"variable": "hydra.core.model.Term"}}}},
                                                                                                                            "type": {
                                                                                                                              "pair": {
                                                                                                                                "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                                                                "second": {
                                                                                                                                  "pair": {
                                                                                                                                    "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                                                    "second": {
                                                                                                                                      "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}},
                                                                                                                        "argument": {"variable": "caseResults"}}},
                                                                                                                    "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Term"}}, "constraints": []}}],
                                                                                                                "body": {
                                                                                                                  "let": {
                                                                                                                    "bindings": [
                                                                                                                      {
                                                                                                                        "name": "itypes",
                                                                                                                        "term": {
                                                                                                                          "application": {
                                                                                                                            "function": {
                                                                                                                              "typeApplication": {
                                                                                                                                "body": {
                                                                                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                                                                                                "type": {
                                                                                                                                  "pair": {
                                                                                                                                    "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                                                    "second": {
                                                                                                                                      "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}},
                                                                                                                            "argument": {
                                                                                                                              "application": {
                                                                                                                                "function": {
                                                                                                                                  "typeApplication": {
                                                                                                                                    "body": {
                                                                                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"list": {"variable": "hydra.core.model.Term"}}}},
                                                                                                                                    "type": {
                                                                                                                                      "pair": {
                                                                                                                                        "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                                                                        "second": {
                                                                                                                                          "pair": {
                                                                                                                                            "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                                                            "second": {
                                                                                                                                              "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}},
                                                                                                                                "argument": {"variable": "caseResults"}}}}},
                                                                                                                        "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Type"}}, "constraints": []}}],
                                                                                                                    "body": {
                                                                                                                      "let": {
                                                                                                                        "bindings": [
                                                                                                                          {
                                                                                                                            "name": "isubst",
                                                                                                                            "term": {
                                                                                                                              "application": {
                                                                                                                                "function": {
                                                                                                                                  "typeApplication": {
                                                                                                                                    "body": {
                                                                                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"variable": "hydra.core.typing.TypeSubst"}}},
                                                                                                                                    "type": {
                                                                                                                                      "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}},
                                                                                                                                "argument": {
                                                                                                                                  "application": {
                                                                                                                                    "function": {
                                                                                                                                      "typeApplication": {
                                                                                                                                        "body": {
                                                                                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                                                                                                        "type": {
                                                                                                                                          "pair": {
                                                                                                                                            "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                                                            "second": {
                                                                                                                                              "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}},
                                                                                                                                    "argument": {
                                                                                                                                      "application": {
                                                                                                                                        "function": {
                                                                                                                                          "typeApplication": {
                                                                                                                                            "body": {
                                                                                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"list": {"variable": "hydra.core.model.Term"}}}},
                                                                                                                                            "type": {
                                                                                                                                              "pair": {
                                                                                                                                                "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                                                                                "second": {
                                                                                                                                                  "pair": {
                                                                                                                                                    "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                                                                    "second": {
                                                                                                                                                      "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}},
                                                                                                                                        "argument": {"variable": "caseResults"}}}}}}},
                                                                                                                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.TypeSubst"}, "constraints": []}}],
                                                                                                                        "body": {
                                                                                                                          "let": {
                                                                                                                            "bindings": [
                                                                                                                              {
                                                                                                                                "name": "caseElemConstraints",
                                                                                                                                "term": {
                                                                                                                                  "application": {
                                                                                                                                    "function": {
                                                                                                                                      "typeApplication": {
                                                                                                                                        "body": {
                                                                                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"variable": "hydra.core.typing.TypeSubst"}}},
                                                                                                                                        "type": {
                                                                                                                                          "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}},
                                                                                                                                    "argument": {
                                                                                                                                      "application": {
                                                                                                                                        "function": {
                                                                                                                                          "typeApplication": {
                                                                                                                                            "body": {
                                                                                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                                                                                                            "type": {
                                                                                                                                              "pair": {
                                                                                                                                                "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                                                                "second": {
                                                                                                                                                  "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}},
                                                                                                                                        "argument": {
                                                                                                                                          "application": {
                                                                                                                                            "function": {
                                                                                                                                              "typeApplication": {
                                                                                                                                                "body": {
                                                                                                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"list": {"variable": "hydra.core.model.Term"}}}},
                                                                                                                                                "type": {
                                                                                                                                                  "pair": {
                                                                                                                                                    "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                                                                                    "second": {
                                                                                                                                                      "pair": {
                                                                                                                                                        "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                                                                        "second": {
                                                                                                                                                          "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}},
                                                                                                                                            "argument": {"variable": "caseResults"}}}}}}},
                                                                                                                                "typeScheme": {
                                                                                                                                  "variables": [],
                                                                                                                                  "body": {
                                                                                                                                    "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}},
                                                                                                                                  "constraints": []}}],
                                                                                                                            "body": {
                                                                                                                              "let": {
                                                                                                                                "bindings": [
                                                                                                                                  {
                                                                                                                                    "name": "codvResult",
                                                                                                                                    "term": {"application": {"function": {"variable": "hydra.core.names.freshName"}, "argument": {"variable": "fcx4"}}},
                                                                                                                                    "typeScheme": {
                                                                                                                                      "variables": [],
                                                                                                                                      "body": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                                                                      "constraints": []}}],
                                                                                                                                "body": {
                                                                                                                                  "let": {
                                                                                                                                    "bindings": [
                                                                                                                                      {
                                                                                                                                        "name": "codv",
                                                                                                                                        "term": {
                                                                                                                                          "application": {
                                                                                                                                            "function": {
                                                                                                                                              "typeApplication": {
                                                                                                                                                "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                                                                "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                                                                            "argument": {"variable": "codvResult"}}},
                                                                                                                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Name"}, "constraints": []}}],
                                                                                                                                    "body": {
                                                                                                                                      "let": {
                                                                                                                                        "bindings": [
                                                                                                                                          {
                                                                                                                                            "name": "fcx5",
                                                                                                                                            "term": {
                                                                                                                                              "application": {
                                                                                                                                                "function": {
                                                                                                                                                  "typeApplication": {
                                                                                                                                                    "body": {
                                                                                                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                                                                    "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                                                                                "argument": {"variable": "codvResult"}}},
                                                                                                                                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "constraints": []}}],
                                                                                                                                        "body": {
                                                                                                                                          "let": {
                                                                                                                                            "bindings": [
                                                                                                                                              {
                                                                                                                                                "name": "cod",
                                                                                                                                                "term": {"inject": {"typeName": "hydra.core.model.Type", "field": {"name": "variable", "term": {"variable": "codv"}}}},
                                                                                                                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
                                                                                                                                            "body": {
                                                                                                                                              "let": {
                                                                                                                                                "bindings": [
                                                                                                                                                  {
                                                                                                                                                    "name": "caseMap",
                                                                                                                                                    "term": {
                                                                                                                                                      "application": {
                                                                                                                                                        "function": {
                                                                                                                                                          "typeApplication": {
                                                                                                                                                            "body": {
                                                                                                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.maps.fromList"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                                                                            "type": {"variable": "hydra.core.model.Type"}}},
                                                                                                                                                        "argument": {
                                                                                                                                                          "application": {
                                                                                                                                                            "function": {
                                                                                                                                                              "application": {
                                                                                                                                                                "function": {
                                                                                                                                                                  "typeApplication": {
                                                                                                                                                                    "body": {
                                                                                                                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.model.FieldType"}}},
                                                                                                                                                                    "type": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.model.Type"}}}}},
                                                                                                                                                                "argument": {
                                                                                                                                                                  "lambda": {
                                                                                                                                                                    "parameter": "ft",
                                                                                                                                                                    "domain": {"variable": "hydra.core.model.FieldType"},
                                                                                                                                                                    "body": {
                                                                                                                                                                      "typeApplication": {
                                                                                                                                                                        "body": {
                                                                                                                                                                          "typeApplication": {
                                                                                                                                                                            "body": {
                                                                                                                                                                              "pair": {
                                                                                                                                                                                "first": {
                                                                                                                                                                                  "application": {
                                                                                                                                                                                    "function": {"project": {"typeName": "hydra.core.model.FieldType", "fieldName": "name"}},
                                                                                                                                                                                    "argument": {"variable": "ft"}}},
                                                                                                                                                                                "second": {
                                                                                                                                                                                  "application": {
                                                                                                                                                                                    "function": {"project": {"typeName": "hydra.core.model.FieldType", "fieldName": "type"}},
                                                                                                                                                                                    "argument": {"variable": "ft"}}}}},
                                                                                                                                                                            "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                                                                                        "type": {"variable": "hydra.core.model.Type"}}}}}}},
                                                                                                                                                            "argument": {"variable": "sfields"}}}}},
                                                                                                                                                    "typeScheme": {
                                                                                                                                                      "variables": [],
                                                                                                                                                      "body": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.Type"}}},
                                                                                                                                                      "constraints": []}}],
                                                                                                                                                "body": {
                                                                                                                                                  "let": {
                                                                                                                                                    "bindings": [
                                                                                                                                                      {
                                                                                                                                                        "name": "dfltConstraints",
                                                                                                                                                        "term": {
                                                                                                                                                          "application": {
                                                                                                                                                            "function": {
                                                                                                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.optionals.toList"}, "type": {"variable": "hydra.core.typing.TypeConstraint"}}},
                                                                                                                                                            "argument": {
                                                                                                                                                              "application": {
                                                                                                                                                                "function": {
                                                                                                                                                                  "application": {
                                                                                                                                                                    "function": {
                                                                                                                                                                      "typeApplication": {
                                                                                                                                                                        "body": {
                                                                                                                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.optionals.map"}, "type": {"variable": "hydra.core.typing.InferenceResult"}}},
                                                                                                                                                                        "type": {"variable": "hydra.core.typing.TypeConstraint"}}},
                                                                                                                                                                    "argument": {
                                                                                                                                                                      "lambda": {
                                                                                                                                                                        "parameter": "r",
                                                                                                                                                                        "domain": {"variable": "hydra.core.typing.InferenceResult"},
                                                                                                                                                                        "body": {
                                                                                                                                                                          "record": {
                                                                                                                                                                            "typeName": "hydra.core.typing.TypeConstraint",
                                                                                                                                                                            "fields": [
                                                                                                                                                                              {"name": "left", "term": {"variable": "cod"}},
                                                                                                                                                                              {
                                                                                                                                                                                "name": "right",
                                                                                                                                                                                "term": {
                                                                                                                                                                                  "application": {
                                                                                                                                                                                    "function": {"application": {"function": {"variable": "hydra.core.substitution.substInType"}, "argument": {"variable": "isubst"}}},
                                                                                                                                                                                    "argument": {
                                                                                                                                                                                      "application": {
                                                                                                                                                                                        "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "type"}},
                                                                                                                                                                                        "argument": {"variable": "r"}}}}}},
                                                                                                                                                                              {"name": "comment", "term": {"literal": {"string": "match default"}}}]}}}}}},
                                                                                                                                                                "argument": {"variable": "dfltResult"}}}}},
                                                                                                                                                        "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.typing.TypeConstraint"}}, "constraints": []}}],
                                                                                                                                                    "body": {
                                                                                                                                                      "let": {
                                                                                                                                                        "bindings": [
                                                                                                                                                          {
                                                                                                                                                            "name": "caseConstraints",
                                                                                                                                                            "term": {
                                                                                                                                                              "application": {
                                                                                                                                                                "function": {
                                                                                                                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.optionals.givens"}, "type": {"variable": "hydra.core.typing.TypeConstraint"}}},
                                                                                                                                                                "argument": {
                                                                                                                                                                  "application": {
                                                                                                                                                                    "function": {
                                                                                                                                                                      "application": {
                                                                                                                                                                        "function": {
                                                                                                                                                                          "application": {
                                                                                                                                                                            "function": {
                                                                                                                                                                              "typeApplication": {
                                                                                                                                                                                "body": {
                                                                                                                                                                                  "typeApplication": {
                                                                                                                                                                                    "body": {
                                                                                                                                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.lists.zipWith"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                                                                                                    "type": {"variable": "hydra.core.model.Type"}}},
                                                                                                                                                                                "type": {"optional": {"variable": "hydra.core.typing.TypeConstraint"}}}},
                                                                                                                                                                            "argument": {
                                                                                                                                                                              "lambda": {
                                                                                                                                                                                "parameter": "fname",
                                                                                                                                                                                "domain": {"variable": "hydra.core.model.Name"},
                                                                                                                                                                                "body": {
                                                                                                                                                                                  "lambda": {
                                                                                                                                                                                    "parameter": "itype",
                                                                                                                                                                                    "domain": {"variable": "hydra.core.model.Type"},
                                                                                                                                                                                    "body": {
                                                                                                                                                                                      "application": {
                                                                                                                                                                                        "function": {
                                                                                                                                                                                          "application": {
                                                                                                                                                                                            "function": {
                                                                                                                                                                                              "typeApplication": {
                                                                                                                                                                                                "body": {
                                                                                                                                                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.optionals.map"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                                                                                                                                                "type": {"variable": "hydra.core.typing.TypeConstraint"}}},
                                                                                                                                                                                            "argument": {
                                                                                                                                                                                              "lambda": {
                                                                                                                                                                                                "parameter": "ftype",
                                                                                                                                                                                                "domain": {"variable": "hydra.core.model.Type"},
                                                                                                                                                                                                "body": {
                                                                                                                                                                                                  "record": {
                                                                                                                                                                                                    "typeName": "hydra.core.typing.TypeConstraint",
                                                                                                                                                                                                    "fields": [
                                                                                                                                                                                                      {"name": "left", "term": {"variable": "itype"}},
                                                                                                                                                                                                      {
                                                                                                                                                                                                        "name": "right",
                                                                                                                                                                                                        "term": {
                                                                                                                                                                                                          "inject": {
                                                                                                                                                                                                            "typeName": "hydra.core.model.Type",
                                                                                                                                                                                                            "field": {
                                                                                                                                                                                                              "name": "function",
                                                                                                                                                                                                              "term": {
                                                                                                                                                                                                                "record": {
                                                                                                                                                                                                                  "typeName": "hydra.core.model.FunctionType",
                                                                                                                                                                                                                  "fields": [{"name": "domain", "term": {"variable": "ftype"}}, {"name": "codomain", "term": {"variable": "cod"}}]}}}}}},
                                                                                                                                                                                                      {"name": "comment", "term": {"literal": {"string": "case 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": "fname"}}},
                                                                                                                                                                                            "argument": {"variable": "caseMap"}}}}}}}}}}},
                                                                                                                                                                        "argument": {"variable": "fnames"}}},
                                                                                                                                                                    "argument": {"variable": "itypes"}}}}},
                                                                                                                                                            "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.typing.TypeConstraint"}}, "constraints": []}}],
                                                                                                                                                        "body": {
                                                                                                                                                          "let": {
                                                                                                                                                            "bindings": [
                                                                                                                                                              {
                                                                                                                                                                "name": "dfltClassConstraints",
                                                                                                                                                                "term": {
                                                                                                                                                                  "application": {
                                                                                                                                                                    "function": {
                                                                                                                                                                      "application": {
                                                                                                                                                                        "function": {
                                                                                                                                                                          "typeApplication": {
                                                                                                                                                                            "body": {"variable": "hydra.core.lib.optionals.withDefault"},
                                                                                                                                                                            "type": {
                                                                                                                                                                              "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}},
                                                                                                                                                                        "argument": {
                                                                                                                                                                          "typeApplication": {
                                                                                                                                                                            "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.empty"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                                                                                            "type": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}},
                                                                                                                                                                    "argument": {
                                                                                                                                                                      "application": {
                                                                                                                                                                        "function": {
                                                                                                                                                                          "application": {
                                                                                                                                                                            "function": {
                                                                                                                                                                              "typeApplication": {
                                                                                                                                                                                "body": {
                                                                                                                                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.optionals.map"}, "type": {"variable": "hydra.core.typing.InferenceResult"}}},
                                                                                                                                                                                "type": {
                                                                                                                                                                                  "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}},
                                                                                                                                                                            "argument": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "classConstraints"}}}},
                                                                                                                                                                        "argument": {"variable": "dfltResult"}}}}},
                                                                                                                                                                "typeScheme": {
                                                                                                                                                                  "variables": [],
                                                                                                                                                                  "body": {
                                                                                                                                                                    "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}},
                                                                                                                                                                  "constraints": []}}],
                                                                                                                                                            "body": {
                                                                                                                                                              "let": {
                                                                                                                                                                "bindings": [
                                                                                                                                                                  {
                                                                                                                                                                    "name": "allElemConstraints",
                                                                                                                                                                    "term": {
                                                                                                                                                                      "application": {
                                                                                                                                                                        "function": {
                                                                                                                                                                          "application": {
                                                                                                                                                                            "function": {
                                                                                                                                                                              "typeApplication": {"body": {"variable": "hydra.core.inference.mergeClassConstraints"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                                                                                            "argument": {"variable": "caseElemConstraints"}}},
                                                                                                                                                                        "argument": {"variable": "dfltClassConstraints"}}},
                                                                                                                                                                    "typeScheme": {
                                                                                                                                                                      "variables": [],
                                                                                                                                                                      "body": {
                                                                                                                                                                        "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}},
                                                                                                                                                                      "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.InferenceResult"}}},
                                                                                                                                                                            "type": {"variable": "hydra.core.typing.InferenceResult"}}},
                                                                                                                                                                        "argument": {
                                                                                                                                                                          "application": {
                                                                                                                                                                            "function": {
                                                                                                                                                                              "application": {
                                                                                                                                                                                "function": {
                                                                                                                                                                                  "application": {
                                                                                                                                                                                    "function": {
                                                                                                                                                                                      "application": {
                                                                                                                                                                                        "function": {
                                                                                                                                                                                          "typeApplication": {"body": {"variable": "hydra.core.inference.mapConstraints"}, "type": {"variable": "hydra.core.typing.InferenceResult"}}},
                                                                                                                                                                                        "argument": {"variable": "fcx5"}}},
                                                                                                                                                                                    "argument": {"variable": "cx"}}},
                                                                                                                                                                                "argument": {
                                                                                                                                                                                  "lambda": {
                                                                                                                                                                                    "parameter": "subst",
                                                                                                                                                                                    "domain": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                                                                                                    "body": {
                                                                                                                                                                                      "application": {
                                                                                                                                                                                        "function": {
                                                                                                                                                                                          "application": {
                                                                                                                                                                                            "function": {
                                                                                                                                                                                              "application": {
                                                                                                                                                                                                "function": {
                                                                                                                                                                                                  "application": {
                                                                                                                                                                                                    "function": {
                                                                                                                                                                                                      "application": {"function": {"variable": "hydra.core.inference.yieldWithConstraints"}, "argument": {"variable": "fcx5"}}},
                                                                                                                                                                                                    "argument": {
                                                                                                                                                                                                      "application": {
                                                                                                                                                                                                        "function": {
                                                                                                                                                                                                          "application": {"function": {"variable": "hydra.core.inference.buildTypeApplicationTerm"}, "argument": {"variable": "svars"}}},
                                                                                                                                                                                                        "argument": {
                                                                                                                                                                                                          "inject": {
                                                                                                                                                                                                            "typeName": "hydra.core.model.Term",
                                                                                                                                                                                                            "field": {
                                                                                                                                                                                                              "name": "cases",
                                                                                                                                                                                                              "term": {
                                                                                                                                                                                                                "record": {
                                                                                                                                                                                                                  "typeName": "hydra.core.model.CaseStatement",
                                                                                                                                                                                                                  "fields": [
                                                                                                                                                                                                                    {"name": "typeName", "term": {"variable": "tname"}},
                                                                                                                                                                                                                    {
                                                                                                                                                                                                                      "name": "default",
                                                                                                                                                                                                                      "term": {
                                                                                                                                                                                                                        "application": {
                                                                                                                                                                                                                          "function": {
                                                                                                                                                                                                                            "application": {
                                                                                                                                                                                                                              "function": {
                                                                                                                                                                                                                                "typeApplication": {
                                                                                                                                                                                                                                  "body": {
                                                                                                                                                                                                                                    "typeApplication": {"body": {"variable": "hydra.core.lib.optionals.map"}, "type": {"variable": "hydra.core.typing.InferenceResult"}}},
                                                                                                                                                                                                                                  "type": {"variable": "hydra.core.model.Term"}}},
                                                                                                                                                                                                                              "argument": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "term"}}}},
                                                                                                                                                                                                                          "argument": {"variable": "dfltResult"}}}},
                                                                                                                                                                                                                    {
                                                                                                                                                                                                                      "name": "cases",
                                                                                                                                                                                                                      "term": {
                                                                                                                                                                                                                        "application": {
                                                                                                                                                                                                                          "function": {
                                                                                                                                                                                                                            "application": {
                                                                                                                                                                                                                              "function": {
                                                                                                                                                                                                                                "application": {
                                                                                                                                                                                                                                  "function": {
                                                                                                                                                                                                                                    "typeApplication": {
                                                                                                                                                                                                                                      "body": {
                                                                                                                                                                                                                                        "typeApplication": {
                                                                                                                                                                                                                                          "body": {
                                                                                                                                                                                                                                            "typeApplication": {"body": {"variable": "hydra.core.lib.lists.zipWith"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                                                                                                                                                          "type": {"variable": "hydra.core.model.Term"}}},
                                                                                                                                                                                                                                      "type": {"variable": "hydra.core.model.CaseAlternative"}}},
                                                                                                                                                                                                                                  "argument": {
                                                                                                                                                                                                                                    "lambda": {
                                                                                                                                                                                                                                      "parameter": "n",
                                                                                                                                                                                                                                      "domain": {"variable": "hydra.core.model.Name"},
                                                                                                                                                                                                                                      "body": {
                                                                                                                                                                                                                                        "lambda": {
                                                                                                                                                                                                                                          "parameter": "t",
                                                                                                                                                                                                                                          "domain": {"variable": "hydra.core.model.Term"},
                                                                                                                                                                                                                                          "body": {
                                                                                                                                                                                                                                            "record": {
                                                                                                                                                                                                                                              "typeName": "hydra.core.model.CaseAlternative",
                                                                                                                                                                                                                                              "fields": [{"name": "name", "term": {"variable": "n"}}, {"name": "handler", "term": {"variable": "t"}}]}}}}}}}},
                                                                                                                                                                                                                              "argument": {"variable": "fnames"}}},
                                                                                                                                                                                                                          "argument": {"variable": "iterms"}}}}]}}}}}}}}},
                                                                                                                                                                                                "argument": {
                                                                                                                                                                                                  "inject": {
                                                                                                                                                                                                    "typeName": "hydra.core.model.Type",
                                                                                                                                                                                                    "field": {
                                                                                                                                                                                                      "name": "function",
                                                                                                                                                                                                      "term": {
                                                                                                                                                                                                        "record": {
                                                                                                                                                                                                          "typeName": "hydra.core.model.FunctionType",
                                                                                                                                                                                                          "fields": [
                                                                                                                                                                                                            {
                                                                                                                                                                                                              "name": "domain",
                                                                                                                                                                                                              "term": {
                                                                                                                                                                                                                "application": {
                                                                                                                                                                                                                  "function": {
                                                                                                                                                                                                                    "application": {"function": {"variable": "hydra.core.resolution.nominalApplication"}, "argument": {"variable": "tname"}}},
                                                                                                                                                                                                                  "argument": {
                                                                                                                                                                                                                    "application": {
                                                                                                                                                                                                                      "function": {
                                                                                                                                                                                                                        "application": {
                                                                                                                                                                                                                          "function": {
                                                                                                                                                                                                                            "typeApplication": {
                                                                                                                                                                                                                              "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                                                                                                                                              "type": {"variable": "hydra.core.model.Type"}}},
                                                                                                                                                                                                                          "argument": {
                                                                                                                                                                                                                            "lambda": {
                                                                                                                                                                                                                              "parameter": "x",
                                                                                                                                                                                                                              "domain": {"variable": "hydra.core.model.Name"},
                                                                                                                                                                                                                              "body": {"inject": {"typeName": "hydra.core.model.Type", "field": {"name": "variable", "term": {"variable": "x"}}}}}}}},
                                                                                                                                                                                                                      "argument": {"variable": "svars"}}}}}},
                                                                                                                                                                                                            {"name": "codomain", "term": {"variable": "cod"}}]}}}}}}},
                                                                                                                                                                                            "argument": {
                                                                                                                                                                                              "application": {
                                                                                                                                                                                                "function": {"variable": "hydra.core.substitution.composeTypeSubstList"},
                                                                                                                                                                                                "argument": {
                                                                                                                                                                                                  "application": {
                                                                                                                                                                                                    "function": {
                                                                                                                                                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.lists.concat"}, "type": {"variable": "hydra.core.typing.TypeSubst"}}},
                                                                                                                                                                                                    "argument": {
                                                                                                                                                                                                      "list": [
                                                                                                                                                                                                        {
                                                                                                                                                                                                          "application": {
                                                                                                                                                                                                            "function": {
                                                                                                                                                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.optionals.toList"}, "type": {"variable": "hydra.core.typing.TypeSubst"}}},
                                                                                                                                                                                                            "argument": {
                                                                                                                                                                                                              "application": {
                                                                                                                                                                                                                "function": {
                                                                                                                                                                                                                  "application": {
                                                                                                                                                                                                                    "function": {
                                                                                                                                                                                                                      "typeApplication": {
                                                                                                                                                                                                                        "body": {
                                                                                                                                                                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.optionals.map"}, "type": {"variable": "hydra.core.typing.InferenceResult"}}},
                                                                                                                                                                                                                        "type": {"variable": "hydra.core.typing.TypeSubst"}}},
                                                                                                                                                                                                                    "argument": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "subst"}}}},
                                                                                                                                                                                                                "argument": {"variable": "dfltResult"}}}}},
                                                                                                                                                                                                        {"list": [{"variable": "isubst"}, {"variable": "subst"}]}]}}}}}}},
                                                                                                                                                                                        "argument": {
                                                                                                                                                                                          "application": {
                                                                                                                                                                                            "function": {
                                                                                                                                                                                              "application": {"function": {"variable": "hydra.core.substitution.substInClassConstraints"}, "argument": {"variable": "subst"}}},
                                                                                                                                                                                            "argument": {"variable": "allElemConstraints"}}}}}}}}},
                                                                                                                                                                            "argument": {
                                                                                                                                                                              "application": {
                                                                                                                                                                                "function": {
                                                                                                                                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.lists.concat"}, "type": {"variable": "hydra.core.typing.TypeConstraint"}}},
                                                                                                                                                                                "argument": {"list": [{"variable": "dfltConstraints"}, {"variable": "caseConstraints"}]}}}}}}},
                                                                                                                                                                    "argument": {
                                                                                                                                                                      "lambda": {
                                                                                                                                                                        "parameter": "mcResult",
                                                                                                                                                                        "domain": {"variable": "hydra.core.typing.InferenceResult"},
                                                                                                                                                                        "body": {
                                                                                                                                                                          "typeApplication": {
                                                                                                                                                                            "body": {
                                                                                                                                                                              "typeApplication": {"body": {"either": {"right": {"variable": "mcResult"}}}, "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                                                                                                            "type": {"variable": "hydra.core.typing.InferenceResult"}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {
                    "literal": {"string": "Infer the type of a case statement (Either version). Paper: inference.tex, rules Case and Case_d."}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.inference.inferTypeOfCollection",
        "signature": {
          "typeParameters": [],
          "parameters": [
            {"name": "arg0", "type": {"variable": "hydra.core.typing.InferenceContext"}, "isLazy": false},
            {"name": "arg1", "type": {"variable": "hydra.core.graph.Graph"}, "isLazy": false},
            {
              "name": "arg2",
              "type": {"function": {"domain": {"variable": "hydra.core.model.Type"}, "codomain": {"variable": "hydra.core.model.Type"}}},
              "isLazy": false},
            {
              "name": "arg3",
              "type": {
                "function": {"domain": {"list": {"variable": "hydra.core.model.Term"}}, "codomain": {"variable": "hydra.core.model.Term"}}},
              "isLazy": false},
            {"name": "arg4", "type": {"literal": "string"}, "isLazy": false},
            {"name": "arg5", "type": {"set": {"variable": "hydra.core.model.Name"}}, "isLazy": false},
            {"name": "arg6", "type": {"list": {"variable": "hydra.core.model.Term"}}, "isLazy": false}],
          "result": {
            "type": {
              "either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.typing.InferenceResult"}}}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "fcx",
                "domain": {"variable": "hydra.core.typing.InferenceContext"},
                "body": {
                  "lambda": {
                    "parameter": "cx",
                    "domain": {"variable": "hydra.core.graph.Graph"},
                    "body": {
                      "lambda": {
                        "parameter": "typCons",
                        "domain": {"function": {"domain": {"variable": "hydra.core.model.Type"}, "codomain": {"variable": "hydra.core.model.Type"}}},
                        "body": {
                          "lambda": {
                            "parameter": "trmCons",
                            "domain": {
                              "function": {"domain": {"list": {"variable": "hydra.core.model.Term"}}, "codomain": {"variable": "hydra.core.model.Term"}}},
                            "body": {
                              "lambda": {
                                "parameter": "desc",
                                "domain": {"literal": "string"},
                                "body": {
                                  "lambda": {
                                    "parameter": "classNames",
                                    "domain": {"set": {"variable": "hydra.core.model.Name"}},
                                    "body": {
                                      "lambda": {
                                        "parameter": "els",
                                        "domain": {"list": {"variable": "hydra.core.model.Term"}},
                                        "body": {
                                          "let": {
                                            "bindings": [
                                              {
                                                "name": "varResult",
                                                "term": {"application": {"function": {"variable": "hydra.core.names.freshName"}, "argument": {"variable": "fcx"}}},
                                                "typeScheme": {
                                                  "variables": [],
                                                  "body": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                  "constraints": []}}],
                                            "body": {
                                              "let": {
                                                "bindings": [
                                                  {
                                                    "name": "var",
                                                    "term": {
                                                      "application": {
                                                        "function": {
                                                          "typeApplication": {
                                                            "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                            "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                        "argument": {"variable": "varResult"}}},
                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Name"}, "constraints": []}}],
                                                "body": {
                                                  "let": {
                                                    "bindings": [
                                                      {
                                                        "name": "fcx2",
                                                        "term": {
                                                          "application": {
                                                            "function": {
                                                              "typeApplication": {
                                                                "body": {
                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                            "argument": {"variable": "varResult"}}},
                                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "constraints": []}}],
                                                    "body": {
                                                      "let": {
                                                        "bindings": [
                                                          {
                                                            "name": "classConstraints",
                                                            "term": {
                                                              "application": {
                                                                "function": {
                                                                  "application": {
                                                                    "function": {
                                                                      "application": {
                                                                        "function": {
                                                                          "typeApplication": {
                                                                            "body": {"variable": "hydra.core.lib.logic.ifElse"},
                                                                            "type": {
                                                                              "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}},
                                                                        "argument": {
                                                                          "application": {
                                                                            "function": {
                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.sets.isEmpty"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                            "argument": {"variable": "classNames"}}}}},
                                                                    "argument": {
                                                                      "typeApplication": {
                                                                        "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.empty"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                        "type": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}},
                                                                "argument": {
                                                                  "application": {
                                                                    "function": {
                                                                      "application": {
                                                                        "function": {
                                                                          "typeApplication": {
                                                                            "body": {
                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.maps.singleton"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                            "type": {"variable": "hydra.core.model.TypeVariableConstraints"}}},
                                                                        "argument": {"variable": "var"}}},
                                                                    "argument": {
                                                                      "record": {
                                                                        "typeName": "hydra.core.model.TypeVariableConstraints",
                                                                        "fields": [
                                                                          {
                                                                            "name": "classes",
                                                                            "term": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "application": {
                                                                                    "function": {
                                                                                      "typeApplication": {
                                                                                        "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.map"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                        "type": {"variable": "hydra.core.model.TypeClassConstraint"}}},
                                                                                    "argument": {
                                                                                      "lambda": {
                                                                                        "parameter": "n",
                                                                                        "domain": {"variable": "hydra.core.model.Name"},
                                                                                        "body": {"inject": {"typeName": "hydra.core.model.TypeClassConstraint", "field": {"name": "simple", "term": {"variable": "n"}}}}}}}},
                                                                                "argument": {"variable": "classNames"}}}}]}}}}}},
                                                            "typeScheme": {
                                                              "variables": [],
                                                              "body": {
                                                                "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}},
                                                              "constraints": []}}],
                                                        "body": {
                                                          "application": {
                                                            "function": {
                                                              "application": {
                                                                "function": {
                                                                  "application": {
                                                                    "function": {
                                                                      "typeApplication": {
                                                                        "body": {"variable": "hydra.core.lib.logic.ifElse"},
                                                                        "type": {
                                                                          "either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.typing.InferenceResult"}}}}},
                                                                    "argument": {
                                                                      "application": {
                                                                        "function": {
                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.lists.isEmpty"}, "type": {"variable": "hydra.core.model.Term"}}},
                                                                        "argument": {"variable": "els"}}}}},
                                                                "argument": {
                                                                  "typeApplication": {
                                                                    "body": {
                                                                      "typeApplication": {
                                                                        "body": {
                                                                          "either": {
                                                                            "right": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "application": {
                                                                                    "function": {
                                                                                      "application": {
                                                                                        "function": {
                                                                                          "application": {
                                                                                            "function": {
                                                                                              "application": {"function": {"variable": "hydra.core.inference.yieldWithConstraints"}, "argument": {"variable": "fcx2"}}},
                                                                                            "argument": {
                                                                                              "application": {
                                                                                                "function": {
                                                                                                  "application": {"function": {"variable": "hydra.core.inference.buildTypeApplicationTerm"}, "argument": {"list": [{"variable": "var"}]}}},
                                                                                                "argument": {
                                                                                                  "application": {
                                                                                                    "function": {"variable": "trmCons"},
                                                                                                    "argument": {"typeApplication": {"body": {"list": []}, "type": {"variable": "hydra.core.model.Term"}}}}}}}}},
                                                                                        "argument": {
                                                                                          "application": {
                                                                                            "function": {"variable": "typCons"},
                                                                                            "argument": {"inject": {"typeName": "hydra.core.model.Type", "field": {"name": "variable", "term": {"variable": "var"}}}}}}}},
                                                                                    "argument": {"variable": "hydra.core.substitution.idTypeSubst"}}},
                                                                                "argument": {"variable": "classConstraints"}}}}},
                                                                        "type": {"variable": "hydra.core.errors.Error"}}},
                                                                    "type": {"variable": "hydra.core.typing.InferenceResult"}}}}},
                                                            "argument": {
                                                              "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": {
                                                                                  "pair": {
                                                                                    "first": {"list": {"variable": "hydra.core.model.Term"}},
                                                                                    "second": {
                                                                                      "pair": {
                                                                                        "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                        "second": {
                                                                                          "pair": {
                                                                                            "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                            "second": {
                                                                                              "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}},
                                                                                "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                        "type": {"variable": "hydra.core.typing.InferenceResult"}}},
                                                                    "argument": {
                                                                      "application": {
                                                                        "function": {
                                                                          "application": {
                                                                            "function": {"application": {"function": {"variable": "hydra.core.inference.inferMany"}, "argument": {"variable": "fcx2"}}},
                                                                            "argument": {"variable": "cx"}}},
                                                                        "argument": {
                                                                          "application": {
                                                                            "function": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "typeApplication": {
                                                                                    "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.zip"}, "type": {"variable": "hydra.core.model.Term"}}},
                                                                                    "type": {"literal": "string"}}},
                                                                                "argument": {"variable": "els"}}},
                                                                            "argument": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "application": {
                                                                                    "function": {
                                                                                      "typeApplication": {
                                                                                        "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"literal": {"integer": "int32"}}}},
                                                                                        "type": {"literal": "string"}}},
                                                                                    "argument": {
                                                                                      "lambda": {
                                                                                        "parameter": "i",
                                                                                        "domain": {"literal": {"integer": "int32"}},
                                                                                        "body": {
                                                                                          "application": {
                                                                                            "function": {"variable": "hydra.core.lib.strings.concat"},
                                                                                            "argument": {
                                                                                              "list": [
                                                                                                {"literal": {"string": "#"}},
                                                                                                {"application": {"function": {"variable": "hydra.core.lib.literals.printInt32"}, "argument": {"variable": "i"}}}]}}}}}}},
                                                                                "argument": {
                                                                                  "application": {
                                                                                    "function": {
                                                                                      "application": {"function": {"variable": "hydra.core.lib.math.range"}, "argument": {"literal": {"integer": {"int32": 1}}}}},
                                                                                    "argument": {
                                                                                      "application": {
                                                                                        "function": {
                                                                                          "application": {
                                                                                            "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.math.add"}, "type": {"literal": {"integer": "int32"}}}},
                                                                                            "argument": {
                                                                                              "application": {
                                                                                                "function": {
                                                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.lists.length"}, "type": {"variable": "hydra.core.model.Term"}}},
                                                                                                "argument": {"variable": "els"}}}}},
                                                                                        "argument": {"literal": {"integer": {"int32": 1}}}}}}}}}}}}}}},
                                                                "argument": {
                                                                  "lambda": {
                                                                    "parameter": "resultsRp",
                                                                    "domain": {
                                                                      "pair": {
                                                                        "first": {
                                                                          "pair": {
                                                                            "first": {"list": {"variable": "hydra.core.model.Term"}},
                                                                            "second": {
                                                                              "pair": {
                                                                                "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                "second": {
                                                                                  "pair": {
                                                                                    "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                    "second": {
                                                                                      "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}},
                                                                        "second": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                    "body": {
                                                                      "let": {
                                                                        "bindings": [
                                                                          {
                                                                            "name": "results",
                                                                            "term": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "typeApplication": {
                                                                                    "body": {
                                                                                      "typeApplication": {
                                                                                        "body": {"variable": "hydra.core.lib.pairs.first"},
                                                                                        "type": {
                                                                                          "pair": {
                                                                                            "first": {"list": {"variable": "hydra.core.model.Term"}},
                                                                                            "second": {
                                                                                              "pair": {
                                                                                                "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                                "second": {
                                                                                                  "pair": {
                                                                                                    "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                    "second": {
                                                                                                      "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}}}},
                                                                                    "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                "argument": {"variable": "resultsRp"}}},
                                                                            "typeScheme": {
                                                                              "variables": [],
                                                                              "body": {
                                                                                "pair": {
                                                                                  "first": {"list": {"variable": "hydra.core.model.Term"}},
                                                                                  "second": {
                                                                                    "pair": {
                                                                                      "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                      "second": {
                                                                                        "pair": {
                                                                                          "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                          "second": {
                                                                                            "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}},
                                                                              "constraints": []}}],
                                                                        "body": {
                                                                          "let": {
                                                                            "bindings": [
                                                                              {
                                                                                "name": "fcx3",
                                                                                "term": {
                                                                                  "application": {
                                                                                    "function": {
                                                                                      "typeApplication": {
                                                                                        "body": {
                                                                                          "typeApplication": {
                                                                                            "body": {"variable": "hydra.core.lib.pairs.second"},
                                                                                            "type": {
                                                                                              "pair": {
                                                                                                "first": {"list": {"variable": "hydra.core.model.Term"}},
                                                                                                "second": {
                                                                                                  "pair": {
                                                                                                    "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                                    "second": {
                                                                                                      "pair": {
                                                                                                        "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                        "second": {
                                                                                                          "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}}}},
                                                                                        "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                    "argument": {"variable": "resultsRp"}}},
                                                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "constraints": []}}],
                                                                            "body": {
                                                                              "let": {
                                                                                "bindings": [
                                                                                  {
                                                                                    "name": "terms",
                                                                                    "term": {
                                                                                      "application": {
                                                                                        "function": {
                                                                                          "typeApplication": {
                                                                                            "body": {
                                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"list": {"variable": "hydra.core.model.Term"}}}},
                                                                                            "type": {
                                                                                              "pair": {
                                                                                                "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                                "second": {
                                                                                                  "pair": {
                                                                                                    "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                    "second": {
                                                                                                      "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}},
                                                                                        "argument": {"variable": "results"}}},
                                                                                    "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Term"}}, "constraints": []}}],
                                                                                "body": {
                                                                                  "let": {
                                                                                    "bindings": [
                                                                                      {
                                                                                        "name": "types",
                                                                                        "term": {
                                                                                          "application": {
                                                                                            "function": {
                                                                                              "typeApplication": {
                                                                                                "body": {
                                                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                                                                "type": {
                                                                                                  "pair": {
                                                                                                    "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                    "second": {
                                                                                                      "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}},
                                                                                            "argument": {
                                                                                              "application": {
                                                                                                "function": {
                                                                                                  "typeApplication": {
                                                                                                    "body": {
                                                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"list": {"variable": "hydra.core.model.Term"}}}},
                                                                                                    "type": {
                                                                                                      "pair": {
                                                                                                        "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                                        "second": {
                                                                                                          "pair": {
                                                                                                            "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                            "second": {
                                                                                                              "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}},
                                                                                                "argument": {"variable": "results"}}}}},
                                                                                        "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Type"}}, "constraints": []}}],
                                                                                    "body": {
                                                                                      "let": {
                                                                                        "bindings": [
                                                                                          {
                                                                                            "name": "subst1",
                                                                                            "term": {
                                                                                              "application": {
                                                                                                "function": {
                                                                                                  "typeApplication": {
                                                                                                    "body": {
                                                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"variable": "hydra.core.typing.TypeSubst"}}},
                                                                                                    "type": {
                                                                                                      "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}},
                                                                                                "argument": {
                                                                                                  "application": {
                                                                                                    "function": {
                                                                                                      "typeApplication": {
                                                                                                        "body": {
                                                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                                                                        "type": {
                                                                                                          "pair": {
                                                                                                            "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                            "second": {
                                                                                                              "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}},
                                                                                                    "argument": {
                                                                                                      "application": {
                                                                                                        "function": {
                                                                                                          "typeApplication": {
                                                                                                            "body": {
                                                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"list": {"variable": "hydra.core.model.Term"}}}},
                                                                                                            "type": {
                                                                                                              "pair": {
                                                                                                                "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                                                "second": {
                                                                                                                  "pair": {
                                                                                                                    "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                                    "second": {
                                                                                                                      "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}},
                                                                                                        "argument": {"variable": "results"}}}}}}},
                                                                                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.TypeSubst"}, "constraints": []}}],
                                                                                        "body": {
                                                                                          "let": {
                                                                                            "bindings": [
                                                                                              {
                                                                                                "name": "elemConstraints",
                                                                                                "term": {
                                                                                                  "application": {
                                                                                                    "function": {
                                                                                                      "typeApplication": {
                                                                                                        "body": {
                                                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"variable": "hydra.core.typing.TypeSubst"}}},
                                                                                                        "type": {
                                                                                                          "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}},
                                                                                                    "argument": {
                                                                                                      "application": {
                                                                                                        "function": {
                                                                                                          "typeApplication": {
                                                                                                            "body": {
                                                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                                                                            "type": {
                                                                                                              "pair": {
                                                                                                                "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                                "second": {
                                                                                                                  "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}},
                                                                                                        "argument": {
                                                                                                          "application": {
                                                                                                            "function": {
                                                                                                              "typeApplication": {
                                                                                                                "body": {
                                                                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"list": {"variable": "hydra.core.model.Term"}}}},
                                                                                                                "type": {
                                                                                                                  "pair": {
                                                                                                                    "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                                                    "second": {
                                                                                                                      "pair": {
                                                                                                                        "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                                        "second": {
                                                                                                                          "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}},
                                                                                                            "argument": {"variable": "results"}}}}}}},
                                                                                                "typeScheme": {
                                                                                                  "variables": [],
                                                                                                  "body": {
                                                                                                    "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}},
                                                                                                  "constraints": []}}],
                                                                                            "body": {
                                                                                              "let": {
                                                                                                "bindings": [
                                                                                                  {
                                                                                                    "name": "constraints",
                                                                                                    "term": {
                                                                                                      "application": {
                                                                                                        "function": {
                                                                                                          "application": {
                                                                                                            "function": {
                                                                                                              "typeApplication": {
                                                                                                                "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                                                                "type": {"variable": "hydra.core.typing.TypeConstraint"}}},
                                                                                                            "argument": {
                                                                                                              "lambda": {
                                                                                                                "parameter": "t",
                                                                                                                "domain": {"variable": "hydra.core.model.Type"},
                                                                                                                "body": {
                                                                                                                  "record": {
                                                                                                                    "typeName": "hydra.core.typing.TypeConstraint",
                                                                                                                    "fields": [
                                                                                                                      {
                                                                                                                        "name": "left",
                                                                                                                        "term": {"inject": {"typeName": "hydra.core.model.Type", "field": {"name": "variable", "term": {"variable": "var"}}}}},
                                                                                                                      {"name": "right", "term": {"variable": "t"}},
                                                                                                                      {"name": "comment", "term": {"variable": "desc"}}]}}}}}},
                                                                                                        "argument": {"variable": "types"}}},
                                                                                                    "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.typing.TypeConstraint"}}, "constraints": []}}],
                                                                                                "body": {
                                                                                                  "let": {
                                                                                                    "bindings": [
                                                                                                      {
                                                                                                        "name": "allConstraints",
                                                                                                        "term": {
                                                                                                          "application": {
                                                                                                            "function": {
                                                                                                              "application": {
                                                                                                                "function": {
                                                                                                                  "typeApplication": {"body": {"variable": "hydra.core.inference.mergeClassConstraints"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                                "argument": {"variable": "classConstraints"}}},
                                                                                                            "argument": {"variable": "elemConstraints"}}},
                                                                                                        "typeScheme": {
                                                                                                          "variables": [],
                                                                                                          "body": {
                                                                                                            "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}},
                                                                                                          "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.InferenceResult"}}},
                                                                                                                "type": {"variable": "hydra.core.typing.InferenceResult"}}},
                                                                                                            "argument": {
                                                                                                              "application": {
                                                                                                                "function": {
                                                                                                                  "application": {
                                                                                                                    "function": {
                                                                                                                      "application": {
                                                                                                                        "function": {
                                                                                                                          "application": {
                                                                                                                            "function": {
                                                                                                                              "typeApplication": {"body": {"variable": "hydra.core.inference.mapConstraints"}, "type": {"variable": "hydra.core.typing.InferenceResult"}}},
                                                                                                                            "argument": {"variable": "fcx3"}}},
                                                                                                                        "argument": {"variable": "cx"}}},
                                                                                                                    "argument": {
                                                                                                                      "lambda": {
                                                                                                                        "parameter": "subst2",
                                                                                                                        "domain": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                                        "body": {
                                                                                                                          "let": {
                                                                                                                            "bindings": [
                                                                                                                              {
                                                                                                                                "name": "iterm",
                                                                                                                                "term": {"application": {"function": {"variable": "trmCons"}, "argument": {"variable": "terms"}}},
                                                                                                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                                                                                                            "body": {
                                                                                                                              "let": {
                                                                                                                                "bindings": [
                                                                                                                                  {
                                                                                                                                    "name": "itype",
                                                                                                                                    "term": {
                                                                                                                                      "application": {
                                                                                                                                        "function": {"variable": "typCons"},
                                                                                                                                        "argument": {"inject": {"typeName": "hydra.core.model.Type", "field": {"name": "variable", "term": {"variable": "var"}}}}}},
                                                                                                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
                                                                                                                                "body": {
                                                                                                                                  "let": {
                                                                                                                                    "bindings": [
                                                                                                                                      {
                                                                                                                                        "name": "isubst",
                                                                                                                                        "term": {
                                                                                                                                          "application": {
                                                                                                                                            "function": {
                                                                                                                                              "application": {"function": {"variable": "hydra.core.substitution.composeTypeSubst"}, "argument": {"variable": "subst1"}}},
                                                                                                                                            "argument": {"variable": "subst2"}}},
                                                                                                                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.TypeSubst"}, "constraints": []}}],
                                                                                                                                    "body": {
                                                                                                                                      "application": {
                                                                                                                                        "function": {
                                                                                                                                          "application": {
                                                                                                                                            "function": {
                                                                                                                                              "application": {
                                                                                                                                                "function": {
                                                                                                                                                  "application": {
                                                                                                                                                    "function": {
                                                                                                                                                      "application": {"function": {"variable": "hydra.core.inference.yieldWithConstraints"}, "argument": {"variable": "fcx3"}}},
                                                                                                                                                    "argument": {"variable": "iterm"}}},
                                                                                                                                                "argument": {"variable": "itype"}}},
                                                                                                                                            "argument": {"variable": "isubst"}}},
                                                                                                                                        "argument": {
                                                                                                                                          "application": {
                                                                                                                                            "function": {
                                                                                                                                              "application": {"function": {"variable": "hydra.core.substitution.substInClassConstraints"}, "argument": {"variable": "subst2"}}},
                                                                                                                                            "argument": {"variable": "allConstraints"}}}}}}}}}}}}}}},
                                                                                                                "argument": {"variable": "constraints"}}}}},
                                                                                                        "argument": {
                                                                                                          "lambda": {
                                                                                                            "parameter": "mcResult",
                                                                                                            "domain": {"variable": "hydra.core.typing.InferenceResult"},
                                                                                                            "body": {
                                                                                                              "typeApplication": {
                                                                                                                "body": {
                                                                                                                  "typeApplication": {"body": {"either": {"right": {"variable": "mcResult"}}}, "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                                                "type": {"variable": "hydra.core.typing.InferenceResult"}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {
                    "literal": {
                      "string": "Infer the type of a collection. The classNames parameter specifies type classes (e.g. ordering) that the element type variable must satisfy. Paper: inference.tex, shared implementation of the collection introduction rules (Lst_0/Lst_+, Set_0/Set_+)."}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.inference.inferTypeOfEither",
        "signature": {
          "typeParameters": [],
          "parameters": [
            {"name": "arg0", "type": {"variable": "hydra.core.typing.InferenceContext"}, "isLazy": false},
            {"name": "arg1", "type": {"variable": "hydra.core.graph.Graph"}, "isLazy": false},
            {
              "name": "arg2",
              "type": {"either": {"left": {"variable": "hydra.core.model.Term"}, "right": {"variable": "hydra.core.model.Term"}}},
              "isLazy": false}],
          "result": {
            "type": {
              "either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.typing.InferenceResult"}}}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "fcx",
                "domain": {"variable": "hydra.core.typing.InferenceContext"},
                "body": {
                  "lambda": {
                    "parameter": "cx",
                    "domain": {"variable": "hydra.core.graph.Graph"},
                    "body": {
                      "lambda": {
                        "parameter": "e",
                        "domain": {"either": {"left": {"variable": "hydra.core.model.Term"}, "right": {"variable": "hydra.core.model.Term"}}},
                        "body": {
                          "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.errors.Error"}, "right": {"variable": "hydra.core.typing.InferenceResult"}}}}},
                                    "argument": {
                                      "lambda": {
                                        "parameter": "l",
                                        "domain": {"variable": "hydra.core.model.Term"},
                                        "body": {
                                          "application": {
                                            "function": {
                                              "application": {
                                                "function": {
                                                  "typeApplication": {
                                                    "body": {
                                                      "typeApplication": {
                                                        "body": {
                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.eithers.bind"}, "type": {"variable": "hydra.core.errors.Error"}}},
                                                        "type": {"variable": "hydra.core.typing.InferenceResult"}}},
                                                    "type": {"variable": "hydra.core.typing.InferenceResult"}}},
                                                "argument": {
                                                  "application": {
                                                    "function": {
                                                      "application": {
                                                        "function": {
                                                          "application": {
                                                            "function": {"application": {"function": {"variable": "hydra.core.inference.inferTypeOfTerm"}, "argument": {"variable": "fcx"}}},
                                                            "argument": {"variable": "cx"}}},
                                                        "argument": {"variable": "l"}}},
                                                    "argument": {"literal": {"string": "either left value"}}}}}},
                                            "argument": {
                                              "lambda": {
                                                "parameter": "r1",
                                                "domain": {"variable": "hydra.core.typing.InferenceResult"},
                                                "body": {
                                                  "let": {
                                                    "bindings": [
                                                      {
                                                        "name": "fcx2",
                                                        "term": {
                                                          "application": {
                                                            "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "context"}},
                                                            "argument": {"variable": "r1"}}},
                                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "constraints": []}}],
                                                    "body": {
                                                      "let": {
                                                        "bindings": [
                                                          {
                                                            "name": "iterm",
                                                            "term": {
                                                              "application": {
                                                                "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "term"}},
                                                                "argument": {"variable": "r1"}}},
                                                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                                        "body": {
                                                          "let": {
                                                            "bindings": [
                                                              {
                                                                "name": "leftType",
                                                                "term": {
                                                                  "application": {
                                                                    "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "type"}},
                                                                    "argument": {"variable": "r1"}}},
                                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
                                                            "body": {
                                                              "let": {
                                                                "bindings": [
                                                                  {
                                                                    "name": "subst",
                                                                    "term": {
                                                                      "application": {
                                                                        "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "subst"}},
                                                                        "argument": {"variable": "r1"}}},
                                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.TypeSubst"}, "constraints": []}}],
                                                                "body": {
                                                                  "let": {
                                                                    "bindings": [
                                                                      {
                                                                        "name": "fvResult",
                                                                        "term": {"application": {"function": {"variable": "hydra.core.inference.freshVariableType"}, "argument": {"variable": "fcx2"}}},
                                                                        "typeScheme": {
                                                                          "variables": [],
                                                                          "body": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                          "constraints": []}}],
                                                                    "body": {
                                                                      "let": {
                                                                        "bindings": [
                                                                          {
                                                                            "name": "rightType",
                                                                            "term": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "typeApplication": {
                                                                                    "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                                    "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                "argument": {"variable": "fvResult"}}},
                                                                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
                                                                        "body": {
                                                                          "let": {
                                                                            "bindings": [
                                                                              {
                                                                                "name": "fcx3",
                                                                                "term": {
                                                                                  "application": {
                                                                                    "function": {
                                                                                      "typeApplication": {
                                                                                        "body": {
                                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                                        "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                    "argument": {"variable": "fvResult"}}},
                                                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "constraints": []}}],
                                                                            "body": {
                                                                              "let": {
                                                                                "bindings": [
                                                                                  {
                                                                                    "name": "eitherTerm",
                                                                                    "term": {
                                                                                      "inject": {
                                                                                        "typeName": "hydra.core.model.Term",
                                                                                        "field": {
                                                                                          "name": "either",
                                                                                          "term": {
                                                                                            "typeApplication": {
                                                                                              "body": {
                                                                                                "typeApplication": {"body": {"either": {"left": {"variable": "iterm"}}}, "type": {"variable": "hydra.core.model.Term"}}},
                                                                                              "type": {"variable": "hydra.core.model.Term"}}}}}},
                                                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                                                                "body": {
                                                                                  "let": {
                                                                                    "bindings": [
                                                                                      {
                                                                                        "name": "termWithLeftType",
                                                                                        "term": {
                                                                                          "inject": {
                                                                                            "typeName": "hydra.core.model.Term",
                                                                                            "field": {
                                                                                              "name": "typeApplication",
                                                                                              "term": {
                                                                                                "record": {
                                                                                                  "typeName": "hydra.core.model.TypeApplicationTerm",
                                                                                                  "fields": [{"name": "body", "term": {"variable": "eitherTerm"}}, {"name": "type", "term": {"variable": "leftType"}}]}}}}},
                                                                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                                                                    "body": {
                                                                                      "let": {
                                                                                        "bindings": [
                                                                                          {
                                                                                            "name": "termWithBothTypes",
                                                                                            "term": {
                                                                                              "inject": {
                                                                                                "typeName": "hydra.core.model.Term",
                                                                                                "field": {
                                                                                                  "name": "typeApplication",
                                                                                                  "term": {
                                                                                                    "record": {
                                                                                                      "typeName": "hydra.core.model.TypeApplicationTerm",
                                                                                                      "fields": [{"name": "body", "term": {"variable": "termWithLeftType"}}, {"name": "type", "term": {"variable": "rightType"}}]}}}}},
                                                                                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                                                                        "body": {
                                                                                          "let": {
                                                                                            "bindings": [
                                                                                              {
                                                                                                "name": "eitherType",
                                                                                                "term": {
                                                                                                  "inject": {
                                                                                                    "typeName": "hydra.core.model.Type",
                                                                                                    "field": {
                                                                                                      "name": "either",
                                                                                                      "term": {
                                                                                                        "record": {
                                                                                                          "typeName": "hydra.core.model.EitherType",
                                                                                                          "fields": [{"name": "left", "term": {"variable": "leftType"}}, {"name": "right", "term": {"variable": "rightType"}}]}}}}},
                                                                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
                                                                                            "body": {
                                                                                              "typeApplication": {
                                                                                                "body": {
                                                                                                  "typeApplication": {
                                                                                                    "body": {
                                                                                                      "either": {
                                                                                                        "right": {
                                                                                                          "application": {
                                                                                                            "function": {
                                                                                                              "application": {
                                                                                                                "function": {
                                                                                                                  "application": {
                                                                                                                    "function": {"application": {"function": {"variable": "hydra.core.inference.yieldChecked"}, "argument": {"variable": "fcx3"}}},
                                                                                                                    "argument": {"variable": "termWithBothTypes"}}},
                                                                                                                "argument": {"variable": "eitherType"}}},
                                                                                                            "argument": {"variable": "subst"}}}}},
                                                                                                    "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                                "type": {"variable": "hydra.core.typing.InferenceResult"}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}},
                                "argument": {
                                  "lambda": {
                                    "parameter": "r",
                                    "domain": {"variable": "hydra.core.model.Term"},
                                    "body": {
                                      "application": {
                                        "function": {
                                          "application": {
                                            "function": {
                                              "typeApplication": {
                                                "body": {
                                                  "typeApplication": {
                                                    "body": {
                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.eithers.bind"}, "type": {"variable": "hydra.core.errors.Error"}}},
                                                    "type": {"variable": "hydra.core.typing.InferenceResult"}}},
                                                "type": {"variable": "hydra.core.typing.InferenceResult"}}},
                                            "argument": {
                                              "application": {
                                                "function": {
                                                  "application": {
                                                    "function": {
                                                      "application": {
                                                        "function": {"application": {"function": {"variable": "hydra.core.inference.inferTypeOfTerm"}, "argument": {"variable": "fcx"}}},
                                                        "argument": {"variable": "cx"}}},
                                                    "argument": {"variable": "r"}}},
                                                "argument": {"literal": {"string": "either right value"}}}}}},
                                        "argument": {
                                          "lambda": {
                                            "parameter": "r1",
                                            "domain": {"variable": "hydra.core.typing.InferenceResult"},
                                            "body": {
                                              "let": {
                                                "bindings": [
                                                  {
                                                    "name": "fcx2",
                                                    "term": {
                                                      "application": {
                                                        "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "context"}},
                                                        "argument": {"variable": "r1"}}},
                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "constraints": []}}],
                                                "body": {
                                                  "let": {
                                                    "bindings": [
                                                      {
                                                        "name": "iterm",
                                                        "term": {
                                                          "application": {
                                                            "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "term"}},
                                                            "argument": {"variable": "r1"}}},
                                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                                    "body": {
                                                      "let": {
                                                        "bindings": [
                                                          {
                                                            "name": "rightType",
                                                            "term": {
                                                              "application": {
                                                                "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "type"}},
                                                                "argument": {"variable": "r1"}}},
                                                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
                                                        "body": {
                                                          "let": {
                                                            "bindings": [
                                                              {
                                                                "name": "subst",
                                                                "term": {
                                                                  "application": {
                                                                    "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "subst"}},
                                                                    "argument": {"variable": "r1"}}},
                                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.TypeSubst"}, "constraints": []}}],
                                                            "body": {
                                                              "let": {
                                                                "bindings": [
                                                                  {
                                                                    "name": "fvResult",
                                                                    "term": {"application": {"function": {"variable": "hydra.core.inference.freshVariableType"}, "argument": {"variable": "fcx2"}}},
                                                                    "typeScheme": {
                                                                      "variables": [],
                                                                      "body": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                      "constraints": []}}],
                                                                "body": {
                                                                  "let": {
                                                                    "bindings": [
                                                                      {
                                                                        "name": "leftType",
                                                                        "term": {
                                                                          "application": {
                                                                            "function": {
                                                                              "typeApplication": {
                                                                                "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                                "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                            "argument": {"variable": "fvResult"}}},
                                                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
                                                                    "body": {
                                                                      "let": {
                                                                        "bindings": [
                                                                          {
                                                                            "name": "fcx3",
                                                                            "term": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "typeApplication": {
                                                                                    "body": {
                                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                                    "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                "argument": {"variable": "fvResult"}}},
                                                                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "constraints": []}}],
                                                                        "body": {
                                                                          "let": {
                                                                            "bindings": [
                                                                              {
                                                                                "name": "eitherTerm",
                                                                                "term": {
                                                                                  "inject": {
                                                                                    "typeName": "hydra.core.model.Term",
                                                                                    "field": {
                                                                                      "name": "either",
                                                                                      "term": {
                                                                                        "typeApplication": {
                                                                                          "body": {
                                                                                            "typeApplication": {"body": {"either": {"right": {"variable": "iterm"}}}, "type": {"variable": "hydra.core.model.Term"}}},
                                                                                          "type": {"variable": "hydra.core.model.Term"}}}}}},
                                                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                                                            "body": {
                                                                              "let": {
                                                                                "bindings": [
                                                                                  {
                                                                                    "name": "termWithLeftType",
                                                                                    "term": {
                                                                                      "inject": {
                                                                                        "typeName": "hydra.core.model.Term",
                                                                                        "field": {
                                                                                          "name": "typeApplication",
                                                                                          "term": {
                                                                                            "record": {
                                                                                              "typeName": "hydra.core.model.TypeApplicationTerm",
                                                                                              "fields": [{"name": "body", "term": {"variable": "eitherTerm"}}, {"name": "type", "term": {"variable": "leftType"}}]}}}}},
                                                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                                                                "body": {
                                                                                  "let": {
                                                                                    "bindings": [
                                                                                      {
                                                                                        "name": "termWithBothTypes",
                                                                                        "term": {
                                                                                          "inject": {
                                                                                            "typeName": "hydra.core.model.Term",
                                                                                            "field": {
                                                                                              "name": "typeApplication",
                                                                                              "term": {
                                                                                                "record": {
                                                                                                  "typeName": "hydra.core.model.TypeApplicationTerm",
                                                                                                  "fields": [{"name": "body", "term": {"variable": "termWithLeftType"}}, {"name": "type", "term": {"variable": "rightType"}}]}}}}},
                                                                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                                                                    "body": {
                                                                                      "let": {
                                                                                        "bindings": [
                                                                                          {
                                                                                            "name": "eitherType",
                                                                                            "term": {
                                                                                              "inject": {
                                                                                                "typeName": "hydra.core.model.Type",
                                                                                                "field": {
                                                                                                  "name": "either",
                                                                                                  "term": {
                                                                                                    "record": {
                                                                                                      "typeName": "hydra.core.model.EitherType",
                                                                                                      "fields": [{"name": "left", "term": {"variable": "leftType"}}, {"name": "right", "term": {"variable": "rightType"}}]}}}}},
                                                                                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
                                                                                        "body": {
                                                                                          "typeApplication": {
                                                                                            "body": {
                                                                                              "typeApplication": {
                                                                                                "body": {
                                                                                                  "either": {
                                                                                                    "right": {
                                                                                                      "application": {
                                                                                                        "function": {
                                                                                                          "application": {
                                                                                                            "function": {
                                                                                                              "application": {
                                                                                                                "function": {"application": {"function": {"variable": "hydra.core.inference.yieldChecked"}, "argument": {"variable": "fcx3"}}},
                                                                                                                "argument": {"variable": "termWithBothTypes"}}},
                                                                                                            "argument": {"variable": "eitherType"}}},
                                                                                                        "argument": {"variable": "subst"}}}}},
                                                                                                "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                            "type": {"variable": "hydra.core.typing.InferenceResult"}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}},
                            "argument": {"variable": "e"}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {
                    "literal": {"string": "Infer the type of an either value (Either version). Paper: inference.tex, rules Eith_L and Eith_R."}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.inference.inferTypeOfInjection",
        "signature": {
          "typeParameters": [],
          "parameters": [
            {"name": "arg0", "type": {"variable": "hydra.core.typing.InferenceContext"}, "isLazy": false},
            {"name": "arg1", "type": {"variable": "hydra.core.graph.Graph"}, "isLazy": false},
            {"name": "arg2", "type": {"variable": "hydra.core.model.Injection"}, "isLazy": false}],
          "result": {
            "type": {
              "either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.typing.InferenceResult"}}}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "fcx",
                "domain": {"variable": "hydra.core.typing.InferenceContext"},
                "body": {
                  "lambda": {
                    "parameter": "cx",
                    "domain": {"variable": "hydra.core.graph.Graph"},
                    "body": {
                      "lambda": {
                        "parameter": "injection",
                        "domain": {"variable": "hydra.core.model.Injection"},
                        "body": {
                          "let": {
                            "bindings": [
                              {
                                "name": "tname",
                                "term": {
                                  "application": {
                                    "function": {"project": {"typeName": "hydra.core.model.Injection", "fieldName": "typeName"}},
                                    "argument": {"variable": "injection"}}},
                                "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": "injection"}}},
                                    "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": "term",
                                            "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": "fcxInj",
                                                "term": {
                                                  "application": {
                                                    "function": {
                                                      "application": {
                                                        "function": {"variable": "hydra.core.names.pushSubtermStep"},
                                                        "argument": {
                                                          "inject": {"typeName": "hydra.core.paths.SubtermStep", "field": {"name": "injectField", "term": {"variable": "fname"}}}}}},
                                                    "argument": {"variable": "fcx"}}},
                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "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.InferenceResult"}}},
                                                        "type": {"variable": "hydra.core.typing.InferenceResult"}}},
                                                    "argument": {
                                                      "application": {
                                                        "function": {
                                                          "application": {
                                                            "function": {
                                                              "application": {
                                                                "function": {"application": {"function": {"variable": "hydra.core.inference.inferTypeOfTerm"}, "argument": {"variable": "fcxInj"}}},
                                                                "argument": {"variable": "cx"}}},
                                                            "argument": {"variable": "term"}}},
                                                        "argument": {"literal": {"string": "injected term"}}}}}},
                                                "argument": {
                                                  "lambda": {
                                                    "parameter": "result",
                                                    "domain": {"variable": "hydra.core.typing.InferenceResult"},
                                                    "body": {
                                                      "let": {
                                                        "bindings": [
                                                          {
                                                            "name": "fcx2",
                                                            "term": {
                                                              "application": {
                                                                "function": {"application": {"function": {"variable": "hydra.core.names.restoreTrace"}, "argument": {"variable": "fcx"}}},
                                                                "argument": {
                                                                  "application": {
                                                                    "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "context"}},
                                                                    "argument": {"variable": "result"}}}}},
                                                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "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": {
                                                                          "pair": {"first": {"variable": "hydra.core.model.TypeScheme"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                    "type": {"variable": "hydra.core.typing.InferenceResult"}}},
                                                                "argument": {
                                                                  "application": {
                                                                    "function": {
                                                                      "application": {
                                                                        "function": {"application": {"function": {"variable": "hydra.core.resolution.requireSchemaType"}, "argument": {"variable": "fcx2"}}},
                                                                        "argument": {
                                                                          "application": {
                                                                            "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "schemaTypes"}},
                                                                            "argument": {"variable": "cx"}}}}},
                                                                    "argument": {"variable": "tname"}}}}},
                                                            "argument": {
                                                              "lambda": {
                                                                "parameter": "stRp",
                                                                "domain": {
                                                                  "pair": {"first": {"variable": "hydra.core.model.TypeScheme"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                "body": {
                                                                  "let": {
                                                                    "bindings": [
                                                                      {
                                                                        "name": "schemaType",
                                                                        "term": {
                                                                          "application": {
                                                                            "function": {
                                                                              "typeApplication": {
                                                                                "body": {
                                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"variable": "hydra.core.model.TypeScheme"}}},
                                                                                "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                            "argument": {"variable": "stRp"}}},
                                                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.TypeScheme"}, "constraints": []}}],
                                                                    "body": {
                                                                      "let": {
                                                                        "bindings": [
                                                                          {
                                                                            "name": "fcx3",
                                                                            "term": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "typeApplication": {
                                                                                    "body": {
                                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"variable": "hydra.core.model.TypeScheme"}}},
                                                                                    "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                "argument": {"variable": "stRp"}}},
                                                                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "constraints": []}}],
                                                                        "body": {
                                                                          "let": {
                                                                            "bindings": [
                                                                              {
                                                                                "name": "svars",
                                                                                "term": {
                                                                                  "application": {
                                                                                    "function": {"project": {"typeName": "hydra.core.model.TypeScheme", "fieldName": "variables"}},
                                                                                    "argument": {"variable": "schemaType"}}},
                                                                                "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Name"}}, "constraints": []}}],
                                                                            "body": {
                                                                              "let": {
                                                                                "bindings": [
                                                                                  {
                                                                                    "name": "stype",
                                                                                    "term": {
                                                                                      "application": {
                                                                                        "function": {"project": {"typeName": "hydra.core.model.TypeScheme", "fieldName": "body"}},
                                                                                        "argument": {"variable": "schemaType"}}},
                                                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
                                                                                "body": {
                                                                                  "let": {
                                                                                    "bindings": [
                                                                                      {
                                                                                        "name": "iterm",
                                                                                        "term": {
                                                                                          "application": {
                                                                                            "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "term"}},
                                                                                            "argument": {"variable": "result"}}},
                                                                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                                                                    "body": {
                                                                                      "let": {
                                                                                        "bindings": [
                                                                                          {
                                                                                            "name": "ityp",
                                                                                            "term": {
                                                                                              "application": {
                                                                                                "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "type"}},
                                                                                                "argument": {"variable": "result"}}},
                                                                                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
                                                                                        "body": {
                                                                                          "let": {
                                                                                            "bindings": [
                                                                                              {
                                                                                                "name": "isubst",
                                                                                                "term": {
                                                                                                  "application": {
                                                                                                    "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "subst"}},
                                                                                                    "argument": {"variable": "result"}}},
                                                                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.TypeSubst"}, "constraints": []}}],
                                                                                            "body": {
                                                                                              "let": {
                                                                                                "bindings": [
                                                                                                  {
                                                                                                    "name": "iconstraints",
                                                                                                    "term": {
                                                                                                      "application": {
                                                                                                        "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "classConstraints"}},
                                                                                                        "argument": {"variable": "result"}}},
                                                                                                    "typeScheme": {
                                                                                                      "variables": [],
                                                                                                      "body": {
                                                                                                        "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}},
                                                                                                      "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": {"variable": "hydra.core.typing.InferenceResult"}}},
                                                                                                        "argument": {
                                                                                                          "application": {
                                                                                                            "function": {
                                                                                                              "application": {
                                                                                                                "function": {
                                                                                                                  "typeApplication": {"body": {"variable": "hydra.core.extract.model.unionType"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                                "argument": {"variable": "tname"}}},
                                                                                                            "argument": {"variable": "stype"}}}}},
                                                                                                    "argument": {
                                                                                                      "lambda": {
                                                                                                        "parameter": "sfields",
                                                                                                        "domain": {"list": {"variable": "hydra.core.model.FieldType"}},
                                                                                                        "body": {
                                                                                                          "application": {
                                                                                                            "function": {
                                                                                                              "application": {
                                                                                                                "function": {
                                                                                                                  "typeApplication": {
                                                                                                                    "body": {
                                                                                                                      "typeApplication": {
                                                                                                                        "body": {
                                                                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.eithers.bind"}, "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                                                        "type": {"variable": "hydra.core.model.Type"}}},
                                                                                                                    "type": {"variable": "hydra.core.typing.InferenceResult"}}},
                                                                                                                "argument": {
                                                                                                                  "application": {
                                                                                                                    "function": {
                                                                                                                      "application": {
                                                                                                                        "function": {
                                                                                                                          "application": {
                                                                                                                            "function": {
                                                                                                                              "typeApplication": {
                                                                                                                                "body": {"variable": "hydra.core.resolution.findFieldType"},
                                                                                                                                "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                                                            "argument": {"variable": "fcx3"}}},
                                                                                                                        "argument": {"variable": "fname"}}},
                                                                                                                    "argument": {"variable": "sfields"}}}}},
                                                                                                            "argument": {
                                                                                                              "lambda": {
                                                                                                                "parameter": "ftyp",
                                                                                                                "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.typing.InferenceResult"}}},
                                                                                                                            "type": {"variable": "hydra.core.typing.InferenceResult"}}},
                                                                                                                        "argument": {
                                                                                                                          "application": {
                                                                                                                            "function": {
                                                                                                                              "application": {
                                                                                                                                "function": {
                                                                                                                                  "application": {
                                                                                                                                    "function": {
                                                                                                                                      "application": {
                                                                                                                                        "function": {
                                                                                                                                          "typeApplication": {"body": {"variable": "hydra.core.inference.mapConstraints"}, "type": {"variable": "hydra.core.typing.InferenceResult"}}},
                                                                                                                                        "argument": {"variable": "fcx3"}}},
                                                                                                                                    "argument": {"variable": "cx"}}},
                                                                                                                                "argument": {
                                                                                                                                  "lambda": {
                                                                                                                                    "parameter": "subst",
                                                                                                                                    "domain": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                                                    "body": {
                                                                                                                                      "application": {
                                                                                                                                        "function": {
                                                                                                                                          "application": {
                                                                                                                                            "function": {
                                                                                                                                              "application": {
                                                                                                                                                "function": {
                                                                                                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.logic.ifElse"}, "type": {"variable": "hydra.core.typing.InferenceResult"}}},
                                                                                                                                                "argument": {
                                                                                                                                                  "application": {
                                                                                                                                                    "function": {
                                                                                                                                                      "typeApplication": {
                                                                                                                                                        "body": {
                                                                                                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.maps.isEmpty"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                                                                        "type": {"variable": "hydra.core.model.TypeVariableConstraints"}}},
                                                                                                                                                    "argument": {"variable": "iconstraints"}}}}},
                                                                                                                                            "argument": {
                                                                                                                                              "application": {
                                                                                                                                                "function": {
                                                                                                                                                  "application": {
                                                                                                                                                    "function": {
                                                                                                                                                      "application": {
                                                                                                                                                        "function": {"application": {"function": {"variable": "hydra.core.inference.yield"}, "argument": {"variable": "fcx3"}}},
                                                                                                                                                        "argument": {
                                                                                                                                                          "application": {
                                                                                                                                                            "function": {
                                                                                                                                                              "application": {"function": {"variable": "hydra.core.inference.buildTypeApplicationTerm"}, "argument": {"variable": "svars"}}},
                                                                                                                                                            "argument": {
                                                                                                                                                              "inject": {
                                                                                                                                                                "typeName": "hydra.core.model.Term",
                                                                                                                                                                "field": {
                                                                                                                                                                  "name": "inject",
                                                                                                                                                                  "term": {
                                                                                                                                                                    "record": {
                                                                                                                                                                      "typeName": "hydra.core.model.Injection",
                                                                                                                                                                      "fields": [
                                                                                                                                                                        {"name": "typeName", "term": {"variable": "tname"}},
                                                                                                                                                                        {
                                                                                                                                                                          "name": "field",
                                                                                                                                                                          "term": {
                                                                                                                                                                            "record": {
                                                                                                                                                                              "typeName": "hydra.core.model.Field",
                                                                                                                                                                              "fields": [{"name": "name", "term": {"variable": "fname"}}, {"name": "term", "term": {"variable": "iterm"}}]}}}]}}}}}}}}},
                                                                                                                                                    "argument": {
                                                                                                                                                      "application": {
                                                                                                                                                        "function": {
                                                                                                                                                          "application": {"function": {"variable": "hydra.core.resolution.nominalApplication"}, "argument": {"variable": "tname"}}},
                                                                                                                                                        "argument": {
                                                                                                                                                          "application": {
                                                                                                                                                            "function": {
                                                                                                                                                              "application": {
                                                                                                                                                                "function": {
                                                                                                                                                                  "typeApplication": {
                                                                                                                                                                    "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                                                                                    "type": {"variable": "hydra.core.model.Type"}}},
                                                                                                                                                                "argument": {
                                                                                                                                                                  "lambda": {
                                                                                                                                                                    "parameter": "x",
                                                                                                                                                                    "domain": {"variable": "hydra.core.model.Name"},
                                                                                                                                                                    "body": {"inject": {"typeName": "hydra.core.model.Type", "field": {"name": "variable", "term": {"variable": "x"}}}}}}}},
                                                                                                                                                            "argument": {"variable": "svars"}}}}}}},
                                                                                                                                                "argument": {
                                                                                                                                                  "application": {
                                                                                                                                                    "function": {
                                                                                                                                                      "application": {"function": {"variable": "hydra.core.substitution.composeTypeSubst"}, "argument": {"variable": "isubst"}}},
                                                                                                                                                    "argument": {"variable": "subst"}}}}}}},
                                                                                                                                        "argument": {
                                                                                                                                          "application": {
                                                                                                                                            "function": {
                                                                                                                                              "application": {
                                                                                                                                                "function": {
                                                                                                                                                  "application": {
                                                                                                                                                    "function": {
                                                                                                                                                      "application": {
                                                                                                                                                        "function": {
                                                                                                                                                          "application": {"function": {"variable": "hydra.core.inference.yieldWithConstraints"}, "argument": {"variable": "fcx3"}}},
                                                                                                                                                        "argument": {
                                                                                                                                                          "application": {
                                                                                                                                                            "function": {
                                                                                                                                                              "application": {"function": {"variable": "hydra.core.inference.buildTypeApplicationTerm"}, "argument": {"variable": "svars"}}},
                                                                                                                                                            "argument": {
                                                                                                                                                              "inject": {
                                                                                                                                                                "typeName": "hydra.core.model.Term",
                                                                                                                                                                "field": {
                                                                                                                                                                  "name": "inject",
                                                                                                                                                                  "term": {
                                                                                                                                                                    "record": {
                                                                                                                                                                      "typeName": "hydra.core.model.Injection",
                                                                                                                                                                      "fields": [
                                                                                                                                                                        {"name": "typeName", "term": {"variable": "tname"}},
                                                                                                                                                                        {
                                                                                                                                                                          "name": "field",
                                                                                                                                                                          "term": {
                                                                                                                                                                            "record": {
                                                                                                                                                                              "typeName": "hydra.core.model.Field",
                                                                                                                                                                              "fields": [{"name": "name", "term": {"variable": "fname"}}, {"name": "term", "term": {"variable": "iterm"}}]}}}]}}}}}}}}},
                                                                                                                                                    "argument": {
                                                                                                                                                      "application": {
                                                                                                                                                        "function": {
                                                                                                                                                          "application": {"function": {"variable": "hydra.core.resolution.nominalApplication"}, "argument": {"variable": "tname"}}},
                                                                                                                                                        "argument": {
                                                                                                                                                          "application": {
                                                                                                                                                            "function": {
                                                                                                                                                              "application": {
                                                                                                                                                                "function": {
                                                                                                                                                                  "typeApplication": {
                                                                                                                                                                    "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                                                                                    "type": {"variable": "hydra.core.model.Type"}}},
                                                                                                                                                                "argument": {
                                                                                                                                                                  "lambda": {
                                                                                                                                                                    "parameter": "x",
                                                                                                                                                                    "domain": {"variable": "hydra.core.model.Name"},
                                                                                                                                                                    "body": {"inject": {"typeName": "hydra.core.model.Type", "field": {"name": "variable", "term": {"variable": "x"}}}}}}}},
                                                                                                                                                            "argument": {"variable": "svars"}}}}}}},
                                                                                                                                                "argument": {
                                                                                                                                                  "application": {
                                                                                                                                                    "function": {
                                                                                                                                                      "application": {"function": {"variable": "hydra.core.substitution.composeTypeSubst"}, "argument": {"variable": "isubst"}}},
                                                                                                                                                    "argument": {"variable": "subst"}}}}},
                                                                                                                                            "argument": {
                                                                                                                                              "application": {
                                                                                                                                                "function": {
                                                                                                                                                  "application": {"function": {"variable": "hydra.core.substitution.substInClassConstraints"}, "argument": {"variable": "subst"}}},
                                                                                                                                                "argument": {"variable": "iconstraints"}}}}}}}}}}},
                                                                                                                            "argument": {
                                                                                                                              "list": [
                                                                                                                                {
                                                                                                                                  "record": {
                                                                                                                                    "typeName": "hydra.core.typing.TypeConstraint",
                                                                                                                                    "fields": [
                                                                                                                                      {"name": "left", "term": {"variable": "ftyp"}},
                                                                                                                                      {"name": "right", "term": {"variable": "ityp"}},
                                                                                                                                      {"name": "comment", "term": {"literal": {"string": "schema type of injected field"}}}]}}]}}}}},
                                                                                                                    "argument": {
                                                                                                                      "lambda": {
                                                                                                                        "parameter": "mcResult",
                                                                                                                        "domain": {"variable": "hydra.core.typing.InferenceResult"},
                                                                                                                        "body": {
                                                                                                                          "typeApplication": {
                                                                                                                            "body": {
                                                                                                                              "typeApplication": {"body": {"either": {"right": {"variable": "mcResult"}}}, "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                                                            "type": {"variable": "hydra.core.typing.InferenceResult"}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {"literal": {"string": "Infer the type of a union injection (Either version). Paper: inference.tex, rule Inj."}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.inference.inferTypeOfLambda",
        "signature": {
          "typeParameters": [],
          "parameters": [
            {"name": "arg0", "type": {"variable": "hydra.core.typing.InferenceContext"}, "isLazy": false},
            {"name": "arg1", "type": {"variable": "hydra.core.graph.Graph"}, "isLazy": false},
            {"name": "arg2", "type": {"variable": "hydra.core.model.Lambda"}, "isLazy": false}],
          "result": {
            "type": {
              "either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.typing.InferenceResult"}}}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "fcx",
                "domain": {"variable": "hydra.core.typing.InferenceContext"},
                "body": {
                  "lambda": {
                    "parameter": "cx",
                    "domain": {"variable": "hydra.core.graph.Graph"},
                    "body": {
                      "lambda": {
                        "parameter": "lambda",
                        "domain": {"variable": "hydra.core.model.Lambda"},
                        "body": {
                          "let": {
                            "bindings": [
                              {
                                "name": "var",
                                "term": {
                                  "application": {
                                    "function": {"project": {"typeName": "hydra.core.model.Lambda", "fieldName": "parameter"}},
                                    "argument": {"variable": "lambda"}}},
                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Name"}, "constraints": []}}],
                            "body": {
                              "let": {
                                "bindings": [
                                  {
                                    "name": "body",
                                    "term": {
                                      "application": {
                                        "function": {"project": {"typeName": "hydra.core.model.Lambda", "fieldName": "body"}},
                                        "argument": {"variable": "lambda"}}},
                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                "body": {
                                  "let": {
                                    "bindings": [
                                      {
                                        "name": "vdomResult",
                                        "term": {"application": {"function": {"variable": "hydra.core.names.freshName"}, "argument": {"variable": "fcx"}}},
                                        "typeScheme": {
                                          "variables": [],
                                          "body": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}},
                                          "constraints": []}}],
                                    "body": {
                                      "let": {
                                        "bindings": [
                                          {
                                            "name": "vdom",
                                            "term": {
                                              "application": {
                                                "function": {
                                                  "typeApplication": {
                                                    "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                    "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                "argument": {"variable": "vdomResult"}}},
                                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Name"}, "constraints": []}}],
                                        "body": {
                                          "let": {
                                            "bindings": [
                                              {
                                                "name": "fcx2",
                                                "term": {
                                                  "application": {
                                                    "function": {
                                                      "typeApplication": {
                                                        "body": {
                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                        "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                    "argument": {"variable": "vdomResult"}}},
                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "constraints": []}}],
                                            "body": {
                                              "let": {
                                                "bindings": [
                                                  {
                                                    "name": "dom",
                                                    "term": {"inject": {"typeName": "hydra.core.model.Type", "field": {"name": "variable", "term": {"variable": "vdom"}}}},
                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
                                                "body": {
                                                  "let": {
                                                    "bindings": [
                                                      {
                                                        "name": "cx2",
                                                        "term": {
                                                          "application": {
                                                            "function": {
                                                              "application": {
                                                                "function": {"variable": "hydra.core.inference.extendContext"},
                                                                "argument": {
                                                                  "list": [
                                                                    {
                                                                      "typeApplication": {
                                                                        "body": {
                                                                          "typeApplication": {
                                                                            "body": {
                                                                              "pair": {
                                                                                "first": {"variable": "var"},
                                                                                "second": {
                                                                                  "record": {
                                                                                    "typeName": "hydra.core.model.TypeScheme",
                                                                                    "fields": [
                                                                                      {
                                                                                        "name": "variables",
                                                                                        "term": {"typeApplication": {"body": {"list": []}, "type": {"variable": "hydra.core.model.Name"}}}},
                                                                                      {"name": "body", "term": {"variable": "dom"}},
                                                                                      {
                                                                                        "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"}}}}]}}}},
                                                                            "type": {"variable": "hydra.core.model.Name"}}},
                                                                        "type": {"variable": "hydra.core.model.TypeScheme"}}}]}}},
                                                            "argument": {"variable": "cx"}}},
                                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.graph.Graph"}, "constraints": []}}],
                                                    "body": {
                                                      "let": {
                                                        "bindings": [
                                                          {
                                                            "name": "fcxBody",
                                                            "term": {
                                                              "application": {
                                                                "function": {
                                                                  "application": {
                                                                    "function": {"variable": "hydra.core.names.pushSubtermStep"},
                                                                    "argument": {"inject": {"typeName": "hydra.core.paths.SubtermStep", "field": {"name": "lambdaBody", "term": "unit"}}}}},
                                                                "argument": {"variable": "fcx2"}}},
                                                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "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.InferenceResult"}}},
                                                                    "type": {"variable": "hydra.core.typing.InferenceResult"}}},
                                                                "argument": {
                                                                  "application": {
                                                                    "function": {
                                                                      "application": {
                                                                        "function": {
                                                                          "application": {
                                                                            "function": {"application": {"function": {"variable": "hydra.core.inference.inferTypeOfTerm"}, "argument": {"variable": "fcxBody"}}},
                                                                            "argument": {"variable": "cx2"}}},
                                                                        "argument": {"variable": "body"}}},
                                                                    "argument": {"literal": {"string": "lambda body"}}}}}},
                                                            "argument": {
                                                              "lambda": {
                                                                "parameter": "result",
                                                                "domain": {"variable": "hydra.core.typing.InferenceResult"},
                                                                "body": {
                                                                  "let": {
                                                                    "bindings": [
                                                                      {
                                                                        "name": "fcx3",
                                                                        "term": {
                                                                          "application": {
                                                                            "function": {"application": {"function": {"variable": "hydra.core.names.restoreTrace"}, "argument": {"variable": "fcx2"}}},
                                                                            "argument": {
                                                                              "application": {
                                                                                "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "context"}},
                                                                                "argument": {"variable": "result"}}}}},
                                                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "constraints": []}}],
                                                                    "body": {
                                                                      "let": {
                                                                        "bindings": [
                                                                          {
                                                                            "name": "iterm",
                                                                            "term": {
                                                                              "application": {
                                                                                "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "term"}},
                                                                                "argument": {"variable": "result"}}},
                                                                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                                                        "body": {
                                                                          "let": {
                                                                            "bindings": [
                                                                              {
                                                                                "name": "icod",
                                                                                "term": {
                                                                                  "application": {
                                                                                    "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "type"}},
                                                                                    "argument": {"variable": "result"}}},
                                                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
                                                                            "body": {
                                                                              "let": {
                                                                                "bindings": [
                                                                                  {
                                                                                    "name": "isubst",
                                                                                    "term": {
                                                                                      "application": {
                                                                                        "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "subst"}},
                                                                                        "argument": {"variable": "result"}}},
                                                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.TypeSubst"}, "constraints": []}}],
                                                                                "body": {
                                                                                  "let": {
                                                                                    "bindings": [
                                                                                      {
                                                                                        "name": "rdom",
                                                                                        "term": {
                                                                                          "application": {
                                                                                            "function": {"application": {"function": {"variable": "hydra.core.substitution.substInType"}, "argument": {"variable": "isubst"}}},
                                                                                            "argument": {"variable": "dom"}}},
                                                                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
                                                                                    "body": {
                                                                                      "let": {
                                                                                        "bindings": [
                                                                                          {
                                                                                            "name": "rterm",
                                                                                            "term": {
                                                                                              "inject": {
                                                                                                "typeName": "hydra.core.model.Term",
                                                                                                "field": {
                                                                                                  "name": "lambda",
                                                                                                  "term": {
                                                                                                    "record": {
                                                                                                      "typeName": "hydra.core.model.Lambda",
                                                                                                      "fields": [
                                                                                                        {"name": "parameter", "term": {"variable": "var"}},
                                                                                                        {"name": "domain", "term": {"optional": {"variable": "rdom"}}},
                                                                                                        {"name": "body", "term": {"variable": "iterm"}}]}}}}},
                                                                                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                                                                        "body": {
                                                                                          "let": {
                                                                                            "bindings": [
                                                                                              {
                                                                                                "name": "rtype",
                                                                                                "term": {
                                                                                                  "inject": {
                                                                                                    "typeName": "hydra.core.model.Type",
                                                                                                    "field": {
                                                                                                      "name": "function",
                                                                                                      "term": {
                                                                                                        "record": {
                                                                                                          "typeName": "hydra.core.model.FunctionType",
                                                                                                          "fields": [{"name": "domain", "term": {"variable": "rdom"}}, {"name": "codomain", "term": {"variable": "icod"}}]}}}}},
                                                                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
                                                                                            "body": {
                                                                                              "let": {
                                                                                                "bindings": [
                                                                                                  {
                                                                                                    "name": "vars",
                                                                                                    "term": {
                                                                                                      "application": {
                                                                                                        "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.unions"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                        "argument": {
                                                                                                          "list": [
                                                                                                            {
                                                                                                              "application": {"function": {"variable": "hydra.core.variables.freeVariablesInType"}, "argument": {"variable": "rdom"}}},
                                                                                                            {
                                                                                                              "application": {"function": {"variable": "hydra.core.variables.freeVariablesInType"}, "argument": {"variable": "icod"}}},
                                                                                                            {
                                                                                                              "application": {
                                                                                                                "function": {"variable": "hydra.core.inference.freeVariablesInContext"},
                                                                                                                "argument": {
                                                                                                                  "application": {
                                                                                                                    "function": {
                                                                                                                      "application": {"function": {"variable": "hydra.core.substitution.substInContext"}, "argument": {"variable": "isubst"}}},
                                                                                                                    "argument": {"variable": "cx2"}}}}}]}}},
                                                                                                    "typeScheme": {"variables": [], "body": {"set": {"variable": "hydra.core.model.Name"}}, "constraints": []}}],
                                                                                                "body": {
                                                                                                  "let": {
                                                                                                    "bindings": [
                                                                                                      {
                                                                                                        "name": "cx3",
                                                                                                        "term": {
                                                                                                          "application": {
                                                                                                            "function": {
                                                                                                              "application": {"function": {"variable": "hydra.core.substitution.substInContext"}, "argument": {"variable": "isubst"}}},
                                                                                                            "argument": {"variable": "cx"}}},
                                                                                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.graph.Graph"}, "constraints": []}}],
                                                                                                    "body": {
                                                                                                      "let": {
                                                                                                        "bindings": [
                                                                                                          {
                                                                                                            "name": "iconstraints",
                                                                                                            "term": {
                                                                                                              "application": {
                                                                                                                "function": {
                                                                                                                  "application": {"function": {"variable": "hydra.core.substitution.substInClassConstraints"}, "argument": {"variable": "isubst"}}},
                                                                                                                "argument": {
                                                                                                                  "application": {
                                                                                                                    "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "classConstraints"}},
                                                                                                                    "argument": {"variable": "result"}}}}},
                                                                                                            "typeScheme": {
                                                                                                              "variables": [],
                                                                                                              "body": {
                                                                                                                "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}},
                                                                                                              "constraints": []}}],
                                                                                                        "body": {
                                                                                                          "typeApplication": {
                                                                                                            "body": {
                                                                                                              "typeApplication": {
                                                                                                                "body": {
                                                                                                                  "either": {
                                                                                                                    "right": {
                                                                                                                      "record": {
                                                                                                                        "typeName": "hydra.core.typing.InferenceResult",
                                                                                                                        "fields": [
                                                                                                                          {"name": "term", "term": {"variable": "rterm"}},
                                                                                                                          {"name": "type", "term": {"variable": "rtype"}},
                                                                                                                          {"name": "subst", "term": {"variable": "isubst"}},
                                                                                                                          {"name": "classConstraints", "term": {"variable": "iconstraints"}},
                                                                                                                          {"name": "context", "term": {"variable": "fcx3"}}]}}}},
                                                                                                                "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                                            "type": {"variable": "hydra.core.typing.InferenceResult"}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {
                    "literal": {"string": "Infer the type of a lambda function (Either version). Paper: inference.tex, rule Abs (elaboration form)."}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.inference.inferTypeOfLet",
        "signature": {
          "typeParameters": [],
          "parameters": [
            {"name": "arg0", "type": {"variable": "hydra.core.typing.InferenceContext"}, "isLazy": false},
            {"name": "arg1", "type": {"variable": "hydra.core.graph.Graph"}, "isLazy": false},
            {"name": "arg2", "type": {"variable": "hydra.core.model.Let"}, "isLazy": false}],
          "result": {
            "type": {
              "either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.typing.InferenceResult"}}}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "fcx0",
                "domain": {"variable": "hydra.core.typing.InferenceContext"},
                "body": {
                  "lambda": {
                    "parameter": "cx",
                    "domain": {"variable": "hydra.core.graph.Graph"},
                    "body": {
                      "lambda": {
                        "parameter": "let0",
                        "domain": {"variable": "hydra.core.model.Let"},
                        "body": {
                          "let": {
                            "bindings": [
                              {
                                "name": "fcx",
                                "term": {"variable": "fcx0"},
                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "constraints": []}}],
                            "body": {
                              "let": {
                                "bindings": [
                                  {
                                    "name": "bindings0",
                                    "term": {
                                      "application": {
                                        "function": {"project": {"typeName": "hydra.core.model.Let", "fieldName": "bindings"}},
                                        "argument": {"variable": "let0"}}},
                                    "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Binding"}}, "constraints": []}}],
                                "body": {
                                  "let": {
                                    "bindings": [
                                      {
                                        "name": "body0",
                                        "term": {
                                          "application": {"function": {"project": {"typeName": "hydra.core.model.Let", "fieldName": "body"}}, "argument": {"variable": "let0"}}},
                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                    "body": {
                                      "let": {
                                        "bindings": [
                                          {
                                            "name": "names",
                                            "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.Name"}}},
                                                    "argument": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "name"}}}},
                                                "argument": {"variable": "bindings0"}}},
                                            "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Name"}}, "constraints": []}}],
                                        "body": {
                                          "let": {
                                            "bindings": [
                                              {
                                                "name": "nameSet",
                                                "term": {
                                                  "application": {
                                                    "function": {
                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.sets.fromList"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                    "argument": {"variable": "names"}}},
                                                "typeScheme": {"variables": [], "body": {"set": {"variable": "hydra.core.model.Name"}}, "constraints": []}}],
                                            "body": {
                                              "let": {
                                                "bindings": [
                                                  {
                                                    "name": "toPair",
                                                    "term": {
                                                      "lambda": {
                                                        "parameter": "binding",
                                                        "domain": {"variable": "hydra.core.model.Binding"},
                                                        "body": {
                                                          "let": {
                                                            "bindings": [
                                                              {
                                                                "name": "name",
                                                                "term": {
                                                                  "application": {
                                                                    "function": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "name"}},
                                                                    "argument": {"variable": "binding"}}},
                                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Name"}, "constraints": []}}],
                                                            "body": {
                                                              "let": {
                                                                "bindings": [
                                                                  {
                                                                    "name": "term",
                                                                    "term": {
                                                                      "application": {
                                                                        "function": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "term"}},
                                                                        "argument": {"variable": "binding"}}},
                                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                                                "body": {
                                                                  "typeApplication": {
                                                                    "body": {
                                                                      "typeApplication": {
                                                                        "body": {
                                                                          "pair": {
                                                                            "first": {"variable": "name"},
                                                                            "second": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "application": {
                                                                                    "function": {
                                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.lists.filter"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                    "argument": {
                                                                                      "lambda": {
                                                                                        "parameter": "n",
                                                                                        "domain": {"variable": "hydra.core.model.Name"},
                                                                                        "body": {
                                                                                          "application": {
                                                                                            "function": {
                                                                                              "application": {
                                                                                                "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.member"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                "argument": {"variable": "n"}}},
                                                                                            "argument": {"variable": "nameSet"}}}}}}},
                                                                                "argument": {
                                                                                  "application": {
                                                                                    "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.toList"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                    "argument": {
                                                                                      "application": {"function": {"variable": "hydra.core.variables.freeVariablesInTerm"}, "argument": {"variable": "term"}}}}}}}}},
                                                                        "type": {"variable": "hydra.core.model.Name"}}},
                                                                    "type": {"list": {"variable": "hydra.core.model.Name"}}}}}}}}}},
                                                    "typeScheme": {
                                                      "variables": [],
                                                      "body": {
                                                        "function": {
                                                          "domain": {"variable": "hydra.core.model.Binding"},
                                                          "codomain": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"list": {"variable": "hydra.core.model.Name"}}}}}},
                                                      "constraints": []}}],
                                                "body": {
                                                  "let": {
                                                    "bindings": [
                                                      {
                                                        "name": "adjList",
                                                        "term": {
                                                          "application": {
                                                            "function": {
                                                              "application": {
                                                                "function": {
                                                                  "typeApplication": {
                                                                    "body": {
                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.model.Binding"}}},
                                                                    "type": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"list": {"variable": "hydra.core.model.Name"}}}}}},
                                                                "argument": {"variable": "toPair"}}},
                                                            "argument": {"variable": "bindings0"}}},
                                                        "typeScheme": {
                                                          "variables": [],
                                                          "body": {
                                                            "list": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"list": {"variable": "hydra.core.model.Name"}}}}},
                                                          "constraints": []}}],
                                                    "body": {
                                                      "let": {
                                                        "bindings": [
                                                          {
                                                            "name": "groups",
                                                            "term": {
                                                              "application": {
                                                                "function": {
                                                                  "typeApplication": {"body": {"variable": "hydra.core.sorting.topologicalSortComponents"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                "argument": {"variable": "adjList"}}},
                                                            "typeScheme": {"variables": [], "body": {"list": {"list": {"variable": "hydra.core.model.Name"}}}, "constraints": []}}],
                                                        "body": {
                                                          "let": {
                                                            "bindings": [
                                                              {
                                                                "name": "bindingMap",
                                                                "term": {
                                                                  "application": {
                                                                    "function": {
                                                                      "typeApplication": {
                                                                        "body": {
                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.maps.fromList"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                        "type": {"variable": "hydra.core.model.Binding"}}},
                                                                    "argument": {
                                                                      "application": {
                                                                        "function": {
                                                                          "application": {
                                                                            "function": {
                                                                              "typeApplication": {
                                                                                "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.zip"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                "type": {"variable": "hydra.core.model.Binding"}}},
                                                                            "argument": {"variable": "names"}}},
                                                                        "argument": {"variable": "bindings0"}}}}},
                                                                "typeScheme": {
                                                                  "variables": [],
                                                                  "body": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.Binding"}}},
                                                                  "constraints": []}}],
                                                            "body": {
                                                              "let": {
                                                                "bindings": [
                                                                  {
                                                                    "name": "createLet",
                                                                    "term": {
                                                                      "lambda": {
                                                                        "parameter": "e",
                                                                        "domain": {"variable": "hydra.core.model.Term"},
                                                                        "body": {
                                                                          "lambda": {
                                                                            "parameter": "group",
                                                                            "domain": {"list": {"variable": "hydra.core.model.Name"}},
                                                                            "body": {
                                                                              "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.optionals.givens"}, "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.Name"}}},
                                                                                                          "type": {"optional": {"variable": "hydra.core.model.Binding"}}}},
                                                                                                      "argument": {
                                                                                                        "lambda": {
                                                                                                          "parameter": "n",
                                                                                                          "domain": {"variable": "hydra.core.model.Name"},
                                                                                                          "body": {
                                                                                                            "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.Binding"}}},
                                                                                                                  "argument": {"variable": "n"}}},
                                                                                                              "argument": {"variable": "bindingMap"}}}}}}},
                                                                                                  "argument": {"variable": "group"}}}}}},
                                                                                        {"name": "body", "term": {"variable": "e"}}]}}}}}}}}},
                                                                    "typeScheme": {
                                                                      "variables": [],
                                                                      "body": {
                                                                        "function": {
                                                                          "domain": {"variable": "hydra.core.model.Term"},
                                                                          "codomain": {
                                                                            "function": {"domain": {"list": {"variable": "hydra.core.model.Name"}}, "codomain": {"variable": "hydra.core.model.Term"}}}}},
                                                                      "constraints": []}}],
                                                                "body": {
                                                                  "let": {
                                                                    "bindings": [
                                                                      {
                                                                        "name": "rewrittenLet",
                                                                        "term": {
                                                                          "application": {
                                                                            "function": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "application": {
                                                                                    "function": {
                                                                                      "typeApplication": {
                                                                                        "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.foldl"}, "type": {"variable": "hydra.core.model.Term"}}},
                                                                                        "type": {"list": {"variable": "hydra.core.model.Name"}}}},
                                                                                    "argument": {"variable": "createLet"}}},
                                                                                "argument": {"variable": "body0"}}},
                                                                            "argument": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.lists.reverse"}, "type": {"list": {"variable": "hydra.core.model.Name"}}}},
                                                                                "argument": {"variable": "groups"}}}}},
                                                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                                                    "body": {
                                                                      "let": {
                                                                        "bindings": [
                                                                          {
                                                                            "name": "restoreLet",
                                                                            "term": {
                                                                              "lambda": {
                                                                                "parameter": "iterm",
                                                                                "domain": {"variable": "hydra.core.model.Term"},
                                                                                "body": {
                                                                                  "let": {
                                                                                    "bindings": [
                                                                                      {
                                                                                        "name": "helper",
                                                                                        "term": {
                                                                                          "lambda": {
                                                                                            "parameter": "level",
                                                                                            "domain": {"literal": {"integer": "int32"}},
                                                                                            "body": {
                                                                                              "lambda": {
                                                                                                "parameter": "bins",
                                                                                                "domain": {"list": {"variable": "hydra.core.model.Binding"}},
                                                                                                "body": {
                                                                                                  "lambda": {
                                                                                                    "parameter": "term",
                                                                                                    "domain": {"variable": "hydra.core.model.Term"},
                                                                                                    "body": {
                                                                                                      "let": {
                                                                                                        "bindings": [
                                                                                                          {
                                                                                                            "name": "nonzero",
                                                                                                            "term": {
                                                                                                              "lambda": {
                                                                                                                "parameter": "term",
                                                                                                                "domain": {"variable": "hydra.core.model.Term"},
                                                                                                                "body": {
                                                                                                                  "application": {
                                                                                                                    "function": {
                                                                                                                      "cases": {
                                                                                                                        "typeName": "hydra.core.model.Term",
                                                                                                                        "cases": [
                                                                                                                          {
                                                                                                                            "name": "let",
                                                                                                                            "handler": {
                                                                                                                              "lambda": {
                                                                                                                                "parameter": "l",
                                                                                                                                "domain": {"variable": "hydra.core.model.Let"},
                                                                                                                                "body": {
                                                                                                                                  "let": {
                                                                                                                                    "bindings": [
                                                                                                                                      {
                                                                                                                                        "name": "bs",
                                                                                                                                        "term": {
                                                                                                                                          "application": {"function": {"project": {"typeName": "hydra.core.model.Let", "fieldName": "bindings"}}, "argument": {"variable": "l"}}},
                                                                                                                                        "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Binding"}}, "constraints": []}}],
                                                                                                                                    "body": {
                                                                                                                                      "let": {
                                                                                                                                        "bindings": [
                                                                                                                                          {
                                                                                                                                            "name": "letBody",
                                                                                                                                            "term": {
                                                                                                                                              "application": {"function": {"project": {"typeName": "hydra.core.model.Let", "fieldName": "body"}}, "argument": {"variable": "l"}}},
                                                                                                                                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                                                                                                                        "body": {
                                                                                                                                          "application": {
                                                                                                                                            "function": {
                                                                                                                                              "application": {
                                                                                                                                                "function": {
                                                                                                                                                  "application": {
                                                                                                                                                    "function": {"variable": "helper"},
                                                                                                                                                    "argument": {
                                                                                                                                                      "application": {
                                                                                                                                                        "function": {
                                                                                                                                                          "application": {
                                                                                                                                                            "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.math.sub"}, "type": {"literal": {"integer": "int32"}}}},
                                                                                                                                                            "argument": {"variable": "level"}}},
                                                                                                                                                        "argument": {"literal": {"integer": {"int32": 1}}}}}}},
                                                                                                                                                "argument": {
                                                                                                                                                  "application": {
                                                                                                                                                    "function": {
                                                                                                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.lists.concat"}, "type": {"variable": "hydra.core.model.Binding"}}},
                                                                                                                                                    "argument": {"list": [{"variable": "bs"}, {"variable": "bins"}]}}}}},
                                                                                                                                            "argument": {"variable": "letBody"}}}}}}}}}}]}},
                                                                                                                    "argument": {"variable": "term"}}}}},
                                                                                                            "typeScheme": {
                                                                                                              "variables": [],
                                                                                                              "body": {
                                                                                                                "function": {
                                                                                                                  "domain": {"variable": "hydra.core.model.Term"},
                                                                                                                  "codomain": {"pair": {"first": {"list": {"variable": "hydra.core.model.Binding"}}, "second": {"variable": "hydra.core.model.Term"}}}}},
                                                                                                              "constraints": []}}],
                                                                                                        "body": {
                                                                                                          "application": {
                                                                                                            "function": {
                                                                                                              "application": {
                                                                                                                "function": {
                                                                                                                  "application": {
                                                                                                                    "function": {
                                                                                                                      "typeApplication": {
                                                                                                                        "body": {"variable": "hydra.core.lib.logic.ifElse"},
                                                                                                                        "type": {"pair": {"first": {"list": {"variable": "hydra.core.model.Binding"}}, "second": {"variable": "hydra.core.model.Term"}}}}},
                                                                                                                    "argument": {
                                                                                                                      "application": {
                                                                                                                        "function": {
                                                                                                                          "application": {
                                                                                                                            "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.equality.equal"}, "type": {"literal": {"integer": "int32"}}}},
                                                                                                                            "argument": {"variable": "level"}}},
                                                                                                                        "argument": {"literal": {"integer": {"int32": 0}}}}}}},
                                                                                                                "argument": {
                                                                                                                  "typeApplication": {
                                                                                                                    "body": {
                                                                                                                      "typeApplication": {
                                                                                                                        "body": {"pair": {"first": {"variable": "bins"}, "second": {"variable": "term"}}},
                                                                                                                        "type": {"list": {"variable": "hydra.core.model.Binding"}}}},
                                                                                                                    "type": {"variable": "hydra.core.model.Term"}}}}},
                                                                                                            "argument": {"application": {"function": {"variable": "nonzero"}, "argument": {"variable": "term"}}}}}}}}}}}}},
                                                                                        "typeScheme": {
                                                                                          "variables": [],
                                                                                          "body": {
                                                                                            "function": {
                                                                                              "domain": {"literal": {"integer": "int32"}},
                                                                                              "codomain": {
                                                                                                "function": {
                                                                                                  "domain": {"list": {"variable": "hydra.core.model.Binding"}},
                                                                                                  "codomain": {
                                                                                                    "function": {
                                                                                                      "domain": {"variable": "hydra.core.model.Term"},
                                                                                                      "codomain": {"pair": {"first": {"list": {"variable": "hydra.core.model.Binding"}}, "second": {"variable": "hydra.core.model.Term"}}}}}}}}},
                                                                                          "constraints": []}}],
                                                                                    "body": {
                                                                                      "let": {
                                                                                        "bindings": [
                                                                                          {
                                                                                            "name": "result",
                                                                                            "term": {
                                                                                              "application": {
                                                                                                "function": {
                                                                                                  "application": {
                                                                                                    "function": {
                                                                                                      "application": {
                                                                                                        "function": {"variable": "helper"},
                                                                                                        "argument": {
                                                                                                          "application": {
                                                                                                            "function": {
                                                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.lists.length"}, "type": {"list": {"variable": "hydra.core.model.Name"}}}},
                                                                                                            "argument": {"variable": "groups"}}}}},
                                                                                                    "argument": {"typeApplication": {"body": {"list": []}, "type": {"variable": "hydra.core.model.Binding"}}}}},
                                                                                                "argument": {"variable": "iterm"}}},
                                                                                            "typeScheme": {
                                                                                              "variables": [],
                                                                                              "body": {"pair": {"first": {"list": {"variable": "hydra.core.model.Binding"}}, "second": {"variable": "hydra.core.model.Term"}}},
                                                                                              "constraints": []}}],
                                                                                        "body": {
                                                                                          "let": {
                                                                                            "bindings": [
                                                                                              {
                                                                                                "name": "bindingList",
                                                                                                "term": {
                                                                                                  "application": {
                                                                                                    "function": {
                                                                                                      "typeApplication": {
                                                                                                        "body": {
                                                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"list": {"variable": "hydra.core.model.Binding"}}}},
                                                                                                        "type": {"variable": "hydra.core.model.Term"}}},
                                                                                                    "argument": {"variable": "result"}}},
                                                                                                "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Binding"}}, "constraints": []}}],
                                                                                            "body": {
                                                                                              "let": {
                                                                                                "bindings": [
                                                                                                  {
                                                                                                    "name": "e",
                                                                                                    "term": {
                                                                                                      "application": {
                                                                                                        "function": {
                                                                                                          "typeApplication": {
                                                                                                            "body": {
                                                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"list": {"variable": "hydra.core.model.Binding"}}}},
                                                                                                            "type": {"variable": "hydra.core.model.Term"}}},
                                                                                                        "argument": {"variable": "result"}}},
                                                                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                                                                                "body": {
                                                                                                  "let": {
                                                                                                    "bindings": [
                                                                                                      {
                                                                                                        "name": "bindingMap2",
                                                                                                        "term": {
                                                                                                          "application": {
                                                                                                            "function": {
                                                                                                              "typeApplication": {
                                                                                                                "body": {
                                                                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.maps.fromList"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                                "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.Binding"}}},
                                                                                                                        "type": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.model.Binding"}}}}},
                                                                                                                    "argument": {
                                                                                                                      "lambda": {
                                                                                                                        "parameter": "b",
                                                                                                                        "domain": {"variable": "hydra.core.model.Binding"},
                                                                                                                        "body": {
                                                                                                                          "typeApplication": {
                                                                                                                            "body": {
                                                                                                                              "typeApplication": {
                                                                                                                                "body": {
                                                                                                                                  "pair": {
                                                                                                                                    "first": {
                                                                                                                                      "application": {"function": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "name"}}, "argument": {"variable": "b"}}},
                                                                                                                                    "second": {"variable": "b"}}},
                                                                                                                                "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                                            "type": {"variable": "hydra.core.model.Binding"}}}}}}},
                                                                                                                "argument": {"variable": "bindingList"}}}}},
                                                                                                        "typeScheme": {
                                                                                                          "variables": [],
                                                                                                          "body": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.Binding"}}},
                                                                                                          "constraints": []}}],
                                                                                                    "body": {
                                                                                                      "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.optionals.givens"}, "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.Name"}}},
                                                                                                                                  "type": {"optional": {"variable": "hydra.core.model.Binding"}}}},
                                                                                                                              "argument": {
                                                                                                                                "lambda": {
                                                                                                                                  "parameter": "n",
                                                                                                                                  "domain": {"variable": "hydra.core.model.Name"},
                                                                                                                                  "body": {
                                                                                                                                    "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.Binding"}}},
                                                                                                                                          "argument": {"variable": "n"}}},
                                                                                                                                      "argument": {"variable": "bindingMap2"}}}}}}},
                                                                                                                          "argument": {"variable": "names"}}}}}},
                                                                                                                {"name": "body", "term": {"variable": "e"}}]}}}}}}}}}}}}}}}}},
                                                                            "typeScheme": {
                                                                              "variables": [],
                                                                              "body": {"function": {"domain": {"variable": "hydra.core.model.Term"}, "codomain": {"variable": "hydra.core.model.Term"}}},
                                                                              "constraints": []}}],
                                                                        "body": {
                                                                          "let": {
                                                                            "bindings": [
                                                                              {
                                                                                "name": "rewriteResult",
                                                                                "term": {
                                                                                  "lambda": {
                                                                                    "parameter": "iresult",
                                                                                    "domain": {"variable": "hydra.core.typing.InferenceResult"},
                                                                                    "body": {
                                                                                      "let": {
                                                                                        "bindings": [
                                                                                          {
                                                                                            "name": "fcxR",
                                                                                            "term": {
                                                                                              "application": {
                                                                                                "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "context"}},
                                                                                                "argument": {"variable": "iresult"}}},
                                                                                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "constraints": []}}],
                                                                                        "body": {
                                                                                          "let": {
                                                                                            "bindings": [
                                                                                              {
                                                                                                "name": "iterm",
                                                                                                "term": {
                                                                                                  "application": {
                                                                                                    "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "term"}},
                                                                                                    "argument": {"variable": "iresult"}}},
                                                                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                                                                            "body": {
                                                                                              "let": {
                                                                                                "bindings": [
                                                                                                  {
                                                                                                    "name": "itype",
                                                                                                    "term": {
                                                                                                      "application": {
                                                                                                        "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "type"}},
                                                                                                        "argument": {"variable": "iresult"}}},
                                                                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
                                                                                                "body": {
                                                                                                  "let": {
                                                                                                    "bindings": [
                                                                                                      {
                                                                                                        "name": "isubst",
                                                                                                        "term": {
                                                                                                          "application": {
                                                                                                            "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "subst"}},
                                                                                                            "argument": {"variable": "iresult"}}},
                                                                                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.TypeSubst"}, "constraints": []}}],
                                                                                                    "body": {
                                                                                                      "let": {
                                                                                                        "bindings": [
                                                                                                          {
                                                                                                            "name": "iconstraints",
                                                                                                            "term": {
                                                                                                              "application": {
                                                                                                                "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "classConstraints"}},
                                                                                                                "argument": {"variable": "iresult"}}},
                                                                                                            "typeScheme": {
                                                                                                              "variables": [],
                                                                                                              "body": {
                                                                                                                "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}},
                                                                                                              "constraints": []}}],
                                                                                                        "body": {
                                                                                                          "record": {
                                                                                                            "typeName": "hydra.core.typing.InferenceResult",
                                                                                                            "fields": [
                                                                                                              {"name": "term", "term": {"application": {"function": {"variable": "restoreLet"}, "argument": {"variable": "iterm"}}}},
                                                                                                              {"name": "type", "term": {"variable": "itype"}},
                                                                                                              {"name": "subst", "term": {"variable": "isubst"}},
                                                                                                              {"name": "classConstraints", "term": {"variable": "iconstraints"}},
                                                                                                              {"name": "context", "term": {"variable": "fcxR"}}]}}}}}}}}}}}}}},
                                                                                "typeScheme": {
                                                                                  "variables": [],
                                                                                  "body": {
                                                                                    "function": {
                                                                                      "domain": {"variable": "hydra.core.typing.InferenceResult"},
                                                                                      "codomain": {"variable": "hydra.core.typing.InferenceResult"}}},
                                                                                  "constraints": []}}],
                                                                            "body": {
                                                                              "let": {
                                                                                "bindings": [
                                                                                  {
                                                                                    "name": "res",
                                                                                    "term": {
                                                                                      "application": {
                                                                                        "function": {
                                                                                          "cases": {
                                                                                            "typeName": "hydra.core.model.Term",
                                                                                            "default": {
                                                                                              "application": {
                                                                                                "function": {
                                                                                                  "application": {
                                                                                                    "function": {
                                                                                                      "application": {
                                                                                                        "function": {"application": {"function": {"variable": "hydra.core.inference.inferTypeOfTerm"}, "argument": {"variable": "fcx"}}},
                                                                                                        "argument": {"variable": "cx"}}},
                                                                                                    "argument": {"variable": "rewrittenLet"}}},
                                                                                                "argument": {"literal": {"string": "empty let term"}}}},
                                                                                            "cases": [
                                                                                              {
                                                                                                "name": "let",
                                                                                                "handler": {
                                                                                                  "lambda": {
                                                                                                    "parameter": "l",
                                                                                                    "domain": {"variable": "hydra.core.model.Let"},
                                                                                                    "body": {
                                                                                                      "application": {
                                                                                                        "function": {
                                                                                                          "application": {
                                                                                                            "function": {
                                                                                                              "application": {"function": {"variable": "hydra.core.inference.inferTypeOfLetNormalized"}, "argument": {"variable": "fcx"}}},
                                                                                                            "argument": {"variable": "cx"}}},
                                                                                                        "argument": {"variable": "l"}}}}}}]}},
                                                                                        "argument": {"variable": "rewrittenLet"}}},
                                                                                    "typeScheme": {
                                                                                      "variables": [],
                                                                                      "body": {
                                                                                        "either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.typing.InferenceResult"}}},
                                                                                      "constraints": []}}],
                                                                                "body": {
                                                                                  "application": {
                                                                                    "function": {
                                                                                      "application": {
                                                                                        "function": {
                                                                                          "typeApplication": {
                                                                                            "body": {
                                                                                              "typeApplication": {
                                                                                                "body": {
                                                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.eithers.map"}, "type": {"variable": "hydra.core.typing.InferenceResult"}}},
                                                                                                "type": {"variable": "hydra.core.typing.InferenceResult"}}},
                                                                                            "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                        "argument": {"variable": "rewriteResult"}}},
                                                                                    "argument": {"variable": "res"}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {
                    "literal": {
                      "string": "Normalize a let term before inferring its type (Either version). The bindings are partitioned into strongly connected components and reorganized as nested lets, one let per SCC, in dependency order. This is the standard Hindley-Milner treatment of mutual recursion: each SCC is generalized once at its boundary (sound, because nothing inside the cluster sees a polymorphic instance of its siblings), and acyclic bindings generalize individually as usual. Paper: inference.tex, the SCC treatment of cycles (section introduction) and the remark following the elaboration-form Let rule."}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.inference.inferTypeOfLetNormalized",
        "signature": {
          "typeParameters": [],
          "parameters": [
            {"name": "arg0", "type": {"variable": "hydra.core.typing.InferenceContext"}, "isLazy": false},
            {"name": "arg1", "type": {"variable": "hydra.core.graph.Graph"}, "isLazy": false},
            {"name": "arg2", "type": {"variable": "hydra.core.model.Let"}, "isLazy": false}],
          "result": {
            "type": {
              "either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.typing.InferenceResult"}}}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "fcx0",
                "domain": {"variable": "hydra.core.typing.InferenceContext"},
                "body": {
                  "lambda": {
                    "parameter": "cx0",
                    "domain": {"variable": "hydra.core.graph.Graph"},
                    "body": {
                      "lambda": {
                        "parameter": "letTerm",
                        "domain": {"variable": "hydra.core.model.Let"},
                        "body": {
                          "let": {
                            "bindings": [
                              {
                                "name": "fcx",
                                "term": {"variable": "fcx0"},
                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "constraints": []}}],
                            "body": {
                              "let": {
                                "bindings": [
                                  {
                                    "name": "bins0",
                                    "term": {
                                      "application": {
                                        "function": {"project": {"typeName": "hydra.core.model.Let", "fieldName": "bindings"}},
                                        "argument": {"variable": "letTerm"}}},
                                    "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Binding"}}, "constraints": []}}],
                                "body": {
                                  "let": {
                                    "bindings": [
                                      {
                                        "name": "body0",
                                        "term": {
                                          "application": {
                                            "function": {"project": {"typeName": "hydra.core.model.Let", "fieldName": "body"}},
                                            "argument": {"variable": "letTerm"}}},
                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                    "body": {
                                      "let": {
                                        "bindings": [
                                          {
                                            "name": "bnames",
                                            "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.Name"}}},
                                                    "argument": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "name"}}}},
                                                "argument": {"variable": "bins0"}}},
                                            "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Name"}}, "constraints": []}}],
                                        "body": {
                                          "let": {
                                            "bindings": [
                                              {
                                                "name": "bvarsResult",
                                                "term": {
                                                  "application": {
                                                    "function": {
                                                      "application": {
                                                        "function": {"variable": "hydra.core.names.freshNames"},
                                                        "argument": {
                                                          "application": {
                                                            "function": {
                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.lists.length"}, "type": {"variable": "hydra.core.model.Binding"}}},
                                                            "argument": {"variable": "bins0"}}}}},
                                                    "argument": {"variable": "fcx"}}},
                                                "typeScheme": {
                                                  "variables": [],
                                                  "body": {
                                                    "pair": {"first": {"list": {"variable": "hydra.core.model.Name"}}, "second": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                  "constraints": []}}],
                                            "body": {
                                              "let": {
                                                "bindings": [
                                                  {
                                                    "name": "bvars",
                                                    "term": {
                                                      "application": {
                                                        "function": {
                                                          "typeApplication": {
                                                            "body": {
                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"list": {"variable": "hydra.core.model.Name"}}}},
                                                            "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                        "argument": {"variable": "bvarsResult"}}},
                                                    "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Name"}}, "constraints": []}}],
                                                "body": {
                                                  "let": {
                                                    "bindings": [
                                                      {
                                                        "name": "fcx2",
                                                        "term": {
                                                          "application": {
                                                            "function": {
                                                              "typeApplication": {
                                                                "body": {
                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"list": {"variable": "hydra.core.model.Name"}}}},
                                                                "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                            "argument": {"variable": "bvarsResult"}}},
                                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "constraints": []}}],
                                                    "body": {
                                                      "let": {
                                                        "bindings": [
                                                          {
                                                            "name": "tbins0",
                                                            "term": {
                                                              "application": {
                                                                "function": {
                                                                  "application": {
                                                                    "function": {
                                                                      "typeApplication": {
                                                                        "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                        "type": {"variable": "hydra.core.model.Type"}}},
                                                                    "argument": {
                                                                      "lambda": {
                                                                        "parameter": "x",
                                                                        "domain": {"variable": "hydra.core.model.Name"},
                                                                        "body": {"inject": {"typeName": "hydra.core.model.Type", "field": {"name": "variable", "term": {"variable": "x"}}}}}}}},
                                                                "argument": {"variable": "bvars"}}},
                                                            "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Type"}}, "constraints": []}}],
                                                        "body": {
                                                          "let": {
                                                            "bindings": [
                                                              {
                                                                "name": "cx1",
                                                                "term": {
                                                                  "application": {
                                                                    "function": {
                                                                      "application": {
                                                                        "function": {"variable": "hydra.core.inference.extendContext"},
                                                                        "argument": {
                                                                          "application": {
                                                                            "function": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "typeApplication": {
                                                                                    "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.zip"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                    "type": {"variable": "hydra.core.model.TypeScheme"}}},
                                                                                "argument": {"variable": "bnames"}}},
                                                                            "argument": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "application": {
                                                                                    "function": {
                                                                                      "typeApplication": {
                                                                                        "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                                        "type": {"variable": "hydra.core.model.TypeScheme"}}},
                                                                                    "argument": {
                                                                                      "lambda": {
                                                                                        "parameter": "t",
                                                                                        "domain": {"variable": "hydra.core.model.Type"},
                                                                                        "body": {
                                                                                          "record": {
                                                                                            "typeName": "hydra.core.model.TypeScheme",
                                                                                            "fields": [
                                                                                              {
                                                                                                "name": "variables",
                                                                                                "term": {"typeApplication": {"body": {"list": []}, "type": {"variable": "hydra.core.model.Name"}}}},
                                                                                              {"name": "body", "term": {"variable": "t"}},
                                                                                              {
                                                                                                "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"}}}}]}}}}}},
                                                                                "argument": {"variable": "tbins0"}}}}}}},
                                                                    "argument": {"variable": "cx0"}}},
                                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.graph.Graph"}, "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": {
                                                                              "pair": {
                                                                                "first": {
                                                                                  "pair": {
                                                                                    "first": {"list": {"variable": "hydra.core.model.Term"}},
                                                                                    "second": {
                                                                                      "pair": {
                                                                                        "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                        "second": {
                                                                                          "pair": {
                                                                                            "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                            "second": {
                                                                                              "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}},
                                                                                "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                        "type": {"variable": "hydra.core.typing.InferenceResult"}}},
                                                                    "argument": {
                                                                      "application": {
                                                                        "function": {
                                                                          "application": {
                                                                            "function": {
                                                                              "application": {"function": {"variable": "hydra.core.inference.inferTypesOfTemporaryBindings"}, "argument": {"variable": "fcx2"}}},
                                                                            "argument": {"variable": "cx1"}}},
                                                                        "argument": {"variable": "bins0"}}}}},
                                                                "argument": {
                                                                  "lambda": {
                                                                    "parameter": "irRp",
                                                                    "domain": {
                                                                      "pair": {
                                                                        "first": {
                                                                          "pair": {
                                                                            "first": {"list": {"variable": "hydra.core.model.Term"}},
                                                                            "second": {
                                                                              "pair": {
                                                                                "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                "second": {
                                                                                  "pair": {
                                                                                    "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                    "second": {
                                                                                      "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}},
                                                                        "second": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                    "body": {
                                                                      "let": {
                                                                        "bindings": [
                                                                          {
                                                                            "name": "inferredResult",
                                                                            "term": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "typeApplication": {
                                                                                    "body": {
                                                                                      "typeApplication": {
                                                                                        "body": {"variable": "hydra.core.lib.pairs.first"},
                                                                                        "type": {
                                                                                          "pair": {
                                                                                            "first": {"list": {"variable": "hydra.core.model.Term"}},
                                                                                            "second": {
                                                                                              "pair": {
                                                                                                "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                                "second": {
                                                                                                  "pair": {
                                                                                                    "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                    "second": {
                                                                                                      "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}}}},
                                                                                    "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                "argument": {"variable": "irRp"}}},
                                                                            "typeScheme": {
                                                                              "variables": [],
                                                                              "body": {
                                                                                "pair": {
                                                                                  "first": {"list": {"variable": "hydra.core.model.Term"}},
                                                                                  "second": {
                                                                                    "pair": {
                                                                                      "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                      "second": {
                                                                                        "pair": {
                                                                                          "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                          "second": {
                                                                                            "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}},
                                                                              "constraints": []}}],
                                                                        "body": {
                                                                          "let": {
                                                                            "bindings": [
                                                                              {
                                                                                "name": "fcx3",
                                                                                "term": {
                                                                                  "application": {
                                                                                    "function": {
                                                                                      "typeApplication": {
                                                                                        "body": {
                                                                                          "typeApplication": {
                                                                                            "body": {"variable": "hydra.core.lib.pairs.second"},
                                                                                            "type": {
                                                                                              "pair": {
                                                                                                "first": {"list": {"variable": "hydra.core.model.Term"}},
                                                                                                "second": {
                                                                                                  "pair": {
                                                                                                    "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                                    "second": {
                                                                                                      "pair": {
                                                                                                        "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                        "second": {
                                                                                                          "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}}}},
                                                                                        "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                    "argument": {"variable": "irRp"}}},
                                                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "constraints": []}}],
                                                                            "body": {
                                                                              "let": {
                                                                                "bindings": [
                                                                                  {
                                                                                    "name": "bterms1",
                                                                                    "term": {
                                                                                      "application": {
                                                                                        "function": {
                                                                                          "typeApplication": {
                                                                                            "body": {
                                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"list": {"variable": "hydra.core.model.Term"}}}},
                                                                                            "type": {
                                                                                              "pair": {
                                                                                                "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                                "second": {
                                                                                                  "pair": {
                                                                                                    "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                    "second": {
                                                                                                      "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}},
                                                                                        "argument": {"variable": "inferredResult"}}},
                                                                                    "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Term"}}, "constraints": []}}],
                                                                                "body": {
                                                                                  "let": {
                                                                                    "bindings": [
                                                                                      {
                                                                                        "name": "tbins1",
                                                                                        "term": {
                                                                                          "application": {
                                                                                            "function": {
                                                                                              "typeApplication": {
                                                                                                "body": {
                                                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                                                                "type": {
                                                                                                  "pair": {
                                                                                                    "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                    "second": {
                                                                                                      "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}},
                                                                                            "argument": {
                                                                                              "application": {
                                                                                                "function": {
                                                                                                  "typeApplication": {
                                                                                                    "body": {
                                                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"list": {"variable": "hydra.core.model.Term"}}}},
                                                                                                    "type": {
                                                                                                      "pair": {
                                                                                                        "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                                        "second": {
                                                                                                          "pair": {
                                                                                                            "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                            "second": {
                                                                                                              "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}},
                                                                                                "argument": {"variable": "inferredResult"}}}}},
                                                                                        "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Type"}}, "constraints": []}}],
                                                                                    "body": {
                                                                                      "let": {
                                                                                        "bindings": [
                                                                                          {
                                                                                            "name": "substAndConstraints",
                                                                                            "term": {
                                                                                              "application": {
                                                                                                "function": {
                                                                                                  "typeApplication": {
                                                                                                    "body": {
                                                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                                                                    "type": {
                                                                                                      "pair": {
                                                                                                        "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                        "second": {
                                                                                                          "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}},
                                                                                                "argument": {
                                                                                                  "application": {
                                                                                                    "function": {
                                                                                                      "typeApplication": {
                                                                                                        "body": {
                                                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"list": {"variable": "hydra.core.model.Term"}}}},
                                                                                                        "type": {
                                                                                                          "pair": {
                                                                                                            "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                                            "second": {
                                                                                                              "pair": {
                                                                                                                "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                                "second": {
                                                                                                                  "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}},
                                                                                                    "argument": {"variable": "inferredResult"}}}}},
                                                                                            "typeScheme": {
                                                                                              "variables": [],
                                                                                              "body": {
                                                                                                "pair": {
                                                                                                  "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                  "second": {
                                                                                                    "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}},
                                                                                              "constraints": []}}],
                                                                                        "body": {
                                                                                          "let": {
                                                                                            "bindings": [
                                                                                              {
                                                                                                "name": "s1",
                                                                                                "term": {
                                                                                                  "application": {
                                                                                                    "function": {
                                                                                                      "typeApplication": {
                                                                                                        "body": {
                                                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"variable": "hydra.core.typing.TypeSubst"}}},
                                                                                                        "type": {
                                                                                                          "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}},
                                                                                                    "argument": {"variable": "substAndConstraints"}}},
                                                                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.TypeSubst"}, "constraints": []}}],
                                                                                            "body": {
                                                                                              "let": {
                                                                                                "bindings": [
                                                                                                  {
                                                                                                    "name": "inferredConstraints",
                                                                                                    "term": {
                                                                                                      "application": {
                                                                                                        "function": {
                                                                                                          "typeApplication": {
                                                                                                            "body": {
                                                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"variable": "hydra.core.typing.TypeSubst"}}},
                                                                                                            "type": {
                                                                                                              "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}},
                                                                                                        "argument": {"variable": "substAndConstraints"}}},
                                                                                                    "typeScheme": {
                                                                                                      "variables": [],
                                                                                                      "body": {
                                                                                                        "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}},
                                                                                                      "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.TypeSubst"}}},
                                                                                                            "type": {"variable": "hydra.core.typing.InferenceResult"}}},
                                                                                                        "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.UnificationError"}}},
                                                                                                                                "type": {"variable": "hydra.core.typing.TypeSubst"}}},
                                                                                                                            "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                                                        "type": {"variable": "hydra.core.typing.TypeSubst"}}},
                                                                                                                    "argument": {
                                                                                                                      "lambda": {
                                                                                                                        "parameter": "_e",
                                                                                                                        "domain": {"variable": "hydra.core.errors.UnificationError"},
                                                                                                                        "body": {
                                                                                                                          "inject": {
                                                                                                                            "typeName": "hydra.core.errors.Error",
                                                                                                                            "field": {
                                                                                                                              "name": "inference",
                                                                                                                              "term": {
                                                                                                                                "inject": {
                                                                                                                                  "typeName": "hydra.core.errors.InferenceError",
                                                                                                                                  "field": {
                                                                                                                                    "name": "unification",
                                                                                                                                    "term": {
                                                                                                                                      "record": {
                                                                                                                                        "typeName": "hydra.core.errors.UnificationInferenceError",
                                                                                                                                        "fields": [
                                                                                                                                          {
                                                                                                                                            "name": "path",
                                                                                                                                            "term": {
                                                                                                                                              "wrap": {
                                                                                                                                                "typeName": "hydra.core.paths.SubtermPath",
                                                                                                                                                "body": {
                                                                                                                                                  "application": {
                                                                                                                                                    "function": {
                                                                                                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.lists.reverse"}, "type": {"variable": "hydra.core.paths.SubtermStep"}}},
                                                                                                                                                    "argument": {
                                                                                                                                                      "application": {
                                                                                                                                                        "function": {"project": {"typeName": "hydra.core.typing.InferenceContext", "fieldName": "trace"}},
                                                                                                                                                        "argument": {"variable": "fcx3"}}}}}}}},
                                                                                                                                          {"name": "cause", "term": {"variable": "_e"}}]}}}}}}}}}}}},
                                                                                                                "argument": {"lambda": {"parameter": "_a", "domain": {"variable": "hydra.core.typing.TypeSubst"}, "body": {"variable": "_a"}}}}},
                                                                                                            "argument": {
                                                                                                              "application": {
                                                                                                                "function": {
                                                                                                                  "application": {
                                                                                                                    "function": {
                                                                                                                      "application": {
                                                                                                                        "function": {
                                                                                                                          "application": {
                                                                                                                            "function": {
                                                                                                                              "application": {
                                                                                                                                "function": {
                                                                                                                                  "typeApplication": {
                                                                                                                                    "body": {"variable": "hydra.core.unification.unifyTypeLists"},
                                                                                                                                    "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                                                                "argument": {"variable": "fcx3"}}},
                                                                                                                            "argument": {
                                                                                                                              "application": {
                                                                                                                                "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "schemaTypes"}},
                                                                                                                                "argument": {"variable": "cx0"}}}}},
                                                                                                                        "argument": {
                                                                                                                          "application": {
                                                                                                                            "function": {
                                                                                                                              "application": {
                                                                                                                                "function": {
                                                                                                                                  "typeApplication": {
                                                                                                                                    "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                                                                                    "type": {"variable": "hydra.core.model.Type"}}},
                                                                                                                                "argument": {"application": {"function": {"variable": "hydra.core.substitution.substInType"}, "argument": {"variable": "s1"}}}}},
                                                                                                                            "argument": {"variable": "tbins0"}}}}},
                                                                                                                    "argument": {"variable": "tbins1"}}},
                                                                                                                "argument": {"literal": {"string": "temporary type bindings"}}}}}}}},
                                                                                                    "argument": {
                                                                                                      "lambda": {
                                                                                                        "parameter": "s2",
                                                                                                        "domain": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                        "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.TypeSubst"}}},
                                                                                                                    "type": {"variable": "hydra.core.typing.InferenceResult"}}},
                                                                                                                "argument": {
                                                                                                                  "application": {
                                                                                                                    "function": {
                                                                                                                      "application": {
                                                                                                                        "function": {
                                                                                                                          "application": {
                                                                                                                            "function": {
                                                                                                                              "typeApplication": {"body": {"variable": "hydra.core.checking.checkTypeSubst"}, "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                                                            "argument": {"variable": "fcx3"}}},
                                                                                                                        "argument": {"variable": "cx0"}}},
                                                                                                                    "argument": {"variable": "s2"}}}}},
                                                                                                            "argument": {
                                                                                                              "lambda": {
                                                                                                                "parameter": "_",
                                                                                                                "domain": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                                "body": {
                                                                                                                  "let": {
                                                                                                                    "bindings": [
                                                                                                                      {
                                                                                                                        "name": "g2base",
                                                                                                                        "term": {
                                                                                                                          "application": {
                                                                                                                            "function": {
                                                                                                                              "application": {
                                                                                                                                "function": {"variable": "hydra.core.substitution.substInContext"},
                                                                                                                                "argument": {
                                                                                                                                  "application": {
                                                                                                                                    "function": {"application": {"function": {"variable": "hydra.core.substitution.composeTypeSubst"}, "argument": {"variable": "s1"}}},
                                                                                                                                    "argument": {"variable": "s2"}}}}},
                                                                                                                            "argument": {"variable": "cx0"}}},
                                                                                                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.graph.Graph"}, "constraints": []}}],
                                                                                                                    "body": {
                                                                                                                      "let": {
                                                                                                                        "bindings": [
                                                                                                                          {
                                                                                                                            "name": "constraintsWithS2",
                                                                                                                            "term": {
                                                                                                                              "application": {
                                                                                                                                "function": {
                                                                                                                                  "application": {"function": {"variable": "hydra.core.substitution.substInClassConstraints"}, "argument": {"variable": "s2"}}},
                                                                                                                                "argument": {"variable": "inferredConstraints"}}},
                                                                                                                            "typeScheme": {
                                                                                                                              "variables": [],
                                                                                                                              "body": {
                                                                                                                                "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}},
                                                                                                                              "constraints": []}}],
                                                                                                                        "body": {
                                                                                                                          "let": {
                                                                                                                            "bindings": [
                                                                                                                              {
                                                                                                                                "name": "composedSubst",
                                                                                                                                "term": {
                                                                                                                                  "application": {
                                                                                                                                    "function": {"application": {"function": {"variable": "hydra.core.substitution.composeTypeSubst"}, "argument": {"variable": "s1"}}},
                                                                                                                                    "argument": {"variable": "s2"}}},
                                                                                                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.TypeSubst"}, "constraints": []}}],
                                                                                                                            "body": {
                                                                                                                              "let": {
                                                                                                                                "bindings": [
                                                                                                                                  {
                                                                                                                                    "name": "originalBindingConstraints",
                                                                                                                                    "term": {
                                                                                                                                      "application": {
                                                                                                                                        "function": {
                                                                                                                                          "application": {
                                                                                                                                            "function": {
                                                                                                                                              "application": {
                                                                                                                                                "function": {
                                                                                                                                                  "typeApplication": {
                                                                                                                                                    "body": {
                                                                                                                                                      "typeApplication": {
                                                                                                                                                        "body": {"variable": "hydra.core.lib.lists.foldl"},
                                                                                                                                                        "type": {
                                                                                                                                                          "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}},
                                                                                                                                                    "type": {"variable": "hydra.core.model.Binding"}}},
                                                                                                                                                "argument": {
                                                                                                                                                  "lambda": {
                                                                                                                                                    "parameter": "acc",
                                                                                                                                                    "domain": {
                                                                                                                                                      "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}},
                                                                                                                                                    "body": {
                                                                                                                                                      "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.TypeScheme"}}},
                                                                                                                                                                        "type": {
                                                                                                                                                                          "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}},
                                                                                                                                                                    "argument": {
                                                                                                                                                                      "application": {
                                                                                                                                                                        "function": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "typeScheme"}},
                                                                                                                                                                        "argument": {"variable": "b"}}}}},
                                                                                                                                                                "argument": {"variable": "acc"}}},
                                                                                                                                                            "argument": {
                                                                                                                                                              "lambda": {
                                                                                                                                                                "parameter": "ts",
                                                                                                                                                                "domain": {"variable": "hydra.core.model.TypeScheme"},
                                                                                                                                                                "body": {
                                                                                                                                                                  "application": {
                                                                                                                                                                    "function": {
                                                                                                                                                                      "application": {
                                                                                                                                                                        "function": {
                                                                                                                                                                          "typeApplication": {"body": {"variable": "hydra.core.inference.mergeClassConstraints"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                                                                                        "argument": {"variable": "acc"}}},
                                                                                                                                                                    "argument": {
                                                                                                                                                                      "application": {
                                                                                                                                                                        "function": {"project": {"typeName": "hydra.core.model.TypeScheme", "fieldName": "constraints"}},
                                                                                                                                                                        "argument": {"variable": "ts"}}}}}}}}}}}}}}},
                                                                                                                                            "argument": {
                                                                                                                                              "typeApplication": {
                                                                                                                                                "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.empty"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                                                                "type": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}},
                                                                                                                                        "argument": {"variable": "bins0"}}},
                                                                                                                                    "typeScheme": {
                                                                                                                                      "variables": [],
                                                                                                                                      "body": {
                                                                                                                                        "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}},
                                                                                                                                      "constraints": []}}],
                                                                                                                                "body": {
                                                                                                                                  "let": {
                                                                                                                                    "bindings": [
                                                                                                                                      {
                                                                                                                                        "name": "originalConstraintsSubst",
                                                                                                                                        "term": {
                                                                                                                                          "application": {
                                                                                                                                            "function": {
                                                                                                                                              "application": {"function": {"variable": "hydra.core.substitution.substInClassConstraints"}, "argument": {"variable": "composedSubst"}}},
                                                                                                                                            "argument": {"variable": "originalBindingConstraints"}}},
                                                                                                                                        "typeScheme": {
                                                                                                                                          "variables": [],
                                                                                                                                          "body": {
                                                                                                                                            "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}},
                                                                                                                                          "constraints": []}}],
                                                                                                                                    "body": {
                                                                                                                                      "let": {
                                                                                                                                        "bindings": [
                                                                                                                                          {
                                                                                                                                            "name": "allInferredConstraints",
                                                                                                                                            "term": {
                                                                                                                                              "application": {
                                                                                                                                                "function": {
                                                                                                                                                  "application": {
                                                                                                                                                    "function": {
                                                                                                                                                      "typeApplication": {"body": {"variable": "hydra.core.inference.mergeClassConstraints"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                                                                    "argument": {"variable": "constraintsWithS2"}}},
                                                                                                                                                "argument": {"variable": "originalConstraintsSubst"}}},
                                                                                                                                            "typeScheme": {
                                                                                                                                              "variables": [],
                                                                                                                                              "body": {
                                                                                                                                                "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}},
                                                                                                                                              "constraints": []}}],
                                                                                                                                        "body": {
                                                                                                                                          "let": {
                                                                                                                                            "bindings": [
                                                                                                                                              {
                                                                                                                                                "name": "mergedConstraints",
                                                                                                                                                "term": {
                                                                                                                                                  "application": {
                                                                                                                                                    "function": {
                                                                                                                                                      "application": {
                                                                                                                                                        "function": {
                                                                                                                                                          "typeApplication": {"body": {"variable": "hydra.core.inference.mergeClassConstraints"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                                                                        "argument": {
                                                                                                                                                          "application": {
                                                                                                                                                            "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "classConstraints"}},
                                                                                                                                                            "argument": {"variable": "g2base"}}}}},
                                                                                                                                                    "argument": {"variable": "allInferredConstraints"}}},
                                                                                                                                                "typeScheme": {
                                                                                                                                                  "variables": [],
                                                                                                                                                  "body": {
                                                                                                                                                    "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}},
                                                                                                                                                  "constraints": []}}],
                                                                                                                                            "body": {
                                                                                                                                              "let": {
                                                                                                                                                "bindings": [
                                                                                                                                                  {
                                                                                                                                                    "name": "g2",
                                                                                                                                                    "term": {
                                                                                                                                                      "record": {
                                                                                                                                                        "typeName": "hydra.core.graph.Graph",
                                                                                                                                                        "fields": [
                                                                                                                                                          {
                                                                                                                                                            "name": "boundTerms",
                                                                                                                                                            "term": {
                                                                                                                                                              "application": {
                                                                                                                                                                "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "boundTerms"}},
                                                                                                                                                                "argument": {"variable": "g2base"}}}},
                                                                                                                                                          {
                                                                                                                                                            "name": "boundTypes",
                                                                                                                                                            "term": {
                                                                                                                                                              "application": {
                                                                                                                                                                "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "boundTypes"}},
                                                                                                                                                                "argument": {"variable": "g2base"}}}},
                                                                                                                                                          {"name": "classConstraints", "term": {"variable": "mergedConstraints"}},
                                                                                                                                                          {
                                                                                                                                                            "name": "lambdaVariables",
                                                                                                                                                            "term": {
                                                                                                                                                              "application": {
                                                                                                                                                                "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "lambdaVariables"}},
                                                                                                                                                                "argument": {"variable": "g2base"}}}},
                                                                                                                                                          {
                                                                                                                                                            "name": "metadata",
                                                                                                                                                            "term": {
                                                                                                                                                              "application": {
                                                                                                                                                                "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "metadata"}},
                                                                                                                                                                "argument": {"variable": "g2base"}}}},
                                                                                                                                                          {
                                                                                                                                                            "name": "primitives",
                                                                                                                                                            "term": {
                                                                                                                                                              "application": {
                                                                                                                                                                "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "primitives"}},
                                                                                                                                                                "argument": {"variable": "g2base"}}}},
                                                                                                                                                          {
                                                                                                                                                            "name": "schemaTypes",
                                                                                                                                                            "term": {
                                                                                                                                                              "application": {
                                                                                                                                                                "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "schemaTypes"}},
                                                                                                                                                                "argument": {"variable": "g2base"}}}},
                                                                                                                                                          {
                                                                                                                                                            "name": "typeVariables",
                                                                                                                                                            "term": {
                                                                                                                                                              "application": {
                                                                                                                                                                "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "typeVariables"}},
                                                                                                                                                                "argument": {"variable": "g2base"}}}}]}},
                                                                                                                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.graph.Graph"}, "constraints": []}}],
                                                                                                                                                "body": {
                                                                                                                                                  "let": {
                                                                                                                                                    "bindings": [
                                                                                                                                                      {
                                                                                                                                                        "name": "bterms1Subst",
                                                                                                                                                        "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": {"application": {"function": {"variable": "hydra.core.substitution.substTypesInTerm"}, "argument": {"variable": "s2"}}}}},
                                                                                                                                                            "argument": {"variable": "bterms1"}}},
                                                                                                                                                        "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Term"}}, "constraints": []}}],
                                                                                                                                                    "body": {
                                                                                                                                                      "let": {
                                                                                                                                                        "bindings": [
                                                                                                                                                          {
                                                                                                                                                            "name": "tsbins1",
                                                                                                                                                            "term": {
                                                                                                                                                              "application": {
                                                                                                                                                                "function": {
                                                                                                                                                                  "application": {
                                                                                                                                                                    "function": {
                                                                                                                                                                      "typeApplication": {
                                                                                                                                                                        "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.zip"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                                                                                        "type": {"variable": "hydra.core.model.TypeScheme"}}},
                                                                                                                                                                    "argument": {"variable": "bnames"}}},
                                                                                                                                                                "argument": {
                                                                                                                                                                  "application": {
                                                                                                                                                                    "function": {
                                                                                                                                                                      "application": {
                                                                                                                                                                        "function": {
                                                                                                                                                                          "typeApplication": {
                                                                                                                                                                            "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                                                                                                                            "type": {"variable": "hydra.core.model.TypeScheme"}}},
                                                                                                                                                                        "argument": {
                                                                                                                                                                          "lambda": {
                                                                                                                                                                            "parameter": "t",
                                                                                                                                                                            "domain": {"variable": "hydra.core.model.Type"},
                                                                                                                                                                            "body": {
                                                                                                                                                                              "application": {
                                                                                                                                                                                "function": {"application": {"function": {"variable": "hydra.core.inference.generalize"}, "argument": {"variable": "g2"}}},
                                                                                                                                                                                "argument": {
                                                                                                                                                                                  "application": {
                                                                                                                                                                                    "function": {"application": {"function": {"variable": "hydra.core.substitution.substInType"}, "argument": {"variable": "s2"}}},
                                                                                                                                                                                    "argument": {"variable": "t"}}}}}}}}},
                                                                                                                                                                    "argument": {"variable": "tbins1"}}}}},
                                                                                                                                                            "typeScheme": {
                                                                                                                                                              "variables": [],
                                                                                                                                                              "body": {
                                                                                                                                                                "list": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.model.TypeScheme"}}}},
                                                                                                                                                              "constraints": []}}],
                                                                                                                                                        "body": {
                                                                                                                                                          "let": {
                                                                                                                                                            "bindings": [
                                                                                                                                                              {
                                                                                                                                                                "name": "fcx3Body",
                                                                                                                                                                "term": {
                                                                                                                                                                  "application": {
                                                                                                                                                                    "function": {
                                                                                                                                                                      "application": {
                                                                                                                                                                        "function": {"variable": "hydra.core.names.pushSubtermStep"},
                                                                                                                                                                        "argument": {"inject": {"typeName": "hydra.core.paths.SubtermStep", "field": {"name": "letBody", "term": "unit"}}}}},
                                                                                                                                                                    "argument": {"variable": "fcx3"}}},
                                                                                                                                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "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.InferenceResult"}}},
                                                                                                                                                                        "type": {"variable": "hydra.core.typing.InferenceResult"}}},
                                                                                                                                                                    "argument": {
                                                                                                                                                                      "application": {
                                                                                                                                                                        "function": {
                                                                                                                                                                          "application": {
                                                                                                                                                                            "function": {
                                                                                                                                                                              "application": {
                                                                                                                                                                                "function": {
                                                                                                                                                                                  "application": {"function": {"variable": "hydra.core.inference.inferTypeOfTerm"}, "argument": {"variable": "fcx3Body"}}},
                                                                                                                                                                                "argument": {
                                                                                                                                                                                  "application": {
                                                                                                                                                                                    "function": {"application": {"function": {"variable": "hydra.core.inference.extendContext"}, "argument": {"variable": "tsbins1"}}},
                                                                                                                                                                                    "argument": {"variable": "g2"}}}}},
                                                                                                                                                                            "argument": {"variable": "body0"}}},
                                                                                                                                                                        "argument": {"literal": {"string": "let body"}}}}}},
                                                                                                                                                                "argument": {
                                                                                                                                                                  "lambda": {
                                                                                                                                                                    "parameter": "bodyResult",
                                                                                                                                                                    "domain": {"variable": "hydra.core.typing.InferenceResult"},
                                                                                                                                                                    "body": {
                                                                                                                                                                      "let": {
                                                                                                                                                                        "bindings": [
                                                                                                                                                                          {
                                                                                                                                                                            "name": "fcx4",
                                                                                                                                                                            "term": {
                                                                                                                                                                              "application": {
                                                                                                                                                                                "function": {"application": {"function": {"variable": "hydra.core.names.restoreTrace"}, "argument": {"variable": "fcx3"}}},
                                                                                                                                                                                "argument": {
                                                                                                                                                                                  "application": {
                                                                                                                                                                                    "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "context"}},
                                                                                                                                                                                    "argument": {"variable": "bodyResult"}}}}},
                                                                                                                                                                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "constraints": []}}],
                                                                                                                                                                        "body": {
                                                                                                                                                                          "let": {
                                                                                                                                                                            "bindings": [
                                                                                                                                                                              {
                                                                                                                                                                                "name": "body1",
                                                                                                                                                                                "term": {
                                                                                                                                                                                  "application": {
                                                                                                                                                                                    "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "term"}},
                                                                                                                                                                                    "argument": {"variable": "bodyResult"}}},
                                                                                                                                                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                                                                                                                                                            "body": {
                                                                                                                                                                              "let": {
                                                                                                                                                                                "bindings": [
                                                                                                                                                                                  {
                                                                                                                                                                                    "name": "tbody",
                                                                                                                                                                                    "term": {
                                                                                                                                                                                      "application": {
                                                                                                                                                                                        "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "type"}},
                                                                                                                                                                                        "argument": {"variable": "bodyResult"}}},
                                                                                                                                                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
                                                                                                                                                                                "body": {
                                                                                                                                                                                  "let": {
                                                                                                                                                                                    "bindings": [
                                                                                                                                                                                      {
                                                                                                                                                                                        "name": "sbody",
                                                                                                                                                                                        "term": {
                                                                                                                                                                                          "application": {
                                                                                                                                                                                            "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "subst"}},
                                                                                                                                                                                            "argument": {"variable": "bodyResult"}}},
                                                                                                                                                                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.TypeSubst"}, "constraints": []}}],
                                                                                                                                                                                    "body": {
                                                                                                                                                                                      "let": {
                                                                                                                                                                                        "bindings": [
                                                                                                                                                                                          {
                                                                                                                                                                                            "name": "st1",
                                                                                                                                                                                            "term": {
                                                                                                                                                                                              "wrap": {
                                                                                                                                                                                                "typeName": "hydra.core.typing.TermSubst",
                                                                                                                                                                                                "body": {
                                                                                                                                                                                                  "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": {
                                                                                                                                                                                                          "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.TypeScheme"}}}}},
                                                                                                                                                                                                                "type": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.model.Term"}}}}},
                                                                                                                                                                                                            "argument": {
                                                                                                                                                                                                              "lambda": {
                                                                                                                                                                                                                "parameter": "pair",
                                                                                                                                                                                                                "domain": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.model.TypeScheme"}}},
                                                                                                                                                                                                                "body": {
                                                                                                                                                                                                                  "let": {
                                                                                                                                                                                                                    "bindings": [
                                                                                                                                                                                                                      {
                                                                                                                                                                                                                        "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.TypeScheme"}}},
                                                                                                                                                                                                                            "argument": {"variable": "pair"}}},
                                                                                                                                                                                                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Name"}, "constraints": []}}],
                                                                                                                                                                                                                    "body": {
                                                                                                                                                                                                                      "let": {
                                                                                                                                                                                                                        "bindings": [
                                                                                                                                                                                                                          {
                                                                                                                                                                                                                            "name": "ts",
                                                                                                                                                                                                                            "term": {
                                                                                                                                                                                                                              "application": {
                                                                                                                                                                                                                                "function": {
                                                                                                                                                                                                                                  "typeApplication": {
                                                                                                                                                                                                                                    "body": {
                                                                                                                                                                                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                                                                                                                                                    "type": {"variable": "hydra.core.model.TypeScheme"}}},
                                                                                                                                                                                                                                "argument": {"variable": "pair"}}},
                                                                                                                                                                                                                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.TypeScheme"}, "constraints": []}}],
                                                                                                                                                                                                                        "body": {
                                                                                                                                                                                                                          "typeApplication": {
                                                                                                                                                                                                                            "body": {
                                                                                                                                                                                                                              "typeApplication": {
                                                                                                                                                                                                                                "body": {
                                                                                                                                                                                                                                  "pair": {
                                                                                                                                                                                                                                    "first": {"variable": "name"},
                                                                                                                                                                                                                                    "second": {
                                                                                                                                                                                                                                      "application": {
                                                                                                                                                                                                                                        "function": {
                                                                                                                                                                                                                                          "application": {
                                                                                                                                                                                                                                            "function": {"variable": "hydra.core.inference.buildTypeApplicationTerm"},
                                                                                                                                                                                                                                            "argument": {
                                                                                                                                                                                                                                              "application": {
                                                                                                                                                                                                                                                "function": {"project": {"typeName": "hydra.core.model.TypeScheme", "fieldName": "variables"}},
                                                                                                                                                                                                                                                "argument": {"variable": "ts"}}}}},
                                                                                                                                                                                                                                        "argument": {"inject": {"typeName": "hydra.core.model.Term", "field": {"name": "variable", "term": {"variable": "name"}}}}}}}},
                                                                                                                                                                                                                                "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                                                                                                                                            "type": {"variable": "hydra.core.model.Term"}}}}}}}}}}},
                                                                                                                                                                                                        "argument": {"variable": "tsbins1"}}}}}}},
                                                                                                                                                                                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.TermSubst"}, "constraints": []}}],
                                                                                                                                                                                        "body": {
                                                                                                                                                                                          "let": {
                                                                                                                                                                                            "bindings": [
                                                                                                                                                                                              {
                                                                                                                                                                                                "name": "createBinding",
                                                                                                                                                                                                "term": {
                                                                                                                                                                                                  "lambda": {
                                                                                                                                                                                                    "parameter": "bindingPair",
                                                                                                                                                                                                    "domain": {
                                                                                                                                                                                                      "pair": {
                                                                                                                                                                                                        "first": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.model.TypeScheme"}}},
                                                                                                                                                                                                        "second": {"variable": "hydra.core.model.Term"}}},
                                                                                                                                                                                                    "body": {
                                                                                                                                                                                                      "let": {
                                                                                                                                                                                                        "bindings": [
                                                                                                                                                                                                          {
                                                                                                                                                                                                            "name": "nameTsPair",
                                                                                                                                                                                                            "term": {
                                                                                                                                                                                                              "application": {
                                                                                                                                                                                                                "function": {
                                                                                                                                                                                                                  "typeApplication": {
                                                                                                                                                                                                                    "body": {
                                                                                                                                                                                                                      "typeApplication": {
                                                                                                                                                                                                                        "body": {"variable": "hydra.core.lib.pairs.first"},
                                                                                                                                                                                                                        "type": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.model.TypeScheme"}}}}},
                                                                                                                                                                                                                    "type": {"variable": "hydra.core.model.Term"}}},
                                                                                                                                                                                                                "argument": {"variable": "bindingPair"}}},
                                                                                                                                                                                                            "typeScheme": {
                                                                                                                                                                                                              "variables": [],
                                                                                                                                                                                                              "body": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.model.TypeScheme"}}},
                                                                                                                                                                                                              "constraints": []}}],
                                                                                                                                                                                                        "body": {
                                                                                                                                                                                                          "let": {
                                                                                                                                                                                                            "bindings": [
                                                                                                                                                                                                              {
                                                                                                                                                                                                                "name": "term",
                                                                                                                                                                                                                "term": {
                                                                                                                                                                                                                  "application": {
                                                                                                                                                                                                                    "function": {
                                                                                                                                                                                                                      "typeApplication": {
                                                                                                                                                                                                                        "body": {
                                                                                                                                                                                                                          "typeApplication": {
                                                                                                                                                                                                                            "body": {"variable": "hydra.core.lib.pairs.second"},
                                                                                                                                                                                                                            "type": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.model.TypeScheme"}}}}},
                                                                                                                                                                                                                        "type": {"variable": "hydra.core.model.Term"}}},
                                                                                                                                                                                                                    "argument": {"variable": "bindingPair"}}},
                                                                                                                                                                                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                                                                                                                                                                                            "body": {
                                                                                                                                                                                                              "let": {
                                                                                                                                                                                                                "bindings": [
                                                                                                                                                                                                                  {
                                                                                                                                                                                                                    "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.TypeScheme"}}},
                                                                                                                                                                                                                        "argument": {"variable": "nameTsPair"}}},
                                                                                                                                                                                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Name"}, "constraints": []}}],
                                                                                                                                                                                                                "body": {
                                                                                                                                                                                                                  "let": {
                                                                                                                                                                                                                    "bindings": [
                                                                                                                                                                                                                      {
                                                                                                                                                                                                                        "name": "ts",
                                                                                                                                                                                                                        "term": {
                                                                                                                                                                                                                          "application": {
                                                                                                                                                                                                                            "function": {
                                                                                                                                                                                                                              "typeApplication": {
                                                                                                                                                                                                                                "body": {
                                                                                                                                                                                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                                                                                                                                                "type": {"variable": "hydra.core.model.TypeScheme"}}},
                                                                                                                                                                                                                            "argument": {"variable": "nameTsPair"}}},
                                                                                                                                                                                                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.TypeScheme"}, "constraints": []}}],
                                                                                                                                                                                                                    "body": {
                                                                                                                                                                                                                      "let": {
                                                                                                                                                                                                                        "bindings": [
                                                                                                                                                                                                                          {
                                                                                                                                                                                                                            "name": "finalTs",
                                                                                                                                                                                                                            "term": {
                                                                                                                                                                                                                              "application": {
                                                                                                                                                                                                                                "function": {
                                                                                                                                                                                                                                  "application": {"function": {"variable": "hydra.core.substitution.substInTypeScheme"}, "argument": {"variable": "sbody"}}},
                                                                                                                                                                                                                                "argument": {"variable": "ts"}}},
                                                                                                                                                                                                                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.TypeScheme"}, "constraints": []}}],
                                                                                                                                                                                                                        "body": {
                                                                                                                                                                                                                          "let": {
                                                                                                                                                                                                                            "bindings": [
                                                                                                                                                                                                                              {
                                                                                                                                                                                                                                "name": "typeLambdaTerm",
                                                                                                                                                                                                                                "term": {
                                                                                                                                                                                                                                  "application": {
                                                                                                                                                                                                                                    "function": {
                                                                                                                                                                                                                                      "application": {
                                                                                                                                                                                                                                        "function": {
                                                                                                                                                                                                                                          "application": {
                                                                                                                                                                                                                                            "function": {
                                                                                                                                                                                                                                              "typeApplication": {
                                                                                                                                                                                                                                                "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.foldl"}, "type": {"variable": "hydra.core.model.Term"}}},
                                                                                                                                                                                                                                                "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                                                                                                                                                            "argument": {
                                                                                                                                                                                                                                              "lambda": {
                                                                                                                                                                                                                                                "parameter": "b",
                                                                                                                                                                                                                                                "domain": {"variable": "hydra.core.model.Term"},
                                                                                                                                                                                                                                                "body": {
                                                                                                                                                                                                                                                  "lambda": {
                                                                                                                                                                                                                                                    "parameter": "v",
                                                                                                                                                                                                                                                    "domain": {"variable": "hydra.core.model.Name"},
                                                                                                                                                                                                                                                    "body": {
                                                                                                                                                                                                                                                      "inject": {
                                                                                                                                                                                                                                                        "typeName": "hydra.core.model.Term",
                                                                                                                                                                                                                                                        "field": {
                                                                                                                                                                                                                                                          "name": "typeLambda",
                                                                                                                                                                                                                                                          "term": {
                                                                                                                                                                                                                                                            "record": {
                                                                                                                                                                                                                                                              "typeName": "hydra.core.model.TypeLambda",
                                                                                                                                                                                                                                                              "fields": [{"name": "parameter", "term": {"variable": "v"}}, {"name": "body", "term": {"variable": "b"}}]}}}}}}}}}}},
                                                                                                                                                                                                                                        "argument": {
                                                                                                                                                                                                                                          "application": {
                                                                                                                                                                                                                                            "function": {"application": {"function": {"variable": "hydra.core.substitution.substituteInTerm"}, "argument": {"variable": "st1"}}},
                                                                                                                                                                                                                                            "argument": {"variable": "term"}}}}},
                                                                                                                                                                                                                                    "argument": {
                                                                                                                                                                                                                                      "application": {
                                                                                                                                                                                                                                        "function": {
                                                                                                                                                                                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.lists.reverse"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                                                                                                                                                        "argument": {
                                                                                                                                                                                                                                          "application": {
                                                                                                                                                                                                                                            "function": {"project": {"typeName": "hydra.core.model.TypeScheme", "fieldName": "variables"}},
                                                                                                                                                                                                                                            "argument": {"variable": "finalTs"}}}}}}},
                                                                                                                                                                                                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                                                                                                                                                                                                            "body": {
                                                                                                                                                                                                                              "record": {
                                                                                                                                                                                                                                "typeName": "hydra.core.model.Binding",
                                                                                                                                                                                                                                "fields": [
                                                                                                                                                                                                                                  {"name": "name", "term": {"variable": "name"}},
                                                                                                                                                                                                                                  {
                                                                                                                                                                                                                                    "name": "term",
                                                                                                                                                                                                                                    "term": {
                                                                                                                                                                                                                                      "application": {
                                                                                                                                                                                                                                        "function": {
                                                                                                                                                                                                                                          "application": {
                                                                                                                                                                                                                                            "function": {"variable": "hydra.core.substitution.substTypesInTerm"},
                                                                                                                                                                                                                                            "argument": {
                                                                                                                                                                                                                                              "application": {
                                                                                                                                                                                                                                                "function": {
                                                                                                                                                                                                                                                  "application": {"function": {"variable": "hydra.core.substitution.composeTypeSubst"}, "argument": {"variable": "sbody"}}},
                                                                                                                                                                                                                                                "argument": {"variable": "s2"}}}}},
                                                                                                                                                                                                                                        "argument": {"variable": "typeLambdaTerm"}}}},
                                                                                                                                                                                                                                  {"name": "typeScheme", "term": {"optional": {"variable": "finalTs"}}}]}}}}}}}}}}}}}}}},
                                                                                                                                                                                                "typeScheme": {
                                                                                                                                                                                                  "variables": [],
                                                                                                                                                                                                  "body": {
                                                                                                                                                                                                    "function": {
                                                                                                                                                                                                      "domain": {
                                                                                                                                                                                                        "pair": {
                                                                                                                                                                                                          "first": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.model.TypeScheme"}}},
                                                                                                                                                                                                          "second": {"variable": "hydra.core.model.Term"}}},
                                                                                                                                                                                                      "codomain": {"variable": "hydra.core.model.Binding"}}},
                                                                                                                                                                                                  "constraints": []}}],
                                                                                                                                                                                            "body": {
                                                                                                                                                                                              "let": {
                                                                                                                                                                                                "bindings": [
                                                                                                                                                                                                  {
                                                                                                                                                                                                    "name": "bins1",
                                                                                                                                                                                                    "term": {
                                                                                                                                                                                                      "application": {
                                                                                                                                                                                                        "function": {
                                                                                                                                                                                                          "application": {
                                                                                                                                                                                                            "function": {
                                                                                                                                                                                                              "typeApplication": {
                                                                                                                                                                                                                "body": {
                                                                                                                                                                                                                  "typeApplication": {
                                                                                                                                                                                                                    "body": {"variable": "hydra.core.lib.lists.map"},
                                                                                                                                                                                                                    "type": {
                                                                                                                                                                                                                      "pair": {
                                                                                                                                                                                                                        "first": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.model.TypeScheme"}}},
                                                                                                                                                                                                                        "second": {"variable": "hydra.core.model.Term"}}}}},
                                                                                                                                                                                                                "type": {"variable": "hydra.core.model.Binding"}}},
                                                                                                                                                                                                            "argument": {"variable": "createBinding"}}},
                                                                                                                                                                                                        "argument": {
                                                                                                                                                                                                          "application": {
                                                                                                                                                                                                            "function": {
                                                                                                                                                                                                              "application": {
                                                                                                                                                                                                                "function": {
                                                                                                                                                                                                                  "typeApplication": {
                                                                                                                                                                                                                    "body": {
                                                                                                                                                                                                                      "typeApplication": {
                                                                                                                                                                                                                        "body": {"variable": "hydra.core.lib.lists.zip"},
                                                                                                                                                                                                                        "type": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.model.TypeScheme"}}}}},
                                                                                                                                                                                                                    "type": {"variable": "hydra.core.model.Term"}}},
                                                                                                                                                                                                                "argument": {"variable": "tsbins1"}}},
                                                                                                                                                                                                            "argument": {"variable": "bterms1Subst"}}}}},
                                                                                                                                                                                                    "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Binding"}}, "constraints": []}}],
                                                                                                                                                                                                "body": {
                                                                                                                                                                                                  "let": {
                                                                                                                                                                                                    "bindings": [
                                                                                                                                                                                                      {
                                                                                                                                                                                                        "name": "bodyConstraints",
                                                                                                                                                                                                        "term": {
                                                                                                                                                                                                          "application": {
                                                                                                                                                                                                            "function": {
                                                                                                                                                                                                              "application": {"function": {"variable": "hydra.core.substitution.substInClassConstraints"}, "argument": {"variable": "sbody"}}},
                                                                                                                                                                                                            "argument": {
                                                                                                                                                                                                              "application": {
                                                                                                                                                                                                                "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "classConstraints"}},
                                                                                                                                                                                                                "argument": {"variable": "bodyResult"}}}}},
                                                                                                                                                                                                        "typeScheme": {
                                                                                                                                                                                                          "variables": [],
                                                                                                                                                                                                          "body": {
                                                                                                                                                                                                            "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}},
                                                                                                                                                                                                          "constraints": []}}],
                                                                                                                                                                                                    "body": {
                                                                                                                                                                                                      "let": {
                                                                                                                                                                                                        "bindings": [
                                                                                                                                                                                                          {
                                                                                                                                                                                                            "name": "bindingConstraintsSubst",
                                                                                                                                                                                                            "term": {
                                                                                                                                                                                                              "application": {
                                                                                                                                                                                                                "function": {
                                                                                                                                                                                                                  "application": {"function": {"variable": "hydra.core.substitution.substInClassConstraints"}, "argument": {"variable": "sbody"}}},
                                                                                                                                                                                                                "argument": {"variable": "constraintsWithS2"}}},
                                                                                                                                                                                                            "typeScheme": {
                                                                                                                                                                                                              "variables": [],
                                                                                                                                                                                                              "body": {
                                                                                                                                                                                                                "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}},
                                                                                                                                                                                                              "constraints": []}}],
                                                                                                                                                                                                        "body": {
                                                                                                                                                                                                          "let": {
                                                                                                                                                                                                            "bindings": [
                                                                                                                                                                                                              {
                                                                                                                                                                                                                "name": "allConstraints",
                                                                                                                                                                                                                "term": {
                                                                                                                                                                                                                  "application": {
                                                                                                                                                                                                                    "function": {
                                                                                                                                                                                                                      "application": {
                                                                                                                                                                                                                        "function": {
                                                                                                                                                                                                                          "typeApplication": {"body": {"variable": "hydra.core.inference.mergeClassConstraints"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                                                                                                                                        "argument": {"variable": "bindingConstraintsSubst"}}},
                                                                                                                                                                                                                    "argument": {"variable": "bodyConstraints"}}},
                                                                                                                                                                                                                "typeScheme": {
                                                                                                                                                                                                                  "variables": [],
                                                                                                                                                                                                                  "body": {
                                                                                                                                                                                                                    "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}},
                                                                                                                                                                                                                  "constraints": []}}],
                                                                                                                                                                                                            "body": {
                                                                                                                                                                                                              "typeApplication": {
                                                                                                                                                                                                                "body": {
                                                                                                                                                                                                                  "typeApplication": {
                                                                                                                                                                                                                    "body": {
                                                                                                                                                                                                                      "either": {
                                                                                                                                                                                                                        "right": {
                                                                                                                                                                                                                          "record": {
                                                                                                                                                                                                                            "typeName": "hydra.core.typing.InferenceResult",
                                                                                                                                                                                                                            "fields": [
                                                                                                                                                                                                                              {
                                                                                                                                                                                                                                "name": "term",
                                                                                                                                                                                                                                "term": {
                                                                                                                                                                                                                                  "inject": {
                                                                                                                                                                                                                                    "typeName": "hydra.core.model.Term",
                                                                                                                                                                                                                                    "field": {
                                                                                                                                                                                                                                      "name": "let",
                                                                                                                                                                                                                                      "term": {
                                                                                                                                                                                                                                        "record": {
                                                                                                                                                                                                                                          "typeName": "hydra.core.model.Let",
                                                                                                                                                                                                                                          "fields": [{"name": "bindings", "term": {"variable": "bins1"}}, {"name": "body", "term": {"variable": "body1"}}]}}}}}},
                                                                                                                                                                                                                              {"name": "type", "term": {"variable": "tbody"}},
                                                                                                                                                                                                                              {
                                                                                                                                                                                                                                "name": "subst",
                                                                                                                                                                                                                                "term": {
                                                                                                                                                                                                                                  "application": {
                                                                                                                                                                                                                                    "function": {"variable": "hydra.core.substitution.composeTypeSubstList"},
                                                                                                                                                                                                                                    "argument": {"list": [{"variable": "s1"}, {"variable": "s2"}, {"variable": "sbody"}]}}}},
                                                                                                                                                                                                                              {"name": "classConstraints", "term": {"variable": "allConstraints"}},
                                                                                                                                                                                                                              {"name": "context", "term": {"variable": "fcx4"}}]}}}},
                                                                                                                                                                                                                    "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                                                                                                                                                "type": {"variable": "hydra.core.typing.InferenceResult"}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {
                    "literal": {
                      "string": "Infer the type of a let (letrec) term which is already in a normal form (Either version). Paper: inference.tex, rule Let (elaboration form)."}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.inference.inferTypeOfList",
        "signature": {
          "typeParameters": [],
          "parameters": [
            {"name": "arg0", "type": {"variable": "hydra.core.typing.InferenceContext"}, "isLazy": false},
            {"name": "arg1", "type": {"variable": "hydra.core.graph.Graph"}, "isLazy": false},
            {"name": "arg2", "type": {"list": {"variable": "hydra.core.model.Term"}}, "isLazy": false}],
          "result": {
            "type": {
              "either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.typing.InferenceResult"}}}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "fcx",
                "domain": {"variable": "hydra.core.typing.InferenceContext"},
                "body": {
                  "lambda": {
                    "parameter": "cx",
                    "domain": {"variable": "hydra.core.graph.Graph"},
                    "body": {
                      "application": {
                        "function": {
                          "application": {
                            "function": {
                              "application": {
                                "function": {
                                  "application": {
                                    "function": {
                                      "application": {
                                        "function": {
                                          "application": {"function": {"variable": "hydra.core.inference.inferTypeOfCollection"}, "argument": {"variable": "fcx"}}},
                                        "argument": {"variable": "cx"}}},
                                    "argument": {
                                      "lambda": {
                                        "parameter": "x",
                                        "domain": {"variable": "hydra.core.model.Type"},
                                        "body": {"inject": {"typeName": "hydra.core.model.Type", "field": {"name": "list", "term": {"variable": "x"}}}}}}}},
                                "argument": {
                                  "lambda": {
                                    "parameter": "x",
                                    "domain": {"list": {"variable": "hydra.core.model.Term"}},
                                    "body": {"inject": {"typeName": "hydra.core.model.Term", "field": {"name": "list", "term": {"variable": "x"}}}}}}}},
                            "argument": {"literal": {"string": "list element"}}}},
                        "argument": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.empty"}, "type": {"variable": "hydra.core.model.Name"}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {"literal": {"string": "Infer the type of a list (Either version). Paper: inference.tex, rules Lst_0 and Lst_+."}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.inference.inferTypeOfLiteral",
        "signature": {
          "typeParameters": [],
          "parameters": [
            {"name": "arg0", "type": {"variable": "hydra.core.typing.InferenceContext"}, "isLazy": false},
            {"name": "arg1", "type": {"variable": "hydra.core.model.Literal"}, "isLazy": false}],
          "result": {"type": {"variable": "hydra.core.typing.InferenceResult"}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "fcx",
                "domain": {"variable": "hydra.core.typing.InferenceContext"},
                "body": {
                  "lambda": {
                    "parameter": "lit",
                    "domain": {"variable": "hydra.core.model.Literal"},
                    "body": {
                      "record": {
                        "typeName": "hydra.core.typing.InferenceResult",
                        "fields": [
                          {
                            "name": "term",
                            "term": {"inject": {"typeName": "hydra.core.model.Term", "field": {"name": "literal", "term": {"variable": "lit"}}}}},
                          {
                            "name": "type",
                            "term": {
                              "inject": {
                                "typeName": "hydra.core.model.Type",
                                "field": {
                                  "name": "literal",
                                  "term": {"application": {"function": {"variable": "hydra.core.reflect.literalType"}, "argument": {"variable": "lit"}}}}}}},
                          {"name": "subst", "term": {"variable": "hydra.core.substitution.idTypeSubst"}},
                          {
                            "name": "classConstraints",
                            "term": {
                              "typeApplication": {
                                "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.empty"}, "type": {"variable": "hydra.core.model.Name"}}},
                                "type": {"variable": "hydra.core.model.TypeVariableConstraints"}}}},
                          {"name": "context", "term": {"variable": "fcx"}}]}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {"literal": {"string": "Infer the type of a literal. Paper: inference.tex, rule Lit."}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.inference.inferTypeOfMap",
        "signature": {
          "typeParameters": [],
          "parameters": [
            {"name": "arg0", "type": {"variable": "hydra.core.typing.InferenceContext"}, "isLazy": false},
            {"name": "arg1", "type": {"variable": "hydra.core.graph.Graph"}, "isLazy": false},
            {
              "name": "arg2",
              "type": {"map": {"keys": {"variable": "hydra.core.model.Term"}, "values": {"variable": "hydra.core.model.Term"}}},
              "isLazy": false}],
          "result": {
            "type": {
              "either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.typing.InferenceResult"}}}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "fcx",
                "domain": {"variable": "hydra.core.typing.InferenceContext"},
                "body": {
                  "lambda": {
                    "parameter": "cx",
                    "domain": {"variable": "hydra.core.graph.Graph"},
                    "body": {
                      "lambda": {
                        "parameter": "m",
                        "domain": {"map": {"keys": {"variable": "hydra.core.model.Term"}, "values": {"variable": "hydra.core.model.Term"}}},
                        "body": {
                          "let": {
                            "bindings": [
                              {
                                "name": "kvarResult",
                                "term": {"application": {"function": {"variable": "hydra.core.names.freshName"}, "argument": {"variable": "fcx"}}},
                                "typeScheme": {
                                  "variables": [],
                                  "body": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}},
                                  "constraints": []}}],
                            "body": {
                              "let": {
                                "bindings": [
                                  {
                                    "name": "kvar",
                                    "term": {
                                      "application": {
                                        "function": {
                                          "typeApplication": {
                                            "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"variable": "hydra.core.model.Name"}}},
                                            "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                        "argument": {"variable": "kvarResult"}}},
                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Name"}, "constraints": []}}],
                                "body": {
                                  "let": {
                                    "bindings": [
                                      {
                                        "name": "fcx2",
                                        "term": {
                                          "application": {
                                            "function": {
                                              "typeApplication": {
                                                "body": {
                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                            "argument": {"variable": "kvarResult"}}},
                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "constraints": []}}],
                                    "body": {
                                      "let": {
                                        "bindings": [
                                          {
                                            "name": "vvarResult",
                                            "term": {"application": {"function": {"variable": "hydra.core.names.freshName"}, "argument": {"variable": "fcx2"}}},
                                            "typeScheme": {
                                              "variables": [],
                                              "body": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}},
                                              "constraints": []}}],
                                        "body": {
                                          "let": {
                                            "bindings": [
                                              {
                                                "name": "vvar",
                                                "term": {
                                                  "application": {
                                                    "function": {
                                                      "typeApplication": {
                                                        "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                        "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                    "argument": {"variable": "vvarResult"}}},
                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Name"}, "constraints": []}}],
                                            "body": {
                                              "let": {
                                                "bindings": [
                                                  {
                                                    "name": "fcx3",
                                                    "term": {
                                                      "application": {
                                                        "function": {
                                                          "typeApplication": {
                                                            "body": {
                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                            "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                        "argument": {"variable": "vvarResult"}}},
                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "constraints": []}}],
                                                "body": {
                                                  "let": {
                                                    "bindings": [
                                                      {
                                                        "name": "keyConstraints",
                                                        "term": {
                                                          "application": {
                                                            "function": {
                                                              "application": {
                                                                "function": {
                                                                  "typeApplication": {
                                                                    "body": {
                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.maps.singleton"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                    "type": {"variable": "hydra.core.model.TypeVariableConstraints"}}},
                                                                "argument": {"variable": "kvar"}}},
                                                            "argument": {
                                                              "record": {
                                                                "typeName": "hydra.core.model.TypeVariableConstraints",
                                                                "fields": [
                                                                  {
                                                                    "name": "classes",
                                                                    "term": {
                                                                      "application": {
                                                                        "function": {
                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.sets.singleton"}, "type": {"variable": "hydra.core.model.TypeClassConstraint"}}},
                                                                        "argument": {
                                                                          "inject": {
                                                                            "typeName": "hydra.core.model.TypeClassConstraint",
                                                                            "field": {"name": "simple", "term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "ordering"}}}}}}}}}}]}}}},
                                                        "typeScheme": {
                                                          "variables": [],
                                                          "body": {
                                                            "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}},
                                                          "constraints": []}}],
                                                    "body": {
                                                      "application": {
                                                        "function": {
                                                          "application": {
                                                            "function": {
                                                              "application": {
                                                                "function": {
                                                                  "typeApplication": {
                                                                    "body": {"variable": "hydra.core.lib.logic.ifElse"},
                                                                    "type": {
                                                                      "either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.typing.InferenceResult"}}}}},
                                                                "argument": {
                                                                  "application": {
                                                                    "function": {
                                                                      "typeApplication": {
                                                                        "body": {
                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.maps.isEmpty"}, "type": {"variable": "hydra.core.model.Term"}}},
                                                                        "type": {"variable": "hydra.core.model.Term"}}},
                                                                    "argument": {"variable": "m"}}}}},
                                                            "argument": {
                                                              "typeApplication": {
                                                                "body": {
                                                                  "typeApplication": {
                                                                    "body": {
                                                                      "either": {
                                                                        "right": {
                                                                          "application": {
                                                                            "function": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "application": {
                                                                                    "function": {
                                                                                      "application": {
                                                                                        "function": {
                                                                                          "application": {"function": {"variable": "hydra.core.inference.yieldWithConstraints"}, "argument": {"variable": "fcx3"}}},
                                                                                        "argument": {
                                                                                          "application": {
                                                                                            "function": {
                                                                                              "application": {
                                                                                                "function": {"variable": "hydra.core.inference.buildTypeApplicationTerm"},
                                                                                                "argument": {"list": [{"variable": "kvar"}, {"variable": "vvar"}]}}},
                                                                                            "argument": {
                                                                                              "inject": {
                                                                                                "typeName": "hydra.core.model.Term",
                                                                                                "field": {
                                                                                                  "name": "map",
                                                                                                  "term": {
                                                                                                    "typeApplication": {
                                                                                                      "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.empty"}, "type": {"variable": "hydra.core.model.Term"}}},
                                                                                                      "type": {"variable": "hydra.core.model.Term"}}}}}}}}}},
                                                                                    "argument": {
                                                                                      "inject": {
                                                                                        "typeName": "hydra.core.model.Type",
                                                                                        "field": {
                                                                                          "name": "map",
                                                                                          "term": {
                                                                                            "record": {
                                                                                              "typeName": "hydra.core.model.MapType",
                                                                                              "fields": [
                                                                                                {
                                                                                                  "name": "keys",
                                                                                                  "term": {"inject": {"typeName": "hydra.core.model.Type", "field": {"name": "variable", "term": {"variable": "kvar"}}}}},
                                                                                                {
                                                                                                  "name": "values",
                                                                                                  "term": {"inject": {"typeName": "hydra.core.model.Type", "field": {"name": "variable", "term": {"variable": "vvar"}}}}}]}}}}}}},
                                                                                "argument": {"variable": "hydra.core.substitution.idTypeSubst"}}},
                                                                            "argument": {"variable": "keyConstraints"}}}}},
                                                                    "type": {"variable": "hydra.core.errors.Error"}}},
                                                                "type": {"variable": "hydra.core.typing.InferenceResult"}}}}},
                                                        "argument": {
                                                          "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": {
                                                                              "pair": {
                                                                                "first": {"list": {"variable": "hydra.core.model.Term"}},
                                                                                "second": {
                                                                                  "pair": {
                                                                                    "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                    "second": {
                                                                                      "pair": {
                                                                                        "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                        "second": {
                                                                                          "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}},
                                                                            "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                    "type": {"variable": "hydra.core.typing.InferenceResult"}}},
                                                                "argument": {
                                                                  "application": {
                                                                    "function": {
                                                                      "application": {
                                                                        "function": {"application": {"function": {"variable": "hydra.core.inference.inferMany"}, "argument": {"variable": "fcx3"}}},
                                                                        "argument": {"variable": "cx"}}},
                                                                    "argument": {
                                                                      "application": {
                                                                        "function": {
                                                                          "application": {
                                                                            "function": {
                                                                              "typeApplication": {
                                                                                "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.model.Term"}}},
                                                                                "type": {"pair": {"first": {"variable": "hydra.core.model.Term"}, "second": {"literal": "string"}}}}},
                                                                            "argument": {
                                                                              "lambda": {
                                                                                "parameter": "k",
                                                                                "domain": {"variable": "hydra.core.model.Term"},
                                                                                "body": {
                                                                                  "typeApplication": {
                                                                                    "body": {
                                                                                      "typeApplication": {
                                                                                        "body": {"pair": {"first": {"variable": "k"}, "second": {"literal": {"string": "map key"}}}},
                                                                                        "type": {"variable": "hydra.core.model.Term"}}},
                                                                                    "type": {"literal": "string"}}}}}}},
                                                                        "argument": {
                                                                          "application": {
                                                                            "function": {
                                                                              "typeApplication": {
                                                                                "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.keys"}, "type": {"variable": "hydra.core.model.Term"}}},
                                                                                "type": {"variable": "hydra.core.model.Term"}}},
                                                                            "argument": {"variable": "m"}}}}}}}}},
                                                            "argument": {
                                                              "lambda": {
                                                                "parameter": "kRp",
                                                                "domain": {
                                                                  "pair": {
                                                                    "first": {
                                                                      "pair": {
                                                                        "first": {"list": {"variable": "hydra.core.model.Term"}},
                                                                        "second": {
                                                                          "pair": {
                                                                            "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                            "second": {
                                                                              "pair": {
                                                                                "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                "second": {
                                                                                  "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}},
                                                                    "second": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                "body": {
                                                                  "let": {
                                                                    "bindings": [
                                                                      {
                                                                        "name": "kResults",
                                                                        "term": {
                                                                          "application": {
                                                                            "function": {
                                                                              "typeApplication": {
                                                                                "body": {
                                                                                  "typeApplication": {
                                                                                    "body": {"variable": "hydra.core.lib.pairs.first"},
                                                                                    "type": {
                                                                                      "pair": {
                                                                                        "first": {"list": {"variable": "hydra.core.model.Term"}},
                                                                                        "second": {
                                                                                          "pair": {
                                                                                            "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                            "second": {
                                                                                              "pair": {
                                                                                                "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                "second": {
                                                                                                  "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}}}},
                                                                                "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                            "argument": {"variable": "kRp"}}},
                                                                        "typeScheme": {
                                                                          "variables": [],
                                                                          "body": {
                                                                            "pair": {
                                                                              "first": {"list": {"variable": "hydra.core.model.Term"}},
                                                                              "second": {
                                                                                "pair": {
                                                                                  "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                  "second": {
                                                                                    "pair": {
                                                                                      "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                      "second": {
                                                                                        "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}},
                                                                          "constraints": []}}],
                                                                    "body": {
                                                                      "let": {
                                                                        "bindings": [
                                                                          {
                                                                            "name": "fcx4",
                                                                            "term": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "typeApplication": {
                                                                                    "body": {
                                                                                      "typeApplication": {
                                                                                        "body": {"variable": "hydra.core.lib.pairs.second"},
                                                                                        "type": {
                                                                                          "pair": {
                                                                                            "first": {"list": {"variable": "hydra.core.model.Term"}},
                                                                                            "second": {
                                                                                              "pair": {
                                                                                                "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                                "second": {
                                                                                                  "pair": {
                                                                                                    "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                    "second": {
                                                                                                      "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}}}},
                                                                                    "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                "argument": {"variable": "kRp"}}},
                                                                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "constraints": []}}],
                                                                        "body": {
                                                                          "let": {
                                                                            "bindings": [
                                                                              {
                                                                                "name": "kterms",
                                                                                "term": {
                                                                                  "application": {
                                                                                    "function": {
                                                                                      "typeApplication": {
                                                                                        "body": {
                                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"list": {"variable": "hydra.core.model.Term"}}}},
                                                                                        "type": {
                                                                                          "pair": {
                                                                                            "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                            "second": {
                                                                                              "pair": {
                                                                                                "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                "second": {
                                                                                                  "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}},
                                                                                    "argument": {"variable": "kResults"}}},
                                                                                "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Term"}}, "constraints": []}}],
                                                                            "body": {
                                                                              "let": {
                                                                                "bindings": [
                                                                                  {
                                                                                    "name": "ktypes",
                                                                                    "term": {
                                                                                      "application": {
                                                                                        "function": {
                                                                                          "typeApplication": {
                                                                                            "body": {
                                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                                                            "type": {
                                                                                              "pair": {
                                                                                                "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                "second": {
                                                                                                  "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}},
                                                                                        "argument": {
                                                                                          "application": {
                                                                                            "function": {
                                                                                              "typeApplication": {
                                                                                                "body": {
                                                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"list": {"variable": "hydra.core.model.Term"}}}},
                                                                                                "type": {
                                                                                                  "pair": {
                                                                                                    "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                                    "second": {
                                                                                                      "pair": {
                                                                                                        "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                        "second": {
                                                                                                          "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}},
                                                                                            "argument": {"variable": "kResults"}}}}},
                                                                                    "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Type"}}, "constraints": []}}],
                                                                                "body": {
                                                                                  "let": {
                                                                                    "bindings": [
                                                                                      {
                                                                                        "name": "ksubst",
                                                                                        "term": {
                                                                                          "application": {
                                                                                            "function": {
                                                                                              "typeApplication": {
                                                                                                "body": {
                                                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"variable": "hydra.core.typing.TypeSubst"}}},
                                                                                                "type": {
                                                                                                  "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}},
                                                                                            "argument": {
                                                                                              "application": {
                                                                                                "function": {
                                                                                                  "typeApplication": {
                                                                                                    "body": {
                                                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                                                                    "type": {
                                                                                                      "pair": {
                                                                                                        "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                        "second": {
                                                                                                          "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}},
                                                                                                "argument": {
                                                                                                  "application": {
                                                                                                    "function": {
                                                                                                      "typeApplication": {
                                                                                                        "body": {
                                                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"list": {"variable": "hydra.core.model.Term"}}}},
                                                                                                        "type": {
                                                                                                          "pair": {
                                                                                                            "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                                            "second": {
                                                                                                              "pair": {
                                                                                                                "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                                "second": {
                                                                                                                  "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}},
                                                                                                    "argument": {"variable": "kResults"}}}}}}},
                                                                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.TypeSubst"}, "constraints": []}}],
                                                                                    "body": {
                                                                                      "let": {
                                                                                        "bindings": [
                                                                                          {
                                                                                            "name": "kElemConstraints",
                                                                                            "term": {
                                                                                              "application": {
                                                                                                "function": {
                                                                                                  "typeApplication": {
                                                                                                    "body": {
                                                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"variable": "hydra.core.typing.TypeSubst"}}},
                                                                                                    "type": {
                                                                                                      "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}},
                                                                                                "argument": {
                                                                                                  "application": {
                                                                                                    "function": {
                                                                                                      "typeApplication": {
                                                                                                        "body": {
                                                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                                                                        "type": {
                                                                                                          "pair": {
                                                                                                            "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                            "second": {
                                                                                                              "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}},
                                                                                                    "argument": {
                                                                                                      "application": {
                                                                                                        "function": {
                                                                                                          "typeApplication": {
                                                                                                            "body": {
                                                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"list": {"variable": "hydra.core.model.Term"}}}},
                                                                                                            "type": {
                                                                                                              "pair": {
                                                                                                                "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                                                "second": {
                                                                                                                  "pair": {
                                                                                                                    "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                                    "second": {
                                                                                                                      "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}},
                                                                                                        "argument": {"variable": "kResults"}}}}}}},
                                                                                            "typeScheme": {
                                                                                              "variables": [],
                                                                                              "body": {
                                                                                                "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}},
                                                                                              "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": {
                                                                                                          "pair": {
                                                                                                            "first": {
                                                                                                              "pair": {
                                                                                                                "first": {"list": {"variable": "hydra.core.model.Term"}},
                                                                                                                "second": {
                                                                                                                  "pair": {
                                                                                                                    "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                                                    "second": {
                                                                                                                      "pair": {
                                                                                                                        "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                                        "second": {
                                                                                                                          "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}},
                                                                                                            "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                                    "type": {"variable": "hydra.core.typing.InferenceResult"}}},
                                                                                                "argument": {
                                                                                                  "application": {
                                                                                                    "function": {
                                                                                                      "application": {
                                                                                                        "function": {"application": {"function": {"variable": "hydra.core.inference.inferMany"}, "argument": {"variable": "fcx4"}}},
                                                                                                        "argument": {
                                                                                                          "application": {
                                                                                                            "function": {
                                                                                                              "application": {"function": {"variable": "hydra.core.substitution.substInContext"}, "argument": {"variable": "ksubst"}}},
                                                                                                            "argument": {"variable": "cx"}}}}},
                                                                                                    "argument": {
                                                                                                      "application": {
                                                                                                        "function": {
                                                                                                          "application": {
                                                                                                            "function": {
                                                                                                              "typeApplication": {
                                                                                                                "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.model.Term"}}},
                                                                                                                "type": {"pair": {"first": {"variable": "hydra.core.model.Term"}, "second": {"literal": "string"}}}}},
                                                                                                            "argument": {
                                                                                                              "lambda": {
                                                                                                                "parameter": "v",
                                                                                                                "domain": {"variable": "hydra.core.model.Term"},
                                                                                                                "body": {
                                                                                                                  "typeApplication": {
                                                                                                                    "body": {
                                                                                                                      "typeApplication": {
                                                                                                                        "body": {"pair": {"first": {"variable": "v"}, "second": {"literal": {"string": "map value"}}}},
                                                                                                                        "type": {"variable": "hydra.core.model.Term"}}},
                                                                                                                    "type": {"literal": "string"}}}}}}},
                                                                                                        "argument": {
                                                                                                          "application": {
                                                                                                            "function": {
                                                                                                              "typeApplication": {
                                                                                                                "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.elems"}, "type": {"variable": "hydra.core.model.Term"}}},
                                                                                                                "type": {"variable": "hydra.core.model.Term"}}},
                                                                                                            "argument": {"variable": "m"}}}}}}}}},
                                                                                            "argument": {
                                                                                              "lambda": {
                                                                                                "parameter": "vRp",
                                                                                                "domain": {
                                                                                                  "pair": {
                                                                                                    "first": {
                                                                                                      "pair": {
                                                                                                        "first": {"list": {"variable": "hydra.core.model.Term"}},
                                                                                                        "second": {
                                                                                                          "pair": {
                                                                                                            "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                                            "second": {
                                                                                                              "pair": {
                                                                                                                "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                                "second": {
                                                                                                                  "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}},
                                                                                                    "second": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                                "body": {
                                                                                                  "let": {
                                                                                                    "bindings": [
                                                                                                      {
                                                                                                        "name": "vResults",
                                                                                                        "term": {
                                                                                                          "application": {
                                                                                                            "function": {
                                                                                                              "typeApplication": {
                                                                                                                "body": {
                                                                                                                  "typeApplication": {
                                                                                                                    "body": {"variable": "hydra.core.lib.pairs.first"},
                                                                                                                    "type": {
                                                                                                                      "pair": {
                                                                                                                        "first": {"list": {"variable": "hydra.core.model.Term"}},
                                                                                                                        "second": {
                                                                                                                          "pair": {
                                                                                                                            "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                                                            "second": {
                                                                                                                              "pair": {
                                                                                                                                "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                                                "second": {
                                                                                                                                  "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}}}},
                                                                                                                "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                                            "argument": {"variable": "vRp"}}},
                                                                                                        "typeScheme": {
                                                                                                          "variables": [],
                                                                                                          "body": {
                                                                                                            "pair": {
                                                                                                              "first": {"list": {"variable": "hydra.core.model.Term"}},
                                                                                                              "second": {
                                                                                                                "pair": {
                                                                                                                  "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                                                  "second": {
                                                                                                                    "pair": {
                                                                                                                      "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                                      "second": {
                                                                                                                        "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}},
                                                                                                          "constraints": []}}],
                                                                                                    "body": {
                                                                                                      "let": {
                                                                                                        "bindings": [
                                                                                                          {
                                                                                                            "name": "fcx5",
                                                                                                            "term": {
                                                                                                              "application": {
                                                                                                                "function": {
                                                                                                                  "typeApplication": {
                                                                                                                    "body": {
                                                                                                                      "typeApplication": {
                                                                                                                        "body": {"variable": "hydra.core.lib.pairs.second"},
                                                                                                                        "type": {
                                                                                                                          "pair": {
                                                                                                                            "first": {"list": {"variable": "hydra.core.model.Term"}},
                                                                                                                            "second": {
                                                                                                                              "pair": {
                                                                                                                                "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                                                                "second": {
                                                                                                                                  "pair": {
                                                                                                                                    "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                                                    "second": {
                                                                                                                                      "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}}}},
                                                                                                                    "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                                                "argument": {"variable": "vRp"}}},
                                                                                                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "constraints": []}}],
                                                                                                        "body": {
                                                                                                          "let": {
                                                                                                            "bindings": [
                                                                                                              {
                                                                                                                "name": "vterms",
                                                                                                                "term": {
                                                                                                                  "application": {
                                                                                                                    "function": {
                                                                                                                      "typeApplication": {
                                                                                                                        "body": {
                                                                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"list": {"variable": "hydra.core.model.Term"}}}},
                                                                                                                        "type": {
                                                                                                                          "pair": {
                                                                                                                            "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                                                            "second": {
                                                                                                                              "pair": {
                                                                                                                                "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                                                "second": {
                                                                                                                                  "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}},
                                                                                                                    "argument": {"variable": "vResults"}}},
                                                                                                                "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Term"}}, "constraints": []}}],
                                                                                                            "body": {
                                                                                                              "let": {
                                                                                                                "bindings": [
                                                                                                                  {
                                                                                                                    "name": "vtypes",
                                                                                                                    "term": {
                                                                                                                      "application": {
                                                                                                                        "function": {
                                                                                                                          "typeApplication": {
                                                                                                                            "body": {
                                                                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                                                                                            "type": {
                                                                                                                              "pair": {
                                                                                                                                "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                                                "second": {
                                                                                                                                  "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}},
                                                                                                                        "argument": {
                                                                                                                          "application": {
                                                                                                                            "function": {
                                                                                                                              "typeApplication": {
                                                                                                                                "body": {
                                                                                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"list": {"variable": "hydra.core.model.Term"}}}},
                                                                                                                                "type": {
                                                                                                                                  "pair": {
                                                                                                                                    "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                                                                    "second": {
                                                                                                                                      "pair": {
                                                                                                                                        "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                                                        "second": {
                                                                                                                                          "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}},
                                                                                                                            "argument": {"variable": "vResults"}}}}},
                                                                                                                    "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Type"}}, "constraints": []}}],
                                                                                                                "body": {
                                                                                                                  "let": {
                                                                                                                    "bindings": [
                                                                                                                      {
                                                                                                                        "name": "vsubst",
                                                                                                                        "term": {
                                                                                                                          "application": {
                                                                                                                            "function": {
                                                                                                                              "typeApplication": {
                                                                                                                                "body": {
                                                                                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"variable": "hydra.core.typing.TypeSubst"}}},
                                                                                                                                "type": {
                                                                                                                                  "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}},
                                                                                                                            "argument": {
                                                                                                                              "application": {
                                                                                                                                "function": {
                                                                                                                                  "typeApplication": {
                                                                                                                                    "body": {
                                                                                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                                                                                                    "type": {
                                                                                                                                      "pair": {
                                                                                                                                        "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                                                        "second": {
                                                                                                                                          "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}},
                                                                                                                                "argument": {
                                                                                                                                  "application": {
                                                                                                                                    "function": {
                                                                                                                                      "typeApplication": {
                                                                                                                                        "body": {
                                                                                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"list": {"variable": "hydra.core.model.Term"}}}},
                                                                                                                                        "type": {
                                                                                                                                          "pair": {
                                                                                                                                            "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                                                                            "second": {
                                                                                                                                              "pair": {
                                                                                                                                                "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                                                                "second": {
                                                                                                                                                  "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}},
                                                                                                                                    "argument": {"variable": "vResults"}}}}}}},
                                                                                                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.TypeSubst"}, "constraints": []}}],
                                                                                                                    "body": {
                                                                                                                      "let": {
                                                                                                                        "bindings": [
                                                                                                                          {
                                                                                                                            "name": "vElemConstraints",
                                                                                                                            "term": {
                                                                                                                              "application": {
                                                                                                                                "function": {
                                                                                                                                  "typeApplication": {
                                                                                                                                    "body": {
                                                                                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"variable": "hydra.core.typing.TypeSubst"}}},
                                                                                                                                    "type": {
                                                                                                                                      "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}},
                                                                                                                                "argument": {
                                                                                                                                  "application": {
                                                                                                                                    "function": {
                                                                                                                                      "typeApplication": {
                                                                                                                                        "body": {
                                                                                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                                                                                                        "type": {
                                                                                                                                          "pair": {
                                                                                                                                            "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                                                            "second": {
                                                                                                                                              "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}},
                                                                                                                                    "argument": {
                                                                                                                                      "application": {
                                                                                                                                        "function": {
                                                                                                                                          "typeApplication": {
                                                                                                                                            "body": {
                                                                                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"list": {"variable": "hydra.core.model.Term"}}}},
                                                                                                                                            "type": {
                                                                                                                                              "pair": {
                                                                                                                                                "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                                                                                "second": {
                                                                                                                                                  "pair": {
                                                                                                                                                    "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                                                                    "second": {
                                                                                                                                                      "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}},
                                                                                                                                        "argument": {"variable": "vResults"}}}}}}},
                                                                                                                            "typeScheme": {
                                                                                                                              "variables": [],
                                                                                                                              "body": {
                                                                                                                                "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}},
                                                                                                                              "constraints": []}}],
                                                                                                                        "body": {
                                                                                                                          "let": {
                                                                                                                            "bindings": [
                                                                                                                              {
                                                                                                                                "name": "kcons",
                                                                                                                                "term": {
                                                                                                                                  "application": {
                                                                                                                                    "function": {
                                                                                                                                      "application": {
                                                                                                                                        "function": {
                                                                                                                                          "typeApplication": {
                                                                                                                                            "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                                                                                            "type": {"variable": "hydra.core.typing.TypeConstraint"}}},
                                                                                                                                        "argument": {
                                                                                                                                          "lambda": {
                                                                                                                                            "parameter": "t",
                                                                                                                                            "domain": {"variable": "hydra.core.model.Type"},
                                                                                                                                            "body": {
                                                                                                                                              "record": {
                                                                                                                                                "typeName": "hydra.core.typing.TypeConstraint",
                                                                                                                                                "fields": [
                                                                                                                                                  {
                                                                                                                                                    "name": "left",
                                                                                                                                                    "term": {"inject": {"typeName": "hydra.core.model.Type", "field": {"name": "variable", "term": {"variable": "kvar"}}}}},
                                                                                                                                                  {"name": "right", "term": {"variable": "t"}},
                                                                                                                                                  {"name": "comment", "term": {"literal": {"string": "map key"}}}]}}}}}},
                                                                                                                                    "argument": {"variable": "ktypes"}}},
                                                                                                                                "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.typing.TypeConstraint"}}, "constraints": []}}],
                                                                                                                            "body": {
                                                                                                                              "let": {
                                                                                                                                "bindings": [
                                                                                                                                  {
                                                                                                                                    "name": "vcons",
                                                                                                                                    "term": {
                                                                                                                                      "application": {
                                                                                                                                        "function": {
                                                                                                                                          "application": {
                                                                                                                                            "function": {
                                                                                                                                              "typeApplication": {
                                                                                                                                                "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                                                                                                "type": {"variable": "hydra.core.typing.TypeConstraint"}}},
                                                                                                                                            "argument": {
                                                                                                                                              "lambda": {
                                                                                                                                                "parameter": "t",
                                                                                                                                                "domain": {"variable": "hydra.core.model.Type"},
                                                                                                                                                "body": {
                                                                                                                                                  "record": {
                                                                                                                                                    "typeName": "hydra.core.typing.TypeConstraint",
                                                                                                                                                    "fields": [
                                                                                                                                                      {
                                                                                                                                                        "name": "left",
                                                                                                                                                        "term": {"inject": {"typeName": "hydra.core.model.Type", "field": {"name": "variable", "term": {"variable": "vvar"}}}}},
                                                                                                                                                      {"name": "right", "term": {"variable": "t"}},
                                                                                                                                                      {"name": "comment", "term": {"literal": {"string": "map value"}}}]}}}}}},
                                                                                                                                        "argument": {"variable": "vtypes"}}},
                                                                                                                                    "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.typing.TypeConstraint"}}, "constraints": []}}],
                                                                                                                                "body": {
                                                                                                                                  "let": {
                                                                                                                                    "bindings": [
                                                                                                                                      {
                                                                                                                                        "name": "allMapConstraints",
                                                                                                                                        "term": {
                                                                                                                                          "application": {
                                                                                                                                            "function": {
                                                                                                                                              "application": {
                                                                                                                                                "function": {
                                                                                                                                                  "typeApplication": {"body": {"variable": "hydra.core.inference.mergeClassConstraints"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                                                                "argument": {"variable": "keyConstraints"}}},
                                                                                                                                            "argument": {
                                                                                                                                              "application": {
                                                                                                                                                "function": {
                                                                                                                                                  "application": {
                                                                                                                                                    "function": {
                                                                                                                                                      "typeApplication": {"body": {"variable": "hydra.core.inference.mergeClassConstraints"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                                                                    "argument": {"variable": "kElemConstraints"}}},
                                                                                                                                                "argument": {"variable": "vElemConstraints"}}}}},
                                                                                                                                        "typeScheme": {
                                                                                                                                          "variables": [],
                                                                                                                                          "body": {
                                                                                                                                            "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}},
                                                                                                                                          "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.InferenceResult"}}},
                                                                                                                                                "type": {"variable": "hydra.core.typing.InferenceResult"}}},
                                                                                                                                            "argument": {
                                                                                                                                              "application": {
                                                                                                                                                "function": {
                                                                                                                                                  "application": {
                                                                                                                                                    "function": {
                                                                                                                                                      "application": {
                                                                                                                                                        "function": {
                                                                                                                                                          "application": {
                                                                                                                                                            "function": {
                                                                                                                                                              "typeApplication": {"body": {"variable": "hydra.core.inference.mapConstraints"}, "type": {"variable": "hydra.core.typing.InferenceResult"}}},
                                                                                                                                                            "argument": {"variable": "fcx5"}}},
                                                                                                                                                        "argument": {"variable": "cx"}}},
                                                                                                                                                    "argument": {
                                                                                                                                                      "lambda": {
                                                                                                                                                        "parameter": "subst",
                                                                                                                                                        "domain": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                                                                        "body": {
                                                                                                                                                          "application": {
                                                                                                                                                            "function": {
                                                                                                                                                              "application": {
                                                                                                                                                                "function": {
                                                                                                                                                                  "application": {
                                                                                                                                                                    "function": {
                                                                                                                                                                      "application": {
                                                                                                                                                                        "function": {
                                                                                                                                                                          "application": {"function": {"variable": "hydra.core.inference.yieldWithConstraints"}, "argument": {"variable": "fcx5"}}},
                                                                                                                                                                        "argument": {
                                                                                                                                                                          "inject": {
                                                                                                                                                                            "typeName": "hydra.core.model.Term",
                                                                                                                                                                            "field": {
                                                                                                                                                                              "name": "map",
                                                                                                                                                                              "term": {
                                                                                                                                                                                "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.zip"}, "type": {"variable": "hydra.core.model.Term"}}},
                                                                                                                                                                                              "type": {"variable": "hydra.core.model.Term"}}},
                                                                                                                                                                                          "argument": {"variable": "kterms"}}},
                                                                                                                                                                                      "argument": {"variable": "vterms"}}}}}}}}}},
                                                                                                                                                                    "argument": {
                                                                                                                                                                      "inject": {
                                                                                                                                                                        "typeName": "hydra.core.model.Type",
                                                                                                                                                                        "field": {
                                                                                                                                                                          "name": "map",
                                                                                                                                                                          "term": {
                                                                                                                                                                            "record": {
                                                                                                                                                                              "typeName": "hydra.core.model.MapType",
                                                                                                                                                                              "fields": [
                                                                                                                                                                                {
                                                                                                                                                                                  "name": "keys",
                                                                                                                                                                                  "term": {"inject": {"typeName": "hydra.core.model.Type", "field": {"name": "variable", "term": {"variable": "kvar"}}}}},
                                                                                                                                                                                {
                                                                                                                                                                                  "name": "values",
                                                                                                                                                                                  "term": {"inject": {"typeName": "hydra.core.model.Type", "field": {"name": "variable", "term": {"variable": "vvar"}}}}}]}}}}}}},
                                                                                                                                                                "argument": {
                                                                                                                                                                  "application": {
                                                                                                                                                                    "function": {"variable": "hydra.core.substitution.composeTypeSubstList"},
                                                                                                                                                                    "argument": {"list": [{"variable": "ksubst"}, {"variable": "vsubst"}, {"variable": "subst"}]}}}}},
                                                                                                                                                            "argument": {
                                                                                                                                                              "application": {
                                                                                                                                                                "function": {
                                                                                                                                                                  "application": {"function": {"variable": "hydra.core.substitution.substInClassConstraints"}, "argument": {"variable": "subst"}}},
                                                                                                                                                                "argument": {"variable": "allMapConstraints"}}}}}}}}},
                                                                                                                                                "argument": {
                                                                                                                                                  "application": {
                                                                                                                                                    "function": {
                                                                                                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.lists.concat"}, "type": {"variable": "hydra.core.typing.TypeConstraint"}}},
                                                                                                                                                    "argument": {"list": [{"variable": "kcons"}, {"variable": "vcons"}]}}}}}}},
                                                                                                                                        "argument": {
                                                                                                                                          "lambda": {
                                                                                                                                            "parameter": "mcResult",
                                                                                                                                            "domain": {"variable": "hydra.core.typing.InferenceResult"},
                                                                                                                                            "body": {
                                                                                                                                              "typeApplication": {
                                                                                                                                                "body": {
                                                                                                                                                  "typeApplication": {"body": {"either": {"right": {"variable": "mcResult"}}}, "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                                                                                "type": {"variable": "hydra.core.typing.InferenceResult"}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {"literal": {"string": "Infer the type of a map (Either version). Paper: inference.tex, rules Map_0 and Map_+."}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.inference.inferTypeOfOptional",
        "signature": {
          "typeParameters": [],
          "parameters": [
            {"name": "arg0", "type": {"variable": "hydra.core.typing.InferenceContext"}, "isLazy": false},
            {"name": "arg1", "type": {"variable": "hydra.core.graph.Graph"}, "isLazy": false},
            {"name": "arg2", "type": {"optional": {"variable": "hydra.core.model.Term"}}, "isLazy": false}],
          "result": {
            "type": {
              "either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.typing.InferenceResult"}}}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "fcx",
                "domain": {"variable": "hydra.core.typing.InferenceContext"},
                "body": {
                  "lambda": {
                    "parameter": "cx",
                    "domain": {"variable": "hydra.core.graph.Graph"},
                    "body": {
                      "lambda": {
                        "parameter": "m",
                        "domain": {"optional": {"variable": "hydra.core.model.Term"}},
                        "body": {
                          "let": {
                            "bindings": [
                              {
                                "name": "trmCons",
                                "term": {
                                  "lambda": {
                                    "parameter": "terms",
                                    "domain": {"list": {"variable": "hydra.core.model.Term"}},
                                    "body": {
                                      "inject": {
                                        "typeName": "hydra.core.model.Term",
                                        "field": {
                                          "name": "optional",
                                          "term": {
                                            "application": {
                                              "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.head"}, "type": {"variable": "hydra.core.model.Term"}}},
                                              "argument": {"variable": "terms"}}}}}}}},
                                "typeScheme": {
                                  "variables": [],
                                  "body": {
                                    "function": {"domain": {"list": {"variable": "hydra.core.model.Term"}}, "codomain": {"variable": "hydra.core.model.Term"}}},
                                  "constraints": []}}],
                            "body": {
                              "application": {
                                "function": {
                                  "application": {
                                    "function": {
                                      "application": {
                                        "function": {
                                          "application": {
                                            "function": {
                                              "application": {
                                                "function": {
                                                  "application": {
                                                    "function": {
                                                      "application": {"function": {"variable": "hydra.core.inference.inferTypeOfCollection"}, "argument": {"variable": "fcx"}}},
                                                    "argument": {"variable": "cx"}}},
                                                "argument": {
                                                  "lambda": {
                                                    "parameter": "x",
                                                    "domain": {"variable": "hydra.core.model.Type"},
                                                    "body": {"inject": {"typeName": "hydra.core.model.Type", "field": {"name": "optional", "term": {"variable": "x"}}}}}}}},
                                            "argument": {"variable": "trmCons"}}},
                                        "argument": {"literal": {"string": "optional element"}}}},
                                    "argument": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.empty"}, "type": {"variable": "hydra.core.model.Name"}}}}},
                                "argument": {
                                  "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": "m"}}},
                                        "argument": {"typeApplication": {"body": {"list": []}, "type": {"variable": "hydra.core.model.Term"}}}}},
                                    "argument": {
                                      "typeApplication": {"body": {"variable": "hydra.core.lib.lists.singleton"}, "type": {"variable": "hydra.core.model.Term"}}}}}}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {"literal": {"string": "Infer the type of a Maybe value. Paper: inference.tex, rules Opt_0 and Opt_1."}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.inference.inferTypeOfPair",
        "signature": {
          "typeParameters": [],
          "parameters": [
            {"name": "arg0", "type": {"variable": "hydra.core.typing.InferenceContext"}, "isLazy": false},
            {"name": "arg1", "type": {"variable": "hydra.core.graph.Graph"}, "isLazy": false},
            {
              "name": "arg2",
              "type": {"pair": {"first": {"variable": "hydra.core.model.Term"}, "second": {"variable": "hydra.core.model.Term"}}},
              "isLazy": false}],
          "result": {
            "type": {
              "either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.typing.InferenceResult"}}}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "fcx",
                "domain": {"variable": "hydra.core.typing.InferenceContext"},
                "body": {
                  "lambda": {
                    "parameter": "cx",
                    "domain": {"variable": "hydra.core.graph.Graph"},
                    "body": {
                      "lambda": {
                        "parameter": "p",
                        "domain": {"pair": {"first": {"variable": "hydra.core.model.Term"}, "second": {"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": {
                                          "pair": {
                                            "first": {
                                              "pair": {
                                                "first": {"list": {"variable": "hydra.core.model.Term"}},
                                                "second": {
                                                  "pair": {
                                                    "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                    "second": {
                                                      "pair": {
                                                        "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                        "second": {
                                                          "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}},
                                            "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                    "type": {"variable": "hydra.core.typing.InferenceResult"}}},
                                "argument": {
                                  "application": {
                                    "function": {
                                      "application": {
                                        "function": {"application": {"function": {"variable": "hydra.core.inference.inferMany"}, "argument": {"variable": "fcx"}}},
                                        "argument": {"variable": "cx"}}},
                                    "argument": {
                                      "list": [
                                        {
                                          "typeApplication": {
                                            "body": {
                                              "typeApplication": {
                                                "body": {
                                                  "pair": {
                                                    "first": {
                                                      "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": {"literal": {"string": "pair first element"}}}},
                                                "type": {"variable": "hydra.core.model.Term"}}},
                                            "type": {"literal": "string"}}},
                                        {
                                          "typeApplication": {
                                            "body": {
                                              "typeApplication": {
                                                "body": {
                                                  "pair": {
                                                    "first": {
                                                      "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"}}},
                                                    "second": {"literal": {"string": "pair second element"}}}},
                                                "type": {"variable": "hydra.core.model.Term"}}},
                                            "type": {"literal": "string"}}}]}}}}},
                            "argument": {
                              "lambda": {
                                "parameter": "rp",
                                "domain": {
                                  "pair": {
                                    "first": {
                                      "pair": {
                                        "first": {"list": {"variable": "hydra.core.model.Term"}},
                                        "second": {
                                          "pair": {
                                            "first": {"list": {"variable": "hydra.core.model.Type"}},
                                            "second": {
                                              "pair": {
                                                "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                "second": {
                                                  "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}},
                                    "second": {"variable": "hydra.core.typing.InferenceContext"}}},
                                "body": {
                                  "let": {
                                    "bindings": [
                                      {
                                        "name": "results",
                                        "term": {
                                          "application": {
                                            "function": {
                                              "typeApplication": {
                                                "body": {
                                                  "typeApplication": {
                                                    "body": {"variable": "hydra.core.lib.pairs.first"},
                                                    "type": {
                                                      "pair": {
                                                        "first": {"list": {"variable": "hydra.core.model.Term"}},
                                                        "second": {
                                                          "pair": {
                                                            "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                            "second": {
                                                              "pair": {
                                                                "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                "second": {
                                                                  "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}}}},
                                                "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                            "argument": {"variable": "rp"}}},
                                        "typeScheme": {
                                          "variables": [],
                                          "body": {
                                            "pair": {
                                              "first": {"list": {"variable": "hydra.core.model.Term"}},
                                              "second": {
                                                "pair": {
                                                  "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                  "second": {
                                                    "pair": {
                                                      "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                      "second": {
                                                        "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}},
                                          "constraints": []}}],
                                    "body": {
                                      "let": {
                                        "bindings": [
                                          {
                                            "name": "fcx2",
                                            "term": {
                                              "application": {
                                                "function": {
                                                  "typeApplication": {
                                                    "body": {
                                                      "typeApplication": {
                                                        "body": {"variable": "hydra.core.lib.pairs.second"},
                                                        "type": {
                                                          "pair": {
                                                            "first": {"list": {"variable": "hydra.core.model.Term"}},
                                                            "second": {
                                                              "pair": {
                                                                "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                "second": {
                                                                  "pair": {
                                                                    "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                    "second": {
                                                                      "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}}}},
                                                    "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                "argument": {"variable": "rp"}}},
                                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "constraints": []}}],
                                        "body": {
                                          "let": {
                                            "bindings": [
                                              {
                                                "name": "iterms",
                                                "term": {
                                                  "application": {
                                                    "function": {
                                                      "typeApplication": {
                                                        "body": {
                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"list": {"variable": "hydra.core.model.Term"}}}},
                                                        "type": {
                                                          "pair": {
                                                            "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                            "second": {
                                                              "pair": {
                                                                "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                "second": {
                                                                  "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}},
                                                    "argument": {"variable": "results"}}},
                                                "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Term"}}, "constraints": []}}],
                                            "body": {
                                              "let": {
                                                "bindings": [
                                                  {
                                                    "name": "itypes",
                                                    "term": {
                                                      "application": {
                                                        "function": {
                                                          "typeApplication": {
                                                            "body": {
                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                            "type": {
                                                              "pair": {
                                                                "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                "second": {
                                                                  "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}},
                                                        "argument": {
                                                          "application": {
                                                            "function": {
                                                              "typeApplication": {
                                                                "body": {
                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"list": {"variable": "hydra.core.model.Term"}}}},
                                                                "type": {
                                                                  "pair": {
                                                                    "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                    "second": {
                                                                      "pair": {
                                                                        "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                        "second": {
                                                                          "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}},
                                                            "argument": {"variable": "results"}}}}},
                                                    "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Type"}}, "constraints": []}}],
                                                "body": {
                                                  "let": {
                                                    "bindings": [
                                                      {
                                                        "name": "isubst",
                                                        "term": {
                                                          "application": {
                                                            "function": {
                                                              "typeApplication": {
                                                                "body": {
                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"variable": "hydra.core.typing.TypeSubst"}}},
                                                                "type": {
                                                                  "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}},
                                                            "argument": {
                                                              "application": {
                                                                "function": {
                                                                  "typeApplication": {
                                                                    "body": {
                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                                    "type": {
                                                                      "pair": {
                                                                        "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                        "second": {
                                                                          "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}},
                                                                "argument": {
                                                                  "application": {
                                                                    "function": {
                                                                      "typeApplication": {
                                                                        "body": {
                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"list": {"variable": "hydra.core.model.Term"}}}},
                                                                        "type": {
                                                                          "pair": {
                                                                            "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                            "second": {
                                                                              "pair": {
                                                                                "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                "second": {
                                                                                  "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}},
                                                                    "argument": {"variable": "results"}}}}}}},
                                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.TypeSubst"}, "constraints": []}}],
                                                    "body": {
                                                      "let": {
                                                        "bindings": [
                                                          {
                                                            "name": "pairElemConstraints",
                                                            "term": {
                                                              "application": {
                                                                "function": {
                                                                  "typeApplication": {
                                                                    "body": {
                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"variable": "hydra.core.typing.TypeSubst"}}},
                                                                    "type": {
                                                                      "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}},
                                                                "argument": {
                                                                  "application": {
                                                                    "function": {
                                                                      "typeApplication": {
                                                                        "body": {
                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                                        "type": {
                                                                          "pair": {
                                                                            "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                            "second": {
                                                                              "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}},
                                                                    "argument": {
                                                                      "application": {
                                                                        "function": {
                                                                          "typeApplication": {
                                                                            "body": {
                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"list": {"variable": "hydra.core.model.Term"}}}},
                                                                            "type": {
                                                                              "pair": {
                                                                                "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                "second": {
                                                                                  "pair": {
                                                                                    "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                    "second": {
                                                                                      "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}},
                                                                        "argument": {"variable": "results"}}}}}}},
                                                            "typeScheme": {
                                                              "variables": [],
                                                              "body": {
                                                                "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}},
                                                              "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.typing.InferenceResult"}}},
                                                                "argument": {
                                                                  "application": {
                                                                    "function": {
                                                                      "application": {
                                                                        "function": {
                                                                          "application": {
                                                                            "function": {
                                                                              "typeApplication": {"body": {"variable": "hydra.core.inference.atOrFail"}, "type": {"variable": "hydra.core.model.Term"}}},
                                                                            "argument": {"literal": {"integer": {"int32": 0}}}}},
                                                                        "argument": {"literal": {"string": "inferTypeOfPair ifst"}}}},
                                                                    "argument": {"variable": "iterms"}}}}},
                                                            "argument": {
                                                              "lambda": {
                                                                "parameter": "ifst",
                                                                "domain": {"variable": "hydra.core.model.Term"},
                                                                "body": {
                                                                  "application": {
                                                                    "function": {
                                                                      "application": {
                                                                        "function": {
                                                                          "typeApplication": {
                                                                            "body": {
                                                                              "typeApplication": {
                                                                                "body": {
                                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.eithers.bind"}, "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                "type": {"variable": "hydra.core.model.Term"}}},
                                                                            "type": {"variable": "hydra.core.typing.InferenceResult"}}},
                                                                        "argument": {
                                                                          "application": {
                                                                            "function": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "application": {
                                                                                    "function": {
                                                                                      "typeApplication": {"body": {"variable": "hydra.core.inference.atOrFail"}, "type": {"variable": "hydra.core.model.Term"}}},
                                                                                    "argument": {"literal": {"integer": {"int32": 1}}}}},
                                                                                "argument": {"literal": {"string": "inferTypeOfPair isnd"}}}},
                                                                            "argument": {"variable": "iterms"}}}}},
                                                                    "argument": {
                                                                      "lambda": {
                                                                        "parameter": "isnd",
                                                                        "domain": {"variable": "hydra.core.model.Term"},
                                                                        "body": {
                                                                          "application": {
                                                                            "function": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "typeApplication": {
                                                                                    "body": {
                                                                                      "typeApplication": {
                                                                                        "body": {
                                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.eithers.bind"}, "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                        "type": {"variable": "hydra.core.model.Type"}}},
                                                                                    "type": {"variable": "hydra.core.typing.InferenceResult"}}},
                                                                                "argument": {
                                                                                  "application": {
                                                                                    "function": {
                                                                                      "application": {
                                                                                        "function": {
                                                                                          "application": {
                                                                                            "function": {
                                                                                              "typeApplication": {"body": {"variable": "hydra.core.inference.atOrFail"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                                            "argument": {"literal": {"integer": {"int32": 0}}}}},
                                                                                        "argument": {"literal": {"string": "inferTypeOfPair tyFst"}}}},
                                                                                    "argument": {"variable": "itypes"}}}}},
                                                                            "argument": {
                                                                              "lambda": {
                                                                                "parameter": "tyFst",
                                                                                "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.typing.InferenceResult"}}},
                                                                                        "argument": {
                                                                                          "application": {
                                                                                            "function": {
                                                                                              "application": {
                                                                                                "function": {
                                                                                                  "application": {
                                                                                                    "function": {
                                                                                                      "typeApplication": {"body": {"variable": "hydra.core.inference.atOrFail"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                                                    "argument": {"literal": {"integer": {"int32": 1}}}}},
                                                                                                "argument": {"literal": {"string": "inferTypeOfPair tySnd"}}}},
                                                                                            "argument": {"variable": "itypes"}}}}},
                                                                                    "argument": {
                                                                                      "lambda": {
                                                                                        "parameter": "tySnd",
                                                                                        "domain": {"variable": "hydra.core.model.Type"},
                                                                                        "body": {
                                                                                          "let": {
                                                                                            "bindings": [
                                                                                              {
                                                                                                "name": "pairTerm",
                                                                                                "term": {
                                                                                                  "inject": {
                                                                                                    "typeName": "hydra.core.model.Term",
                                                                                                    "field": {
                                                                                                      "name": "pair",
                                                                                                      "term": {
                                                                                                        "typeApplication": {
                                                                                                          "body": {
                                                                                                            "typeApplication": {
                                                                                                              "body": {"pair": {"first": {"variable": "ifst"}, "second": {"variable": "isnd"}}},
                                                                                                              "type": {"variable": "hydra.core.model.Term"}}},
                                                                                                          "type": {"variable": "hydra.core.model.Term"}}}}}},
                                                                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                                                                            "body": {
                                                                                              "let": {
                                                                                                "bindings": [
                                                                                                  {
                                                                                                    "name": "termWithTypes",
                                                                                                    "term": {
                                                                                                      "inject": {
                                                                                                        "typeName": "hydra.core.model.Term",
                                                                                                        "field": {
                                                                                                          "name": "typeApplication",
                                                                                                          "term": {
                                                                                                            "record": {
                                                                                                              "typeName": "hydra.core.model.TypeApplicationTerm",
                                                                                                              "fields": [
                                                                                                                {
                                                                                                                  "name": "body",
                                                                                                                  "term": {
                                                                                                                    "inject": {
                                                                                                                      "typeName": "hydra.core.model.Term",
                                                                                                                      "field": {
                                                                                                                        "name": "typeApplication",
                                                                                                                        "term": {
                                                                                                                          "record": {
                                                                                                                            "typeName": "hydra.core.model.TypeApplicationTerm",
                                                                                                                            "fields": [{"name": "body", "term": {"variable": "pairTerm"}}, {"name": "type", "term": {"variable": "tyFst"}}]}}}}}},
                                                                                                                {"name": "type", "term": {"variable": "tySnd"}}]}}}}},
                                                                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                                                                                "body": {
                                                                                                  "typeApplication": {
                                                                                                    "body": {
                                                                                                      "typeApplication": {
                                                                                                        "body": {
                                                                                                          "either": {
                                                                                                            "right": {
                                                                                                              "application": {
                                                                                                                "function": {
                                                                                                                  "application": {
                                                                                                                    "function": {
                                                                                                                      "application": {
                                                                                                                        "function": {
                                                                                                                          "application": {
                                                                                                                            "function": {
                                                                                                                              "application": {"function": {"variable": "hydra.core.inference.yieldWithConstraints"}, "argument": {"variable": "fcx2"}}},
                                                                                                                            "argument": {"variable": "termWithTypes"}}},
                                                                                                                        "argument": {
                                                                                                                          "inject": {
                                                                                                                            "typeName": "hydra.core.model.Type",
                                                                                                                            "field": {
                                                                                                                              "name": "pair",
                                                                                                                              "term": {
                                                                                                                                "record": {
                                                                                                                                  "typeName": "hydra.core.model.PairType",
                                                                                                                                  "fields": [{"name": "first", "term": {"variable": "tyFst"}}, {"name": "second", "term": {"variable": "tySnd"}}]}}}}}}},
                                                                                                                    "argument": {"variable": "isubst"}}},
                                                                                                                "argument": {"variable": "pairElemConstraints"}}}}},
                                                                                                        "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                                    "type": {"variable": "hydra.core.typing.InferenceResult"}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {"literal": {"string": "Infer the type of a pair (Either version). Paper: inference.tex, rule Pair."}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.inference.inferTypeOfProjection",
        "signature": {
          "typeParameters": [],
          "parameters": [
            {"name": "arg0", "type": {"variable": "hydra.core.typing.InferenceContext"}, "isLazy": false},
            {"name": "arg1", "type": {"variable": "hydra.core.graph.Graph"}, "isLazy": false},
            {"name": "arg2", "type": {"variable": "hydra.core.model.Projection"}, "isLazy": false}],
          "result": {
            "type": {
              "either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.typing.InferenceResult"}}}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "fcx",
                "domain": {"variable": "hydra.core.typing.InferenceContext"},
                "body": {
                  "lambda": {
                    "parameter": "cx",
                    "domain": {"variable": "hydra.core.graph.Graph"},
                    "body": {
                      "lambda": {
                        "parameter": "proj",
                        "domain": {"variable": "hydra.core.model.Projection"},
                        "body": {
                          "let": {
                            "bindings": [
                              {
                                "name": "tname",
                                "term": {
                                  "application": {
                                    "function": {"project": {"typeName": "hydra.core.model.Projection", "fieldName": "typeName"}},
                                    "argument": {"variable": "proj"}}},
                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Name"}, "constraints": []}}],
                            "body": {
                              "let": {
                                "bindings": [
                                  {
                                    "name": "fname",
                                    "term": {
                                      "application": {
                                        "function": {"project": {"typeName": "hydra.core.model.Projection", "fieldName": "fieldName"}},
                                        "argument": {"variable": "proj"}}},
                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Name"}, "constraints": []}}],
                                "body": {
                                  "application": {
                                    "function": {
                                      "application": {
                                        "function": {
                                          "typeApplication": {
                                            "body": {
                                              "typeApplication": {
                                                "body": {
                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.eithers.bind"}, "type": {"variable": "hydra.core.errors.Error"}}},
                                                "type": {
                                                  "pair": {"first": {"variable": "hydra.core.model.TypeScheme"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                            "type": {"variable": "hydra.core.typing.InferenceResult"}}},
                                        "argument": {
                                          "application": {
                                            "function": {
                                              "application": {
                                                "function": {"application": {"function": {"variable": "hydra.core.resolution.requireSchemaType"}, "argument": {"variable": "fcx"}}},
                                                "argument": {
                                                  "application": {
                                                    "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "schemaTypes"}},
                                                    "argument": {"variable": "cx"}}}}},
                                            "argument": {"variable": "tname"}}}}},
                                    "argument": {
                                      "lambda": {
                                        "parameter": "stRp",
                                        "domain": {
                                          "pair": {"first": {"variable": "hydra.core.model.TypeScheme"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}},
                                        "body": {
                                          "let": {
                                            "bindings": [
                                              {
                                                "name": "schemaType",
                                                "term": {
                                                  "application": {
                                                    "function": {
                                                      "typeApplication": {
                                                        "body": {
                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"variable": "hydra.core.model.TypeScheme"}}},
                                                        "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                    "argument": {"variable": "stRp"}}},
                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.TypeScheme"}, "constraints": []}}],
                                            "body": {
                                              "let": {
                                                "bindings": [
                                                  {
                                                    "name": "fcx2",
                                                    "term": {
                                                      "application": {
                                                        "function": {
                                                          "typeApplication": {
                                                            "body": {
                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"variable": "hydra.core.model.TypeScheme"}}},
                                                            "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                        "argument": {"variable": "stRp"}}},
                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "constraints": []}}],
                                                "body": {
                                                  "let": {
                                                    "bindings": [
                                                      {
                                                        "name": "svars",
                                                        "term": {
                                                          "application": {
                                                            "function": {"project": {"typeName": "hydra.core.model.TypeScheme", "fieldName": "variables"}},
                                                            "argument": {"variable": "schemaType"}}},
                                                        "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Name"}}, "constraints": []}}],
                                                    "body": {
                                                      "let": {
                                                        "bindings": [
                                                          {
                                                            "name": "stype",
                                                            "term": {
                                                              "application": {
                                                                "function": {"project": {"typeName": "hydra.core.model.TypeScheme", "fieldName": "body"}},
                                                                "argument": {"variable": "schemaType"}}},
                                                            "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": {"list": {"variable": "hydra.core.model.FieldType"}}}},
                                                                    "type": {"variable": "hydra.core.typing.InferenceResult"}}},
                                                                "argument": {
                                                                  "application": {
                                                                    "function": {
                                                                      "application": {
                                                                        "function": {
                                                                          "typeApplication": {"body": {"variable": "hydra.core.extract.model.recordType"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                        "argument": {"variable": "tname"}}},
                                                                    "argument": {"variable": "stype"}}}}},
                                                            "argument": {
                                                              "lambda": {
                                                                "parameter": "sfields",
                                                                "domain": {"list": {"variable": "hydra.core.model.FieldType"}},
                                                                "body": {
                                                                  "application": {
                                                                    "function": {
                                                                      "application": {
                                                                        "function": {
                                                                          "typeApplication": {
                                                                            "body": {
                                                                              "typeApplication": {
                                                                                "body": {
                                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.eithers.bind"}, "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                "type": {"variable": "hydra.core.model.Type"}}},
                                                                            "type": {"variable": "hydra.core.typing.InferenceResult"}}},
                                                                        "argument": {
                                                                          "application": {
                                                                            "function": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "application": {
                                                                                    "function": {
                                                                                      "typeApplication": {
                                                                                        "body": {"variable": "hydra.core.resolution.findFieldType"},
                                                                                        "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                    "argument": {"variable": "fcx2"}}},
                                                                                "argument": {"variable": "fname"}}},
                                                                            "argument": {"variable": "sfields"}}}}},
                                                                    "argument": {
                                                                      "lambda": {
                                                                        "parameter": "ftyp",
                                                                        "domain": {"variable": "hydra.core.model.Type"},
                                                                        "body": {
                                                                          "typeApplication": {
                                                                            "body": {
                                                                              "typeApplication": {
                                                                                "body": {
                                                                                  "either": {
                                                                                    "right": {
                                                                                      "application": {
                                                                                        "function": {
                                                                                          "application": {
                                                                                            "function": {
                                                                                              "application": {
                                                                                                "function": {"application": {"function": {"variable": "hydra.core.inference.yield"}, "argument": {"variable": "fcx2"}}},
                                                                                                "argument": {
                                                                                                  "application": {
                                                                                                    "function": {
                                                                                                      "application": {"function": {"variable": "hydra.core.inference.buildTypeApplicationTerm"}, "argument": {"variable": "svars"}}},
                                                                                                    "argument": {
                                                                                                      "inject": {
                                                                                                        "typeName": "hydra.core.model.Term",
                                                                                                        "field": {
                                                                                                          "name": "project",
                                                                                                          "term": {
                                                                                                            "record": {
                                                                                                              "typeName": "hydra.core.model.Projection",
                                                                                                              "fields": [{"name": "typeName", "term": {"variable": "tname"}}, {"name": "fieldName", "term": {"variable": "fname"}}]}}}}}}}}},
                                                                                            "argument": {
                                                                                              "inject": {
                                                                                                "typeName": "hydra.core.model.Type",
                                                                                                "field": {
                                                                                                  "name": "function",
                                                                                                  "term": {
                                                                                                    "record": {
                                                                                                      "typeName": "hydra.core.model.FunctionType",
                                                                                                      "fields": [
                                                                                                        {
                                                                                                          "name": "domain",
                                                                                                          "term": {
                                                                                                            "application": {
                                                                                                              "function": {
                                                                                                                "application": {"function": {"variable": "hydra.core.resolution.nominalApplication"}, "argument": {"variable": "tname"}}},
                                                                                                              "argument": {
                                                                                                                "application": {
                                                                                                                  "function": {
                                                                                                                    "application": {
                                                                                                                      "function": {
                                                                                                                        "typeApplication": {
                                                                                                                          "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                                          "type": {"variable": "hydra.core.model.Type"}}},
                                                                                                                      "argument": {
                                                                                                                        "lambda": {
                                                                                                                          "parameter": "x",
                                                                                                                          "domain": {"variable": "hydra.core.model.Name"},
                                                                                                                          "body": {"inject": {"typeName": "hydra.core.model.Type", "field": {"name": "variable", "term": {"variable": "x"}}}}}}}},
                                                                                                                  "argument": {"variable": "svars"}}}}}},
                                                                                                        {"name": "codomain", "term": {"variable": "ftyp"}}]}}}}}}},
                                                                                        "argument": {"variable": "hydra.core.substitution.idTypeSubst"}}}}},
                                                                                "type": {"variable": "hydra.core.errors.Error"}}},
                                                                            "type": {"variable": "hydra.core.typing.InferenceResult"}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {"literal": {"string": "Infer the type of a record projection (Either version). Paper: inference.tex, rule Proj."}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.inference.inferTypeOfRecord",
        "signature": {
          "typeParameters": [],
          "parameters": [
            {"name": "arg0", "type": {"variable": "hydra.core.typing.InferenceContext"}, "isLazy": false},
            {"name": "arg1", "type": {"variable": "hydra.core.graph.Graph"}, "isLazy": false},
            {"name": "arg2", "type": {"variable": "hydra.core.model.Record"}, "isLazy": false}],
          "result": {
            "type": {
              "either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.typing.InferenceResult"}}}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "fcx",
                "domain": {"variable": "hydra.core.typing.InferenceContext"},
                "body": {
                  "lambda": {
                    "parameter": "cx",
                    "domain": {"variable": "hydra.core.graph.Graph"},
                    "body": {
                      "lambda": {
                        "parameter": "record",
                        "domain": {"variable": "hydra.core.model.Record"},
                        "body": {
                          "let": {
                            "bindings": [
                              {
                                "name": "tname",
                                "term": {
                                  "application": {
                                    "function": {"project": {"typeName": "hydra.core.model.Record", "fieldName": "typeName"}},
                                    "argument": {"variable": "record"}}},
                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Name"}, "constraints": []}}],
                            "body": {
                              "let": {
                                "bindings": [
                                  {
                                    "name": "fields",
                                    "term": {
                                      "application": {
                                        "function": {"project": {"typeName": "hydra.core.model.Record", "fieldName": "fields"}},
                                        "argument": {"variable": "record"}}},
                                    "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Field"}}, "constraints": []}}],
                                "body": {
                                  "let": {
                                    "bindings": [
                                      {
                                        "name": "fnames",
                                        "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.Name"}}},
                                                "argument": {"project": {"typeName": "hydra.core.model.Field", "fieldName": "name"}}}},
                                            "argument": {"variable": "fields"}}},
                                        "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Name"}}, "constraints": []}}],
                                    "body": {
                                      "application": {
                                        "function": {
                                          "application": {
                                            "function": {
                                              "typeApplication": {
                                                "body": {
                                                  "typeApplication": {
                                                    "body": {
                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.eithers.bind"}, "type": {"variable": "hydra.core.errors.Error"}}},
                                                    "type": {
                                                      "pair": {"first": {"variable": "hydra.core.model.TypeScheme"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                "type": {"variable": "hydra.core.typing.InferenceResult"}}},
                                            "argument": {
                                              "application": {
                                                "function": {
                                                  "application": {
                                                    "function": {"application": {"function": {"variable": "hydra.core.resolution.requireSchemaType"}, "argument": {"variable": "fcx"}}},
                                                    "argument": {
                                                      "application": {
                                                        "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "schemaTypes"}},
                                                        "argument": {"variable": "cx"}}}}},
                                                "argument": {"variable": "tname"}}}}},
                                        "argument": {
                                          "lambda": {
                                            "parameter": "stRp",
                                            "domain": {
                                              "pair": {"first": {"variable": "hydra.core.model.TypeScheme"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}},
                                            "body": {
                                              "let": {
                                                "bindings": [
                                                  {
                                                    "name": "schemaType",
                                                    "term": {
                                                      "application": {
                                                        "function": {
                                                          "typeApplication": {
                                                            "body": {
                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"variable": "hydra.core.model.TypeScheme"}}},
                                                            "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                        "argument": {"variable": "stRp"}}},
                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.TypeScheme"}, "constraints": []}}],
                                                "body": {
                                                  "let": {
                                                    "bindings": [
                                                      {
                                                        "name": "fcx2",
                                                        "term": {
                                                          "application": {
                                                            "function": {
                                                              "typeApplication": {
                                                                "body": {
                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"variable": "hydra.core.model.TypeScheme"}}},
                                                                "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                            "argument": {"variable": "stRp"}}},
                                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "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": {
                                                                      "pair": {
                                                                        "first": {
                                                                          "pair": {
                                                                            "first": {"list": {"variable": "hydra.core.model.Term"}},
                                                                            "second": {
                                                                              "pair": {
                                                                                "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                "second": {
                                                                                  "pair": {
                                                                                    "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                    "second": {
                                                                                      "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}},
                                                                        "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                "type": {"variable": "hydra.core.typing.InferenceResult"}}},
                                                            "argument": {
                                                              "application": {
                                                                "function": {
                                                                  "application": {
                                                                    "function": {"application": {"function": {"variable": "hydra.core.inference.inferMany"}, "argument": {"variable": "fcx2"}}},
                                                                    "argument": {"variable": "cx"}}},
                                                                "argument": {
                                                                  "application": {
                                                                    "function": {
                                                                      "application": {
                                                                        "function": {
                                                                          "typeApplication": {
                                                                            "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.model.Field"}}},
                                                                            "type": {"pair": {"first": {"variable": "hydra.core.model.Term"}, "second": {"literal": "string"}}}}},
                                                                        "argument": {
                                                                          "lambda": {
                                                                            "parameter": "f",
                                                                            "domain": {"variable": "hydra.core.model.Field"},
                                                                            "body": {
                                                                              "typeApplication": {
                                                                                "body": {
                                                                                  "typeApplication": {
                                                                                    "body": {
                                                                                      "pair": {
                                                                                        "first": {
                                                                                          "application": {"function": {"project": {"typeName": "hydra.core.model.Field", "fieldName": "term"}}, "argument": {"variable": "f"}}},
                                                                                        "second": {
                                                                                          "application": {
                                                                                            "function": {
                                                                                              "application": {"function": {"variable": "hydra.core.lib.strings.concat2"}, "argument": {"literal": {"string": "field "}}}},
                                                                                            "argument": {
                                                                                              "application": {
                                                                                                "function": {"unwrap": "hydra.core.model.Name"},
                                                                                                "argument": {
                                                                                                  "application": {"function": {"project": {"typeName": "hydra.core.model.Field", "fieldName": "name"}}, "argument": {"variable": "f"}}}}}}}}},
                                                                                    "type": {"variable": "hydra.core.model.Term"}}},
                                                                                "type": {"literal": "string"}}}}}}},
                                                                    "argument": {"variable": "fields"}}}}}}},
                                                        "argument": {
                                                          "lambda": {
                                                            "parameter": "rp",
                                                            "domain": {
                                                              "pair": {
                                                                "first": {
                                                                  "pair": {
                                                                    "first": {"list": {"variable": "hydra.core.model.Term"}},
                                                                    "second": {
                                                                      "pair": {
                                                                        "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                        "second": {
                                                                          "pair": {
                                                                            "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                            "second": {
                                                                              "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}},
                                                                "second": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                            "body": {
                                                              "let": {
                                                                "bindings": [
                                                                  {
                                                                    "name": "results",
                                                                    "term": {
                                                                      "application": {
                                                                        "function": {
                                                                          "typeApplication": {
                                                                            "body": {
                                                                              "typeApplication": {
                                                                                "body": {"variable": "hydra.core.lib.pairs.first"},
                                                                                "type": {
                                                                                  "pair": {
                                                                                    "first": {"list": {"variable": "hydra.core.model.Term"}},
                                                                                    "second": {
                                                                                      "pair": {
                                                                                        "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                        "second": {
                                                                                          "pair": {
                                                                                            "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                            "second": {
                                                                                              "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}}}},
                                                                            "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                        "argument": {"variable": "rp"}}},
                                                                    "typeScheme": {
                                                                      "variables": [],
                                                                      "body": {
                                                                        "pair": {
                                                                          "first": {"list": {"variable": "hydra.core.model.Term"}},
                                                                          "second": {
                                                                            "pair": {
                                                                              "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                              "second": {
                                                                                "pair": {
                                                                                  "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                  "second": {
                                                                                    "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}},
                                                                      "constraints": []}}],
                                                                "body": {
                                                                  "let": {
                                                                    "bindings": [
                                                                      {
                                                                        "name": "fcx3",
                                                                        "term": {
                                                                          "application": {
                                                                            "function": {
                                                                              "typeApplication": {
                                                                                "body": {
                                                                                  "typeApplication": {
                                                                                    "body": {"variable": "hydra.core.lib.pairs.second"},
                                                                                    "type": {
                                                                                      "pair": {
                                                                                        "first": {"list": {"variable": "hydra.core.model.Term"}},
                                                                                        "second": {
                                                                                          "pair": {
                                                                                            "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                            "second": {
                                                                                              "pair": {
                                                                                                "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                "second": {
                                                                                                  "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}}}},
                                                                                "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                            "argument": {"variable": "rp"}}},
                                                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "constraints": []}}],
                                                                    "body": {
                                                                      "let": {
                                                                        "bindings": [
                                                                          {
                                                                            "name": "svars",
                                                                            "term": {
                                                                              "application": {
                                                                                "function": {"project": {"typeName": "hydra.core.model.TypeScheme", "fieldName": "variables"}},
                                                                                "argument": {"variable": "schemaType"}}},
                                                                            "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Name"}}, "constraints": []}}],
                                                                        "body": {
                                                                          "let": {
                                                                            "bindings": [
                                                                              {
                                                                                "name": "stype",
                                                                                "term": {
                                                                                  "application": {
                                                                                    "function": {"project": {"typeName": "hydra.core.model.TypeScheme", "fieldName": "body"}},
                                                                                    "argument": {"variable": "schemaType"}}},
                                                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
                                                                            "body": {
                                                                              "let": {
                                                                                "bindings": [
                                                                                  {
                                                                                    "name": "iterms",
                                                                                    "term": {
                                                                                      "application": {
                                                                                        "function": {
                                                                                          "typeApplication": {
                                                                                            "body": {
                                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"list": {"variable": "hydra.core.model.Term"}}}},
                                                                                            "type": {
                                                                                              "pair": {
                                                                                                "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                                "second": {
                                                                                                  "pair": {
                                                                                                    "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                    "second": {
                                                                                                      "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}},
                                                                                        "argument": {"variable": "results"}}},
                                                                                    "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Term"}}, "constraints": []}}],
                                                                                "body": {
                                                                                  "let": {
                                                                                    "bindings": [
                                                                                      {
                                                                                        "name": "itypes",
                                                                                        "term": {
                                                                                          "application": {
                                                                                            "function": {
                                                                                              "typeApplication": {
                                                                                                "body": {
                                                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                                                                "type": {
                                                                                                  "pair": {
                                                                                                    "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                    "second": {
                                                                                                      "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}},
                                                                                            "argument": {
                                                                                              "application": {
                                                                                                "function": {
                                                                                                  "typeApplication": {
                                                                                                    "body": {
                                                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"list": {"variable": "hydra.core.model.Term"}}}},
                                                                                                    "type": {
                                                                                                      "pair": {
                                                                                                        "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                                        "second": {
                                                                                                          "pair": {
                                                                                                            "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                            "second": {
                                                                                                              "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}},
                                                                                                "argument": {"variable": "results"}}}}},
                                                                                        "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Type"}}, "constraints": []}}],
                                                                                    "body": {
                                                                                      "let": {
                                                                                        "bindings": [
                                                                                          {
                                                                                            "name": "isubst",
                                                                                            "term": {
                                                                                              "application": {
                                                                                                "function": {
                                                                                                  "typeApplication": {
                                                                                                    "body": {
                                                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"variable": "hydra.core.typing.TypeSubst"}}},
                                                                                                    "type": {
                                                                                                      "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}},
                                                                                                "argument": {
                                                                                                  "application": {
                                                                                                    "function": {
                                                                                                      "typeApplication": {
                                                                                                        "body": {
                                                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                                                                        "type": {
                                                                                                          "pair": {
                                                                                                            "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                            "second": {
                                                                                                              "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}},
                                                                                                    "argument": {
                                                                                                      "application": {
                                                                                                        "function": {
                                                                                                          "typeApplication": {
                                                                                                            "body": {
                                                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"list": {"variable": "hydra.core.model.Term"}}}},
                                                                                                            "type": {
                                                                                                              "pair": {
                                                                                                                "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                                                "second": {
                                                                                                                  "pair": {
                                                                                                                    "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                                    "second": {
                                                                                                                      "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}},
                                                                                                        "argument": {"variable": "results"}}}}}}},
                                                                                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.TypeSubst"}, "constraints": []}}],
                                                                                        "body": {
                                                                                          "let": {
                                                                                            "bindings": [
                                                                                              {
                                                                                                "name": "recElemConstraints",
                                                                                                "term": {
                                                                                                  "application": {
                                                                                                    "function": {
                                                                                                      "typeApplication": {
                                                                                                        "body": {
                                                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"variable": "hydra.core.typing.TypeSubst"}}},
                                                                                                        "type": {
                                                                                                          "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}},
                                                                                                    "argument": {
                                                                                                      "application": {
                                                                                                        "function": {
                                                                                                          "typeApplication": {
                                                                                                            "body": {
                                                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                                                                            "type": {
                                                                                                              "pair": {
                                                                                                                "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                                "second": {
                                                                                                                  "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}},
                                                                                                        "argument": {
                                                                                                          "application": {
                                                                                                            "function": {
                                                                                                              "typeApplication": {
                                                                                                                "body": {
                                                                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"list": {"variable": "hydra.core.model.Term"}}}},
                                                                                                                "type": {
                                                                                                                  "pair": {
                                                                                                                    "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                                                    "second": {
                                                                                                                      "pair": {
                                                                                                                        "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                                        "second": {
                                                                                                                          "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}},
                                                                                                            "argument": {"variable": "results"}}}}}}},
                                                                                                "typeScheme": {
                                                                                                  "variables": [],
                                                                                                  "body": {
                                                                                                    "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}},
                                                                                                  "constraints": []}}],
                                                                                            "body": {
                                                                                              "let": {
                                                                                                "bindings": [
                                                                                                  {
                                                                                                    "name": "ityp",
                                                                                                    "term": {
                                                                                                      "inject": {
                                                                                                        "typeName": "hydra.core.model.Type",
                                                                                                        "field": {
                                                                                                          "name": "record",
                                                                                                          "term": {
                                                                                                            "application": {
                                                                                                              "function": {
                                                                                                                "application": {
                                                                                                                  "function": {
                                                                                                                    "application": {
                                                                                                                      "function": {
                                                                                                                        "typeApplication": {
                                                                                                                          "body": {
                                                                                                                            "typeApplication": {
                                                                                                                              "body": {
                                                                                                                                "typeApplication": {"body": {"variable": "hydra.core.lib.lists.zipWith"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                                              "type": {"variable": "hydra.core.model.Type"}}},
                                                                                                                          "type": {"variable": "hydra.core.model.FieldType"}}},
                                                                                                                      "argument": {
                                                                                                                        "lambda": {
                                                                                                                          "parameter": "n",
                                                                                                                          "domain": {"variable": "hydra.core.model.Name"},
                                                                                                                          "body": {
                                                                                                                            "lambda": {
                                                                                                                              "parameter": "t",
                                                                                                                              "domain": {"variable": "hydra.core.model.Type"},
                                                                                                                              "body": {
                                                                                                                                "record": {
                                                                                                                                  "typeName": "hydra.core.model.FieldType",
                                                                                                                                  "fields": [{"name": "name", "term": {"variable": "n"}}, {"name": "type", "term": {"variable": "t"}}]}}}}}}}},
                                                                                                                  "argument": {"variable": "fnames"}}},
                                                                                                              "argument": {"variable": "itypes"}}}}}},
                                                                                                    "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.typing.InferenceResult"}}},
                                                                                                            "type": {"variable": "hydra.core.typing.InferenceResult"}}},
                                                                                                        "argument": {
                                                                                                          "application": {
                                                                                                            "function": {
                                                                                                              "application": {
                                                                                                                "function": {
                                                                                                                  "application": {
                                                                                                                    "function": {
                                                                                                                      "application": {
                                                                                                                        "function": {
                                                                                                                          "typeApplication": {"body": {"variable": "hydra.core.inference.mapConstraints"}, "type": {"variable": "hydra.core.typing.InferenceResult"}}},
                                                                                                                        "argument": {"variable": "fcx3"}}},
                                                                                                                    "argument": {"variable": "cx"}}},
                                                                                                                "argument": {
                                                                                                                  "lambda": {
                                                                                                                    "parameter": "subst",
                                                                                                                    "domain": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                                    "body": {
                                                                                                                      "application": {
                                                                                                                        "function": {
                                                                                                                          "application": {
                                                                                                                            "function": {
                                                                                                                              "application": {
                                                                                                                                "function": {
                                                                                                                                  "application": {
                                                                                                                                    "function": {
                                                                                                                                      "application": {"function": {"variable": "hydra.core.inference.yieldWithConstraints"}, "argument": {"variable": "fcx3"}}},
                                                                                                                                    "argument": {
                                                                                                                                      "application": {
                                                                                                                                        "function": {
                                                                                                                                          "application": {"function": {"variable": "hydra.core.inference.buildTypeApplicationTerm"}, "argument": {"variable": "svars"}}},
                                                                                                                                        "argument": {
                                                                                                                                          "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": {
                                                                                                                                                                "application": {
                                                                                                                                                                  "function": {
                                                                                                                                                                    "typeApplication": {
                                                                                                                                                                      "body": {
                                                                                                                                                                        "typeApplication": {
                                                                                                                                                                          "body": {
                                                                                                                                                                            "typeApplication": {"body": {"variable": "hydra.core.lib.lists.zipWith"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                                                                                          "type": {"variable": "hydra.core.model.Term"}}},
                                                                                                                                                                      "type": {"variable": "hydra.core.model.Field"}}},
                                                                                                                                                                  "argument": {
                                                                                                                                                                    "lambda": {
                                                                                                                                                                      "parameter": "n",
                                                                                                                                                                      "domain": {"variable": "hydra.core.model.Name"},
                                                                                                                                                                      "body": {
                                                                                                                                                                        "lambda": {
                                                                                                                                                                          "parameter": "t",
                                                                                                                                                                          "domain": {"variable": "hydra.core.model.Term"},
                                                                                                                                                                          "body": {
                                                                                                                                                                            "record": {
                                                                                                                                                                              "typeName": "hydra.core.model.Field",
                                                                                                                                                                              "fields": [{"name": "name", "term": {"variable": "n"}}, {"name": "term", "term": {"variable": "t"}}]}}}}}}}},
                                                                                                                                                              "argument": {"variable": "fnames"}}},
                                                                                                                                                          "argument": {"variable": "iterms"}}}}]}}}}}}}}},
                                                                                                                                "argument": {
                                                                                                                                  "application": {
                                                                                                                                    "function": {
                                                                                                                                      "application": {"function": {"variable": "hydra.core.resolution.nominalApplication"}, "argument": {"variable": "tname"}}},
                                                                                                                                    "argument": {
                                                                                                                                      "application": {
                                                                                                                                        "function": {
                                                                                                                                          "application": {
                                                                                                                                            "function": {
                                                                                                                                              "typeApplication": {
                                                                                                                                                "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                                                                "type": {"variable": "hydra.core.model.Type"}}},
                                                                                                                                            "argument": {
                                                                                                                                              "lambda": {
                                                                                                                                                "parameter": "x",
                                                                                                                                                "domain": {"variable": "hydra.core.model.Name"},
                                                                                                                                                "body": {"inject": {"typeName": "hydra.core.model.Type", "field": {"name": "variable", "term": {"variable": "x"}}}}}}}},
                                                                                                                                        "argument": {"variable": "svars"}}}}}}},
                                                                                                                            "argument": {
                                                                                                                              "application": {
                                                                                                                                "function": {
                                                                                                                                  "application": {"function": {"variable": "hydra.core.substitution.composeTypeSubst"}, "argument": {"variable": "isubst"}}},
                                                                                                                                "argument": {"variable": "subst"}}}}},
                                                                                                                        "argument": {
                                                                                                                          "application": {
                                                                                                                            "function": {
                                                                                                                              "application": {"function": {"variable": "hydra.core.substitution.substInClassConstraints"}, "argument": {"variable": "subst"}}},
                                                                                                                            "argument": {"variable": "recElemConstraints"}}}}}}}}},
                                                                                                            "argument": {
                                                                                                              "list": [
                                                                                                                {
                                                                                                                  "record": {
                                                                                                                    "typeName": "hydra.core.typing.TypeConstraint",
                                                                                                                    "fields": [
                                                                                                                      {"name": "left", "term": {"variable": "stype"}},
                                                                                                                      {"name": "right", "term": {"variable": "ityp"}},
                                                                                                                      {"name": "comment", "term": {"literal": {"string": "schema type of record"}}}]}}]}}}}},
                                                                                                    "argument": {
                                                                                                      "lambda": {
                                                                                                        "parameter": "mcResult",
                                                                                                        "domain": {"variable": "hydra.core.typing.InferenceResult"},
                                                                                                        "body": {
                                                                                                          "typeApplication": {
                                                                                                            "body": {
                                                                                                              "typeApplication": {"body": {"either": {"right": {"variable": "mcResult"}}}, "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                                            "type": {"variable": "hydra.core.typing.InferenceResult"}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {"literal": {"string": "Infer the type of a record (Either version). Paper: inference.tex, rule Rec."}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.inference.inferTypeOfSet",
        "signature": {
          "typeParameters": [],
          "parameters": [
            {"name": "arg0", "type": {"variable": "hydra.core.typing.InferenceContext"}, "isLazy": false},
            {"name": "arg1", "type": {"variable": "hydra.core.graph.Graph"}, "isLazy": false},
            {"name": "arg2", "type": {"set": {"variable": "hydra.core.model.Term"}}, "isLazy": false}],
          "result": {
            "type": {
              "either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.typing.InferenceResult"}}}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "fcx",
                "domain": {"variable": "hydra.core.typing.InferenceContext"},
                "body": {
                  "lambda": {
                    "parameter": "cx",
                    "domain": {"variable": "hydra.core.graph.Graph"},
                    "body": {
                      "lambda": {
                        "parameter": "s",
                        "domain": {"set": {"variable": "hydra.core.model.Term"}},
                        "body": {
                          "application": {
                            "function": {
                              "application": {
                                "function": {
                                  "application": {
                                    "function": {
                                      "application": {
                                        "function": {
                                          "application": {
                                            "function": {
                                              "application": {
                                                "function": {
                                                  "application": {"function": {"variable": "hydra.core.inference.inferTypeOfCollection"}, "argument": {"variable": "fcx"}}},
                                                "argument": {"variable": "cx"}}},
                                            "argument": {
                                              "lambda": {
                                                "parameter": "x",
                                                "domain": {"variable": "hydra.core.model.Type"},
                                                "body": {"inject": {"typeName": "hydra.core.model.Type", "field": {"name": "set", "term": {"variable": "x"}}}}}}}},
                                        "argument": {
                                          "lambda": {
                                            "parameter": "terms",
                                            "domain": {"list": {"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": {"variable": "terms"}}}}}}}}}},
                                    "argument": {"literal": {"string": "set element"}}}},
                                "argument": {
                                  "application": {
                                    "function": {
                                      "typeApplication": {"body": {"variable": "hydra.core.lib.sets.singleton"}, "type": {"variable": "hydra.core.model.Name"}}},
                                    "argument": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "ordering"}}}}}}}},
                            "argument": {
                              "application": {
                                "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.toList"}, "type": {"variable": "hydra.core.model.Term"}}},
                                "argument": {"variable": "s"}}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {"literal": {"string": "Infer the type of a set (Either version). Paper: inference.tex, rules Set_0 and Set_+."}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.inference.inferTypeOfTerm",
        "signature": {
          "typeParameters": [],
          "parameters": [
            {"name": "arg0", "type": {"variable": "hydra.core.typing.InferenceContext"}, "isLazy": false},
            {"name": "arg1", "type": {"variable": "hydra.core.graph.Graph"}, "isLazy": false},
            {"name": "arg2", "type": {"variable": "hydra.core.model.Term"}, "isLazy": false},
            {"name": "arg3", "type": {"literal": "string"}, "isLazy": false}],
          "result": {
            "type": {
              "either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.typing.InferenceResult"}}}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "fcx",
                "domain": {"variable": "hydra.core.typing.InferenceContext"},
                "body": {
                  "lambda": {
                    "parameter": "cx",
                    "domain": {"variable": "hydra.core.graph.Graph"},
                    "body": {
                      "lambda": {
                        "parameter": "term",
                        "domain": {"variable": "hydra.core.model.Term"},
                        "body": {
                          "lambda": {
                            "parameter": "desc",
                            "domain": {"literal": "string"},
                            "body": {
                              "let": {
                                "bindings": [
                                  {
                                    "name": "fcx2",
                                    "term": {"variable": "fcx"},
                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "constraints": []}}],
                                "body": {
                                  "application": {
                                    "function": {
                                      "cases": {
                                        "typeName": "hydra.core.model.Term",
                                        "cases": [
                                          {
                                            "name": "annotated",
                                            "handler": {
                                              "lambda": {
                                                "parameter": "a",
                                                "domain": {"variable": "hydra.core.model.AnnotatedTerm"},
                                                "body": {
                                                  "application": {
                                                    "function": {
                                                      "application": {
                                                        "function": {
                                                          "application": {"function": {"variable": "hydra.core.inference.inferTypeOfAnnotatedTerm"}, "argument": {"variable": "fcx2"}}},
                                                        "argument": {"variable": "cx"}}},
                                                    "argument": {"variable": "a"}}}}}},
                                          {
                                            "name": "application",
                                            "handler": {
                                              "lambda": {
                                                "parameter": "a",
                                                "domain": {"variable": "hydra.core.model.Application"},
                                                "body": {
                                                  "application": {
                                                    "function": {
                                                      "application": {
                                                        "function": {
                                                          "application": {"function": {"variable": "hydra.core.inference.inferTypeOfApplication"}, "argument": {"variable": "fcx2"}}},
                                                        "argument": {"variable": "cx"}}},
                                                    "argument": {"variable": "a"}}}}}},
                                          {
                                            "name": "cases",
                                            "handler": {
                                              "lambda": {
                                                "parameter": "c",
                                                "domain": {"variable": "hydra.core.model.CaseStatement"},
                                                "body": {
                                                  "application": {
                                                    "function": {
                                                      "application": {
                                                        "function": {
                                                          "application": {"function": {"variable": "hydra.core.inference.inferTypeOfCaseStatement"}, "argument": {"variable": "fcx2"}}},
                                                        "argument": {"variable": "cx"}}},
                                                    "argument": {"variable": "c"}}}}}},
                                          {
                                            "name": "either",
                                            "handler": {
                                              "lambda": {
                                                "parameter": "e",
                                                "domain": {"either": {"left": {"variable": "hydra.core.model.Term"}, "right": {"variable": "hydra.core.model.Term"}}},
                                                "body": {
                                                  "application": {
                                                    "function": {
                                                      "application": {
                                                        "function": {"application": {"function": {"variable": "hydra.core.inference.inferTypeOfEither"}, "argument": {"variable": "fcx2"}}},
                                                        "argument": {"variable": "cx"}}},
                                                    "argument": {"variable": "e"}}}}}},
                                          {
                                            "name": "lambda",
                                            "handler": {
                                              "lambda": {
                                                "parameter": "l",
                                                "domain": {"variable": "hydra.core.model.Lambda"},
                                                "body": {
                                                  "application": {
                                                    "function": {
                                                      "application": {
                                                        "function": {"application": {"function": {"variable": "hydra.core.inference.inferTypeOfLambda"}, "argument": {"variable": "fcx2"}}},
                                                        "argument": {"variable": "cx"}}},
                                                    "argument": {"variable": "l"}}}}}},
                                          {
                                            "name": "let",
                                            "handler": {
                                              "lambda": {
                                                "parameter": "l",
                                                "domain": {"variable": "hydra.core.model.Let"},
                                                "body": {
                                                  "application": {
                                                    "function": {
                                                      "application": {
                                                        "function": {"application": {"function": {"variable": "hydra.core.inference.inferTypeOfLet"}, "argument": {"variable": "fcx2"}}},
                                                        "argument": {"variable": "cx"}}},
                                                    "argument": {"variable": "l"}}}}}},
                                          {
                                            "name": "list",
                                            "handler": {
                                              "lambda": {
                                                "parameter": "els",
                                                "domain": {"list": {"variable": "hydra.core.model.Term"}},
                                                "body": {
                                                  "application": {
                                                    "function": {
                                                      "application": {
                                                        "function": {"application": {"function": {"variable": "hydra.core.inference.inferTypeOfList"}, "argument": {"variable": "fcx2"}}},
                                                        "argument": {"variable": "cx"}}},
                                                    "argument": {"variable": "els"}}}}}},
                                          {
                                            "name": "literal",
                                            "handler": {
                                              "lambda": {
                                                "parameter": "l",
                                                "domain": {"variable": "hydra.core.model.Literal"},
                                                "body": {
                                                  "typeApplication": {
                                                    "body": {
                                                      "typeApplication": {
                                                        "body": {
                                                          "either": {
                                                            "right": {
                                                              "application": {
                                                                "function": {"application": {"function": {"variable": "hydra.core.inference.inferTypeOfLiteral"}, "argument": {"variable": "fcx2"}}},
                                                                "argument": {"variable": "l"}}}}},
                                                        "type": {"variable": "hydra.core.errors.Error"}}},
                                                    "type": {"variable": "hydra.core.typing.InferenceResult"}}}}}},
                                          {
                                            "name": "map",
                                            "handler": {
                                              "lambda": {
                                                "parameter": "m",
                                                "domain": {"map": {"keys": {"variable": "hydra.core.model.Term"}, "values": {"variable": "hydra.core.model.Term"}}},
                                                "body": {
                                                  "application": {
                                                    "function": {
                                                      "application": {
                                                        "function": {"application": {"function": {"variable": "hydra.core.inference.inferTypeOfMap"}, "argument": {"variable": "fcx2"}}},
                                                        "argument": {"variable": "cx"}}},
                                                    "argument": {"variable": "m"}}}}}},
                                          {
                                            "name": "optional",
                                            "handler": {
                                              "lambda": {
                                                "parameter": "m",
                                                "domain": {"optional": {"variable": "hydra.core.model.Term"}},
                                                "body": {
                                                  "application": {
                                                    "function": {
                                                      "application": {
                                                        "function": {
                                                          "application": {"function": {"variable": "hydra.core.inference.inferTypeOfOptional"}, "argument": {"variable": "fcx2"}}},
                                                        "argument": {"variable": "cx"}}},
                                                    "argument": {"variable": "m"}}}}}},
                                          {
                                            "name": "pair",
                                            "handler": {
                                              "lambda": {
                                                "parameter": "p",
                                                "domain": {"pair": {"first": {"variable": "hydra.core.model.Term"}, "second": {"variable": "hydra.core.model.Term"}}},
                                                "body": {
                                                  "application": {
                                                    "function": {
                                                      "application": {
                                                        "function": {"application": {"function": {"variable": "hydra.core.inference.inferTypeOfPair"}, "argument": {"variable": "fcx2"}}},
                                                        "argument": {"variable": "cx"}}},
                                                    "argument": {"variable": "p"}}}}}},
                                          {
                                            "name": "project",
                                            "handler": {
                                              "lambda": {
                                                "parameter": "p",
                                                "domain": {"variable": "hydra.core.model.Projection"},
                                                "body": {
                                                  "application": {
                                                    "function": {
                                                      "application": {
                                                        "function": {
                                                          "application": {"function": {"variable": "hydra.core.inference.inferTypeOfProjection"}, "argument": {"variable": "fcx2"}}},
                                                        "argument": {"variable": "cx"}}},
                                                    "argument": {"variable": "p"}}}}}},
                                          {
                                            "name": "record",
                                            "handler": {
                                              "lambda": {
                                                "parameter": "r",
                                                "domain": {"variable": "hydra.core.model.Record"},
                                                "body": {
                                                  "application": {
                                                    "function": {
                                                      "application": {
                                                        "function": {"application": {"function": {"variable": "hydra.core.inference.inferTypeOfRecord"}, "argument": {"variable": "fcx2"}}},
                                                        "argument": {"variable": "cx"}}},
                                                    "argument": {"variable": "r"}}}}}},
                                          {
                                            "name": "set",
                                            "handler": {
                                              "lambda": {
                                                "parameter": "s",
                                                "domain": {"set": {"variable": "hydra.core.model.Term"}},
                                                "body": {
                                                  "application": {
                                                    "function": {
                                                      "application": {
                                                        "function": {"application": {"function": {"variable": "hydra.core.inference.inferTypeOfSet"}, "argument": {"variable": "fcx2"}}},
                                                        "argument": {"variable": "cx"}}},
                                                    "argument": {"variable": "s"}}}}}},
                                          {
                                            "name": "typeApplication",
                                            "handler": {
                                              "lambda": {
                                                "parameter": "tt",
                                                "domain": {"variable": "hydra.core.model.TypeApplicationTerm"},
                                                "body": {
                                                  "application": {
                                                    "function": {
                                                      "application": {
                                                        "function": {
                                                          "application": {"function": {"variable": "hydra.core.inference.inferTypeOfTypeApplication"}, "argument": {"variable": "fcx2"}}},
                                                        "argument": {"variable": "cx"}}},
                                                    "argument": {"variable": "tt"}}}}}},
                                          {
                                            "name": "typeLambda",
                                            "handler": {
                                              "lambda": {
                                                "parameter": "ta",
                                                "domain": {"variable": "hydra.core.model.TypeLambda"},
                                                "body": {
                                                  "application": {
                                                    "function": {
                                                      "application": {
                                                        "function": {
                                                          "application": {"function": {"variable": "hydra.core.inference.inferTypeOfTypeLambda"}, "argument": {"variable": "fcx2"}}},
                                                        "argument": {"variable": "cx"}}},
                                                    "argument": {"variable": "ta"}}}}}},
                                          {
                                            "name": "inject",
                                            "handler": {
                                              "lambda": {
                                                "parameter": "i",
                                                "domain": {"variable": "hydra.core.model.Injection"},
                                                "body": {
                                                  "application": {
                                                    "function": {
                                                      "application": {
                                                        "function": {
                                                          "application": {"function": {"variable": "hydra.core.inference.inferTypeOfInjection"}, "argument": {"variable": "fcx2"}}},
                                                        "argument": {"variable": "cx"}}},
                                                    "argument": {"variable": "i"}}}}}},
                                          {
                                            "name": "unit",
                                            "handler": {
                                              "lambda": {
                                                "parameter": "_",
                                                "domain": "unit",
                                                "body": {
                                                  "typeApplication": {
                                                    "body": {
                                                      "typeApplication": {
                                                        "body": {
                                                          "either": {
                                                            "right": {"application": {"function": {"variable": "hydra.core.inference.inferTypeOfUnit"}, "argument": {"variable": "fcx2"}}}}},
                                                        "type": {"variable": "hydra.core.errors.Error"}}},
                                                    "type": {"variable": "hydra.core.typing.InferenceResult"}}}}}},
                                          {
                                            "name": "unwrap",
                                            "handler": {
                                              "lambda": {
                                                "parameter": "tname",
                                                "domain": {"variable": "hydra.core.model.Name"},
                                                "body": {
                                                  "application": {
                                                    "function": {
                                                      "application": {
                                                        "function": {"application": {"function": {"variable": "hydra.core.inference.inferTypeOfUnwrap"}, "argument": {"variable": "fcx2"}}},
                                                        "argument": {"variable": "cx"}}},
                                                    "argument": {"variable": "tname"}}}}}},
                                          {
                                            "name": "variable",
                                            "handler": {
                                              "lambda": {
                                                "parameter": "name",
                                                "domain": {"variable": "hydra.core.model.Name"},
                                                "body": {
                                                  "application": {
                                                    "function": {
                                                      "application": {
                                                        "function": {
                                                          "application": {"function": {"variable": "hydra.core.inference.inferTypeOfVariable"}, "argument": {"variable": "fcx2"}}},
                                                        "argument": {"variable": "cx"}}},
                                                    "argument": {"variable": "name"}}}}}},
                                          {
                                            "name": "wrap",
                                            "handler": {
                                              "lambda": {
                                                "parameter": "w",
                                                "domain": {"variable": "hydra.core.model.WrappedTerm"},
                                                "body": {
                                                  "application": {
                                                    "function": {
                                                      "application": {
                                                        "function": {
                                                          "application": {"function": {"variable": "hydra.core.inference.inferTypeOfWrappedTerm"}, "argument": {"variable": "fcx2"}}},
                                                        "argument": {"variable": "cx"}}},
                                                    "argument": {"variable": "w"}}}}}}]}},
                                    "argument": {"variable": "term"}}}}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {"literal": {"string": "Infer the type of a given term (Either version)"}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.inference.inferTypeOfTypeApplication",
        "signature": {
          "typeParameters": [],
          "parameters": [
            {"name": "arg0", "type": {"variable": "hydra.core.typing.InferenceContext"}, "isLazy": false},
            {"name": "arg1", "type": {"variable": "hydra.core.graph.Graph"}, "isLazy": false},
            {"name": "arg2", "type": {"variable": "hydra.core.model.TypeApplicationTerm"}, "isLazy": false}],
          "result": {
            "type": {
              "either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.typing.InferenceResult"}}}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "fcx",
                "domain": {"variable": "hydra.core.typing.InferenceContext"},
                "body": {
                  "lambda": {
                    "parameter": "cx",
                    "domain": {"variable": "hydra.core.graph.Graph"},
                    "body": {
                      "lambda": {
                        "parameter": "tt",
                        "domain": {"variable": "hydra.core.model.TypeApplicationTerm"},
                        "body": {
                          "let": {
                            "bindings": [
                              {
                                "name": "fcxBody",
                                "term": {
                                  "application": {
                                    "function": {
                                      "application": {
                                        "function": {"variable": "hydra.core.names.pushSubtermStep"},
                                        "argument": {"inject": {"typeName": "hydra.core.paths.SubtermStep", "field": {"name": "typeApplicationBody", "term": "unit"}}}}},
                                    "argument": {"variable": "fcx"}}},
                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "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.InferenceResult"}}},
                                        "type": {"variable": "hydra.core.typing.InferenceResult"}}},
                                    "argument": {
                                      "application": {
                                        "function": {
                                          "application": {
                                            "function": {
                                              "application": {
                                                "function": {"application": {"function": {"variable": "hydra.core.inference.inferTypeOfTerm"}, "argument": {"variable": "fcxBody"}}},
                                                "argument": {"variable": "cx"}}},
                                            "argument": {
                                              "application": {
                                                "function": {"project": {"typeName": "hydra.core.model.TypeApplicationTerm", "fieldName": "body"}},
                                                "argument": {"variable": "tt"}}}}},
                                        "argument": {"literal": {"string": "type application term"}}}}}},
                                "argument": {
                                  "lambda": {
                                    "parameter": "result",
                                    "domain": {"variable": "hydra.core.typing.InferenceResult"},
                                    "body": {
                                      "let": {
                                        "bindings": [
                                          {
                                            "name": "fcx2",
                                            "term": {
                                              "application": {
                                                "function": {"application": {"function": {"variable": "hydra.core.names.restoreTrace"}, "argument": {"variable": "fcx"}}},
                                                "argument": {
                                                  "application": {
                                                    "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "context"}},
                                                    "argument": {"variable": "result"}}}}},
                                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "constraints": []}}],
                                        "body": {
                                          "typeApplication": {
                                            "body": {
                                              "typeApplication": {
                                                "body": {
                                                  "either": {
                                                    "right": {
                                                      "record": {
                                                        "typeName": "hydra.core.typing.InferenceResult",
                                                        "fields": [
                                                          {
                                                            "name": "term",
                                                            "term": {
                                                              "application": {
                                                                "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "term"}},
                                                                "argument": {"variable": "result"}}}},
                                                          {
                                                            "name": "type",
                                                            "term": {
                                                              "application": {
                                                                "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "type"}},
                                                                "argument": {"variable": "result"}}}},
                                                          {
                                                            "name": "subst",
                                                            "term": {
                                                              "application": {
                                                                "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "subst"}},
                                                                "argument": {"variable": "result"}}}},
                                                          {
                                                            "name": "classConstraints",
                                                            "term": {
                                                              "application": {
                                                                "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "classConstraints"}},
                                                                "argument": {"variable": "result"}}}},
                                                          {"name": "context", "term": {"variable": "fcx2"}}]}}}},
                                                "type": {"variable": "hydra.core.errors.Error"}}},
                                            "type": {"variable": "hydra.core.typing.InferenceResult"}}}}}}}}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {
                    "literal": {
                      "string": "Infer the type of a type application (Either version). Paper: inference.tex, type application terms in the elaborated Term grammar."}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.inference.inferTypeOfTypeLambda",
        "signature": {
          "typeParameters": [],
          "parameters": [
            {"name": "arg0", "type": {"variable": "hydra.core.typing.InferenceContext"}, "isLazy": false},
            {"name": "arg1", "type": {"variable": "hydra.core.graph.Graph"}, "isLazy": false},
            {"name": "arg2", "type": {"variable": "hydra.core.model.TypeLambda"}, "isLazy": false}],
          "result": {
            "type": {
              "either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.typing.InferenceResult"}}}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "fcx",
                "domain": {"variable": "hydra.core.typing.InferenceContext"},
                "body": {
                  "lambda": {
                    "parameter": "cx",
                    "domain": {"variable": "hydra.core.graph.Graph"},
                    "body": {
                      "lambda": {
                        "parameter": "ta",
                        "domain": {"variable": "hydra.core.model.TypeLambda"},
                        "body": {
                          "let": {
                            "bindings": [
                              {
                                "name": "fcxBody",
                                "term": {
                                  "application": {
                                    "function": {
                                      "application": {
                                        "function": {"variable": "hydra.core.names.pushSubtermStep"},
                                        "argument": {"inject": {"typeName": "hydra.core.paths.SubtermStep", "field": {"name": "typeLambdaBody", "term": "unit"}}}}},
                                    "argument": {"variable": "fcx"}}},
                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "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.InferenceResult"}}},
                                        "type": {"variable": "hydra.core.typing.InferenceResult"}}},
                                    "argument": {
                                      "application": {
                                        "function": {
                                          "application": {
                                            "function": {
                                              "application": {
                                                "function": {"application": {"function": {"variable": "hydra.core.inference.inferTypeOfTerm"}, "argument": {"variable": "fcxBody"}}},
                                                "argument": {"variable": "cx"}}},
                                            "argument": {
                                              "application": {
                                                "function": {"project": {"typeName": "hydra.core.model.TypeLambda", "fieldName": "body"}},
                                                "argument": {"variable": "ta"}}}}},
                                        "argument": {"literal": {"string": "type abstraction"}}}}}},
                                "argument": {
                                  "lambda": {
                                    "parameter": "result",
                                    "domain": {"variable": "hydra.core.typing.InferenceResult"},
                                    "body": {
                                      "let": {
                                        "bindings": [
                                          {
                                            "name": "fcx2",
                                            "term": {
                                              "application": {
                                                "function": {"application": {"function": {"variable": "hydra.core.names.restoreTrace"}, "argument": {"variable": "fcx"}}},
                                                "argument": {
                                                  "application": {
                                                    "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "context"}},
                                                    "argument": {"variable": "result"}}}}},
                                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "constraints": []}}],
                                        "body": {
                                          "typeApplication": {
                                            "body": {
                                              "typeApplication": {
                                                "body": {
                                                  "either": {
                                                    "right": {
                                                      "record": {
                                                        "typeName": "hydra.core.typing.InferenceResult",
                                                        "fields": [
                                                          {
                                                            "name": "term",
                                                            "term": {
                                                              "application": {
                                                                "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "term"}},
                                                                "argument": {"variable": "result"}}}},
                                                          {
                                                            "name": "type",
                                                            "term": {
                                                              "application": {
                                                                "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "type"}},
                                                                "argument": {"variable": "result"}}}},
                                                          {
                                                            "name": "subst",
                                                            "term": {
                                                              "application": {
                                                                "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "subst"}},
                                                                "argument": {"variable": "result"}}}},
                                                          {
                                                            "name": "classConstraints",
                                                            "term": {
                                                              "application": {
                                                                "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "classConstraints"}},
                                                                "argument": {"variable": "result"}}}},
                                                          {"name": "context", "term": {"variable": "fcx2"}}]}}}},
                                                "type": {"variable": "hydra.core.errors.Error"}}},
                                            "type": {"variable": "hydra.core.typing.InferenceResult"}}}}}}}}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {
                    "literal": {
                      "string": "Infer the type of a type abstraction (Either version). Paper: inference.tex, type abstraction terms in the elaborated Term grammar."}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.inference.inferTypeOfUnit",
        "signature": {
          "typeParameters": [],
          "parameters": [{"name": "arg0", "type": {"variable": "hydra.core.typing.InferenceContext"}, "isLazy": false}],
          "result": {"type": {"variable": "hydra.core.typing.InferenceResult"}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "fcx",
                "domain": {"variable": "hydra.core.typing.InferenceContext"},
                "body": {
                  "record": {
                    "typeName": "hydra.core.typing.InferenceResult",
                    "fields": [
                      {"name": "term", "term": {"inject": {"typeName": "hydra.core.model.Term", "field": {"name": "unit", "term": "unit"}}}},
                      {"name": "type", "term": {"inject": {"typeName": "hydra.core.model.Type", "field": {"name": "unit", "term": "unit"}}}},
                      {"name": "subst", "term": {"variable": "hydra.core.substitution.idTypeSubst"}},
                      {
                        "name": "classConstraints",
                        "term": {
                          "typeApplication": {
                            "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.empty"}, "type": {"variable": "hydra.core.model.Name"}}},
                            "type": {"variable": "hydra.core.model.TypeVariableConstraints"}}}},
                      {"name": "context", "term": {"variable": "fcx"}}]}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {"literal": {"string": "The trivial inference rule for the unit term. Paper: inference.tex, rule Unit."}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.inference.inferTypeOfUnwrap",
        "signature": {
          "typeParameters": [],
          "parameters": [
            {"name": "arg0", "type": {"variable": "hydra.core.typing.InferenceContext"}, "isLazy": false},
            {"name": "arg1", "type": {"variable": "hydra.core.graph.Graph"}, "isLazy": false},
            {"name": "arg2", "type": {"variable": "hydra.core.model.Name"}, "isLazy": false}],
          "result": {
            "type": {
              "either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.typing.InferenceResult"}}}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "fcx",
                "domain": {"variable": "hydra.core.typing.InferenceContext"},
                "body": {
                  "lambda": {
                    "parameter": "cx",
                    "domain": {"variable": "hydra.core.graph.Graph"},
                    "body": {
                      "lambda": {
                        "parameter": "tname",
                        "domain": {"variable": "hydra.core.model.Name"},
                        "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.model.TypeScheme"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                    "type": {"variable": "hydra.core.typing.InferenceResult"}}},
                                "argument": {
                                  "application": {
                                    "function": {
                                      "application": {
                                        "function": {"application": {"function": {"variable": "hydra.core.resolution.requireSchemaType"}, "argument": {"variable": "fcx"}}},
                                        "argument": {
                                          "application": {
                                            "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "schemaTypes"}},
                                            "argument": {"variable": "cx"}}}}},
                                    "argument": {"variable": "tname"}}}}},
                            "argument": {
                              "lambda": {
                                "parameter": "stRp",
                                "domain": {
                                  "pair": {"first": {"variable": "hydra.core.model.TypeScheme"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}},
                                "body": {
                                  "let": {
                                    "bindings": [
                                      {
                                        "name": "schemaType",
                                        "term": {
                                          "application": {
                                            "function": {
                                              "typeApplication": {
                                                "body": {
                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"variable": "hydra.core.model.TypeScheme"}}},
                                                "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                            "argument": {"variable": "stRp"}}},
                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.TypeScheme"}, "constraints": []}}],
                                    "body": {
                                      "let": {
                                        "bindings": [
                                          {
                                            "name": "fcx2",
                                            "term": {
                                              "application": {
                                                "function": {
                                                  "typeApplication": {
                                                    "body": {
                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"variable": "hydra.core.model.TypeScheme"}}},
                                                    "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                "argument": {"variable": "stRp"}}},
                                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "constraints": []}}],
                                        "body": {
                                          "let": {
                                            "bindings": [
                                              {
                                                "name": "svars",
                                                "term": {
                                                  "application": {
                                                    "function": {"project": {"typeName": "hydra.core.model.TypeScheme", "fieldName": "variables"}},
                                                    "argument": {"variable": "schemaType"}}},
                                                "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Name"}}, "constraints": []}}],
                                            "body": {
                                              "let": {
                                                "bindings": [
                                                  {
                                                    "name": "stype",
                                                    "term": {
                                                      "application": {
                                                        "function": {"project": {"typeName": "hydra.core.model.TypeScheme", "fieldName": "body"}},
                                                        "argument": {"variable": "schemaType"}}},
                                                    "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.typing.InferenceResult"}}},
                                                        "argument": {
                                                          "application": {
                                                            "function": {
                                                              "application": {
                                                                "function": {
                                                                  "typeApplication": {"body": {"variable": "hydra.core.extract.model.wrappedType"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                "argument": {"variable": "tname"}}},
                                                            "argument": {"variable": "stype"}}}}},
                                                    "argument": {
                                                      "lambda": {
                                                        "parameter": "wtyp",
                                                        "domain": {"variable": "hydra.core.model.Type"},
                                                        "body": {
                                                          "typeApplication": {
                                                            "body": {
                                                              "typeApplication": {
                                                                "body": {
                                                                  "either": {
                                                                    "right": {
                                                                      "application": {
                                                                        "function": {
                                                                          "application": {
                                                                            "function": {
                                                                              "application": {
                                                                                "function": {"application": {"function": {"variable": "hydra.core.inference.yield"}, "argument": {"variable": "fcx2"}}},
                                                                                "argument": {
                                                                                  "application": {
                                                                                    "function": {
                                                                                      "application": {"function": {"variable": "hydra.core.inference.buildTypeApplicationTerm"}, "argument": {"variable": "svars"}}},
                                                                                    "argument": {"inject": {"typeName": "hydra.core.model.Term", "field": {"name": "unwrap", "term": {"variable": "tname"}}}}}}}},
                                                                            "argument": {
                                                                              "inject": {
                                                                                "typeName": "hydra.core.model.Type",
                                                                                "field": {
                                                                                  "name": "function",
                                                                                  "term": {
                                                                                    "record": {
                                                                                      "typeName": "hydra.core.model.FunctionType",
                                                                                      "fields": [
                                                                                        {
                                                                                          "name": "domain",
                                                                                          "term": {
                                                                                            "application": {
                                                                                              "function": {
                                                                                                "application": {"function": {"variable": "hydra.core.resolution.nominalApplication"}, "argument": {"variable": "tname"}}},
                                                                                              "argument": {
                                                                                                "application": {
                                                                                                  "function": {
                                                                                                    "application": {
                                                                                                      "function": {
                                                                                                        "typeApplication": {
                                                                                                          "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                          "type": {"variable": "hydra.core.model.Type"}}},
                                                                                                      "argument": {
                                                                                                        "lambda": {
                                                                                                          "parameter": "x",
                                                                                                          "domain": {"variable": "hydra.core.model.Name"},
                                                                                                          "body": {"inject": {"typeName": "hydra.core.model.Type", "field": {"name": "variable", "term": {"variable": "x"}}}}}}}},
                                                                                                  "argument": {"variable": "svars"}}}}}},
                                                                                        {"name": "codomain", "term": {"variable": "wtyp"}}]}}}}}}},
                                                                        "argument": {"variable": "hydra.core.substitution.idTypeSubst"}}}}},
                                                                "type": {"variable": "hydra.core.errors.Error"}}},
                                                            "type": {"variable": "hydra.core.typing.InferenceResult"}}}}}}}}}}}}}}}}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {"literal": {"string": "Infer the type of an unwrap operation (Either version). Paper: inference.tex, rule Unwr."}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.inference.inferTypeOfVariable",
        "signature": {
          "typeParameters": [],
          "parameters": [
            {"name": "arg0", "type": {"variable": "hydra.core.typing.InferenceContext"}, "isLazy": false},
            {"name": "arg1", "type": {"variable": "hydra.core.graph.Graph"}, "isLazy": false},
            {"name": "arg2", "type": {"variable": "hydra.core.model.Name"}, "isLazy": false}],
          "result": {
            "type": {
              "either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.typing.InferenceResult"}}}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "fcx",
                "domain": {"variable": "hydra.core.typing.InferenceContext"},
                "body": {
                  "lambda": {
                    "parameter": "cx",
                    "domain": {"variable": "hydra.core.graph.Graph"},
                    "body": {
                      "lambda": {
                        "parameter": "name",
                        "domain": {"variable": "hydra.core.model.Name"},
                        "body": {
                          "application": {
                            "function": {
                              "application": {
                                "function": {
                                  "application": {
                                    "function": {
                                      "typeApplication": {
                                        "body": {
                                          "typeApplication": {"body": {"variable": "hydra.core.lib.optionals.match"}, "type": {"variable": "hydra.core.model.TypeScheme"}}},
                                        "type": {
                                          "either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.typing.InferenceResult"}}}}},
                                    "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.TypeScheme"}}},
                                            "argument": {"variable": "name"}}},
                                        "argument": {
                                          "application": {
                                            "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "boundTypes"}},
                                            "argument": {"variable": "cx"}}}}}}},
                                "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": {"variable": "hydra.core.typing.InferenceResult"}}}}},
                                            "argument": {
                                              "application": {
                                                "function": {
                                                  "application": {
                                                    "function": {
                                                      "typeApplication": {
                                                        "body": {
                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.optionals.map"}, "type": {"variable": "hydra.core.graph.Primitive"}}},
                                                        "type": {"variable": "hydra.core.model.TypeScheme"}}},
                                                    "argument": {
                                                      "lambda": {
                                                        "parameter": "_p",
                                                        "domain": {"variable": "hydra.core.graph.Primitive"},
                                                        "body": {
                                                          "application": {
                                                            "function": {"variable": "hydra.core.scoping.termSignatureToTypeScheme"},
                                                            "argument": {
                                                              "application": {
                                                                "function": {"project": {"typeName": "hydra.core.packaging.PrimitiveDefinition", "fieldName": "signature"}},
                                                                "argument": {
                                                                  "application": {
                                                                    "function": {"project": {"typeName": "hydra.core.graph.Primitive", "fieldName": "definition"}},
                                                                    "argument": {"variable": "_p"}}}}}}}}}}},
                                                "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.graph.Primitive"}}},
                                                        "argument": {"variable": "name"}}},
                                                    "argument": {
                                                      "application": {
                                                        "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "primitives"}},
                                                        "argument": {"variable": "cx"}}}}}}}}},
                                        "argument": {
                                          "typeApplication": {
                                            "body": {
                                              "typeApplication": {
                                                "body": {
                                                  "either": {
                                                    "left": {
                                                      "inject": {
                                                        "typeName": "hydra.core.errors.Error",
                                                        "field": {
                                                          "name": "resolution",
                                                          "term": {
                                                            "inject": {
                                                              "typeName": "hydra.core.errors.ResolutionError",
                                                              "field": {
                                                                "name": "noSuchBinding",
                                                                "term": {
                                                                  "record": {"typeName": "hydra.core.errors.NoSuchBindingError", "fields": [{"name": "name", "term": {"variable": "name"}}]}}}}}}}}}},
                                                "type": {"variable": "hydra.core.errors.Error"}}},
                                            "type": {"variable": "hydra.core.typing.InferenceResult"}}}}},
                                    "argument": {
                                      "lambda": {
                                        "parameter": "scheme",
                                        "domain": {"variable": "hydra.core.model.TypeScheme"},
                                        "body": {
                                          "let": {
                                            "bindings": [
                                              {
                                                "name": "tsResult",
                                                "term": {
                                                  "application": {
                                                    "function": {
                                                      "application": {"function": {"variable": "hydra.core.resolution.instantiateTypeScheme"}, "argument": {"variable": "fcx"}}},
                                                    "argument": {"variable": "scheme"}}},
                                                "typeScheme": {
                                                  "variables": [],
                                                  "body": {
                                                    "pair": {"first": {"variable": "hydra.core.model.TypeScheme"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                  "constraints": []}}],
                                            "body": {
                                              "let": {
                                                "bindings": [
                                                  {
                                                    "name": "ts",
                                                    "term": {
                                                      "application": {
                                                        "function": {
                                                          "typeApplication": {
                                                            "body": {
                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"variable": "hydra.core.model.TypeScheme"}}},
                                                            "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                        "argument": {"variable": "tsResult"}}},
                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.TypeScheme"}, "constraints": []}}],
                                                "body": {
                                                  "let": {
                                                    "bindings": [
                                                      {
                                                        "name": "fcx2",
                                                        "term": {
                                                          "application": {
                                                            "function": {
                                                              "typeApplication": {
                                                                "body": {
                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"variable": "hydra.core.model.TypeScheme"}}},
                                                                "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                            "argument": {"variable": "tsResult"}}},
                                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "constraints": []}}],
                                                    "body": {
                                                      "let": {
                                                        "bindings": [
                                                          {
                                                            "name": "constraints",
                                                            "term": {
                                                              "application": {
                                                                "function": {"project": {"typeName": "hydra.core.model.TypeScheme", "fieldName": "constraints"}},
                                                                "argument": {"variable": "ts"}}},
                                                            "typeScheme": {
                                                              "variables": [],
                                                              "body": {
                                                                "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}},
                                                              "constraints": []}}],
                                                        "body": {
                                                          "typeApplication": {
                                                            "body": {
                                                              "typeApplication": {
                                                                "body": {
                                                                  "either": {
                                                                    "right": {
                                                                      "application": {
                                                                        "function": {
                                                                          "application": {
                                                                            "function": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "application": {
                                                                                    "function": {
                                                                                      "application": {"function": {"variable": "hydra.core.inference.yieldCheckedWithConstraints"}, "argument": {"variable": "fcx2"}}},
                                                                                    "argument": {
                                                                                      "application": {
                                                                                        "function": {
                                                                                          "application": {
                                                                                            "function": {"variable": "hydra.core.inference.buildTypeApplicationTerm"},
                                                                                            "argument": {
                                                                                              "application": {
                                                                                                "function": {"project": {"typeName": "hydra.core.model.TypeScheme", "fieldName": "variables"}},
                                                                                                "argument": {"variable": "ts"}}}}},
                                                                                        "argument": {"inject": {"typeName": "hydra.core.model.Term", "field": {"name": "variable", "term": {"variable": "name"}}}}}}}},
                                                                                "argument": {
                                                                                  "application": {
                                                                                    "function": {"project": {"typeName": "hydra.core.model.TypeScheme", "fieldName": "body"}},
                                                                                    "argument": {"variable": "ts"}}}}},
                                                                            "argument": {"variable": "hydra.core.substitution.idTypeSubst"}}},
                                                                        "argument": {"variable": "constraints"}}}}},
                                                                "type": {"variable": "hydra.core.errors.Error"}}},
                                                            "type": {"variable": "hydra.core.typing.InferenceResult"}}}}}}}}}}}}}}}}},
                            "argument": {
                              "lambda": {
                                "parameter": "scheme",
                                "domain": {"variable": "hydra.core.model.TypeScheme"},
                                "body": {
                                  "let": {
                                    "bindings": [
                                      {
                                        "name": "tsResult",
                                        "term": {
                                          "application": {
                                            "function": {
                                              "application": {"function": {"variable": "hydra.core.resolution.instantiateTypeScheme"}, "argument": {"variable": "fcx"}}},
                                            "argument": {"variable": "scheme"}}},
                                        "typeScheme": {
                                          "variables": [],
                                          "body": {
                                            "pair": {"first": {"variable": "hydra.core.model.TypeScheme"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}},
                                          "constraints": []}}],
                                    "body": {
                                      "let": {
                                        "bindings": [
                                          {
                                            "name": "ts",
                                            "term": {
                                              "application": {
                                                "function": {
                                                  "typeApplication": {
                                                    "body": {
                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"variable": "hydra.core.model.TypeScheme"}}},
                                                    "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                "argument": {"variable": "tsResult"}}},
                                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.TypeScheme"}, "constraints": []}}],
                                        "body": {
                                          "let": {
                                            "bindings": [
                                              {
                                                "name": "fcx2",
                                                "term": {
                                                  "application": {
                                                    "function": {
                                                      "typeApplication": {
                                                        "body": {
                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"variable": "hydra.core.model.TypeScheme"}}},
                                                        "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                    "argument": {"variable": "tsResult"}}},
                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "constraints": []}}],
                                            "body": {
                                              "let": {
                                                "bindings": [
                                                  {
                                                    "name": "constraints",
                                                    "term": {
                                                      "application": {
                                                        "function": {"project": {"typeName": "hydra.core.model.TypeScheme", "fieldName": "constraints"}},
                                                        "argument": {"variable": "ts"}}},
                                                    "typeScheme": {
                                                      "variables": [],
                                                      "body": {
                                                        "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}},
                                                      "constraints": []}}],
                                                "body": {
                                                  "typeApplication": {
                                                    "body": {
                                                      "typeApplication": {
                                                        "body": {
                                                          "either": {
                                                            "right": {
                                                              "record": {
                                                                "typeName": "hydra.core.typing.InferenceResult",
                                                                "fields": [
                                                                  {
                                                                    "name": "term",
                                                                    "term": {
                                                                      "application": {
                                                                        "function": {
                                                                          "application": {
                                                                            "function": {"variable": "hydra.core.inference.buildTypeApplicationTerm"},
                                                                            "argument": {
                                                                              "application": {
                                                                                "function": {"project": {"typeName": "hydra.core.model.TypeScheme", "fieldName": "variables"}},
                                                                                "argument": {"variable": "ts"}}}}},
                                                                        "argument": {"inject": {"typeName": "hydra.core.model.Term", "field": {"name": "variable", "term": {"variable": "name"}}}}}}},
                                                                  {
                                                                    "name": "type",
                                                                    "term": {
                                                                      "application": {
                                                                        "function": {"project": {"typeName": "hydra.core.model.TypeScheme", "fieldName": "body"}},
                                                                        "argument": {"variable": "ts"}}}},
                                                                  {"name": "subst", "term": {"variable": "hydra.core.substitution.idTypeSubst"}},
                                                                  {"name": "classConstraints", "term": {"variable": "constraints"}},
                                                                  {"name": "context", "term": {"variable": "fcx2"}}]}}}},
                                                        "type": {"variable": "hydra.core.errors.Error"}}},
                                                    "type": {"variable": "hydra.core.typing.InferenceResult"}}}}}}}}}}}}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {
                    "literal": {
                      "string": "Infer the type of a variable (Either version). Paper: inference.tex, rule Var (elaboration form), with rule Prim as the primitive-namespace fallback."}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.inference.inferTypeOfWrappedTerm",
        "signature": {
          "typeParameters": [],
          "parameters": [
            {"name": "arg0", "type": {"variable": "hydra.core.typing.InferenceContext"}, "isLazy": false},
            {"name": "arg1", "type": {"variable": "hydra.core.graph.Graph"}, "isLazy": false},
            {"name": "arg2", "type": {"variable": "hydra.core.model.WrappedTerm"}, "isLazy": false}],
          "result": {
            "type": {
              "either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.typing.InferenceResult"}}}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "fcx",
                "domain": {"variable": "hydra.core.typing.InferenceContext"},
                "body": {
                  "lambda": {
                    "parameter": "cx",
                    "domain": {"variable": "hydra.core.graph.Graph"},
                    "body": {
                      "lambda": {
                        "parameter": "wt",
                        "domain": {"variable": "hydra.core.model.WrappedTerm"},
                        "body": {
                          "let": {
                            "bindings": [
                              {
                                "name": "tname",
                                "term": {
                                  "application": {
                                    "function": {"project": {"typeName": "hydra.core.model.WrappedTerm", "fieldName": "typeName"}},
                                    "argument": {"variable": "wt"}}},
                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Name"}, "constraints": []}}],
                            "body": {
                              "let": {
                                "bindings": [
                                  {
                                    "name": "term",
                                    "term": {
                                      "application": {
                                        "function": {"project": {"typeName": "hydra.core.model.WrappedTerm", "fieldName": "body"}},
                                        "argument": {"variable": "wt"}}},
                                    "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": {
                                                  "pair": {"first": {"variable": "hydra.core.model.TypeScheme"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                            "type": {"variable": "hydra.core.typing.InferenceResult"}}},
                                        "argument": {
                                          "application": {
                                            "function": {
                                              "application": {
                                                "function": {"application": {"function": {"variable": "hydra.core.resolution.requireSchemaType"}, "argument": {"variable": "fcx"}}},
                                                "argument": {
                                                  "application": {
                                                    "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "schemaTypes"}},
                                                    "argument": {"variable": "cx"}}}}},
                                            "argument": {"variable": "tname"}}}}},
                                    "argument": {
                                      "lambda": {
                                        "parameter": "stRp",
                                        "domain": {
                                          "pair": {"first": {"variable": "hydra.core.model.TypeScheme"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}},
                                        "body": {
                                          "let": {
                                            "bindings": [
                                              {
                                                "name": "schemaType",
                                                "term": {
                                                  "application": {
                                                    "function": {
                                                      "typeApplication": {
                                                        "body": {
                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"variable": "hydra.core.model.TypeScheme"}}},
                                                        "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                    "argument": {"variable": "stRp"}}},
                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.TypeScheme"}, "constraints": []}}],
                                            "body": {
                                              "let": {
                                                "bindings": [
                                                  {
                                                    "name": "fcx2",
                                                    "term": {
                                                      "application": {
                                                        "function": {
                                                          "typeApplication": {
                                                            "body": {
                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"variable": "hydra.core.model.TypeScheme"}}},
                                                            "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                        "argument": {"variable": "stRp"}}},
                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "constraints": []}}],
                                                "body": {
                                                  "let": {
                                                    "bindings": [
                                                      {
                                                        "name": "fcxBody",
                                                        "term": {
                                                          "application": {
                                                            "function": {
                                                              "application": {
                                                                "function": {"variable": "hydra.core.names.pushSubtermStep"},
                                                                "argument": {"inject": {"typeName": "hydra.core.paths.SubtermStep", "field": {"name": "wrapBody", "term": "unit"}}}}},
                                                            "argument": {"variable": "fcx2"}}},
                                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "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.InferenceResult"}}},
                                                                "type": {"variable": "hydra.core.typing.InferenceResult"}}},
                                                            "argument": {
                                                              "application": {
                                                                "function": {
                                                                  "application": {
                                                                    "function": {
                                                                      "application": {
                                                                        "function": {"application": {"function": {"variable": "hydra.core.inference.inferTypeOfTerm"}, "argument": {"variable": "fcxBody"}}},
                                                                        "argument": {"variable": "cx"}}},
                                                                    "argument": {"variable": "term"}}},
                                                                "argument": {"literal": {"string": "wrapped term"}}}}}},
                                                        "argument": {
                                                          "lambda": {
                                                            "parameter": "result",
                                                            "domain": {"variable": "hydra.core.typing.InferenceResult"},
                                                            "body": {
                                                              "let": {
                                                                "bindings": [
                                                                  {
                                                                    "name": "fcx3",
                                                                    "term": {
                                                                      "application": {
                                                                        "function": {"application": {"function": {"variable": "hydra.core.names.restoreTrace"}, "argument": {"variable": "fcx2"}}},
                                                                        "argument": {
                                                                          "application": {
                                                                            "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "context"}},
                                                                            "argument": {"variable": "result"}}}}},
                                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "constraints": []}}],
                                                                "body": {
                                                                  "let": {
                                                                    "bindings": [
                                                                      {
                                                                        "name": "svars",
                                                                        "term": {
                                                                          "application": {
                                                                            "function": {"project": {"typeName": "hydra.core.model.TypeScheme", "fieldName": "variables"}},
                                                                            "argument": {"variable": "schemaType"}}},
                                                                        "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Name"}}, "constraints": []}}],
                                                                    "body": {
                                                                      "let": {
                                                                        "bindings": [
                                                                          {
                                                                            "name": "stype",
                                                                            "term": {
                                                                              "application": {
                                                                                "function": {"project": {"typeName": "hydra.core.model.TypeScheme", "fieldName": "body"}},
                                                                                "argument": {"variable": "schemaType"}}},
                                                                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
                                                                        "body": {
                                                                          "let": {
                                                                            "bindings": [
                                                                              {
                                                                                "name": "iterm",
                                                                                "term": {
                                                                                  "application": {
                                                                                    "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "term"}},
                                                                                    "argument": {"variable": "result"}}},
                                                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                                                            "body": {
                                                                              "let": {
                                                                                "bindings": [
                                                                                  {
                                                                                    "name": "itype",
                                                                                    "term": {
                                                                                      "application": {
                                                                                        "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "type"}},
                                                                                        "argument": {"variable": "result"}}},
                                                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
                                                                                "body": {
                                                                                  "let": {
                                                                                    "bindings": [
                                                                                      {
                                                                                        "name": "isubst",
                                                                                        "term": {
                                                                                          "application": {
                                                                                            "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "subst"}},
                                                                                            "argument": {"variable": "result"}}},
                                                                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.TypeSubst"}, "constraints": []}}],
                                                                                    "body": {
                                                                                      "let": {
                                                                                        "bindings": [
                                                                                          {
                                                                                            "name": "ityp",
                                                                                            "term": {"inject": {"typeName": "hydra.core.model.Type", "field": {"name": "wrap", "term": {"variable": "itype"}}}},
                                                                                            "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.typing.InferenceResult"}}},
                                                                                                    "type": {"variable": "hydra.core.typing.InferenceResult"}}},
                                                                                                "argument": {
                                                                                                  "application": {
                                                                                                    "function": {
                                                                                                      "application": {
                                                                                                        "function": {
                                                                                                          "application": {
                                                                                                            "function": {
                                                                                                              "application": {
                                                                                                                "function": {
                                                                                                                  "typeApplication": {"body": {"variable": "hydra.core.inference.mapConstraints"}, "type": {"variable": "hydra.core.typing.InferenceResult"}}},
                                                                                                                "argument": {"variable": "fcx3"}}},
                                                                                                            "argument": {"variable": "cx"}}},
                                                                                                        "argument": {
                                                                                                          "lambda": {
                                                                                                            "parameter": "subst",
                                                                                                            "domain": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                            "body": {
                                                                                                              "application": {
                                                                                                                "function": {
                                                                                                                  "application": {
                                                                                                                    "function": {
                                                                                                                      "application": {
                                                                                                                        "function": {"application": {"function": {"variable": "hydra.core.inference.yield"}, "argument": {"variable": "fcx3"}}},
                                                                                                                        "argument": {
                                                                                                                          "application": {
                                                                                                                            "function": {
                                                                                                                              "application": {"function": {"variable": "hydra.core.inference.buildTypeApplicationTerm"}, "argument": {"variable": "svars"}}},
                                                                                                                            "argument": {
                                                                                                                              "inject": {
                                                                                                                                "typeName": "hydra.core.model.Term",
                                                                                                                                "field": {
                                                                                                                                  "name": "wrap",
                                                                                                                                  "term": {
                                                                                                                                    "record": {
                                                                                                                                      "typeName": "hydra.core.model.WrappedTerm",
                                                                                                                                      "fields": [{"name": "typeName", "term": {"variable": "tname"}}, {"name": "body", "term": {"variable": "iterm"}}]}}}}}}}}},
                                                                                                                    "argument": {
                                                                                                                      "application": {
                                                                                                                        "function": {
                                                                                                                          "application": {"function": {"variable": "hydra.core.resolution.nominalApplication"}, "argument": {"variable": "tname"}}},
                                                                                                                        "argument": {
                                                                                                                          "application": {
                                                                                                                            "function": {
                                                                                                                              "application": {
                                                                                                                                "function": {
                                                                                                                                  "typeApplication": {
                                                                                                                                    "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                                                    "type": {"variable": "hydra.core.model.Type"}}},
                                                                                                                                "argument": {
                                                                                                                                  "lambda": {
                                                                                                                                    "parameter": "x",
                                                                                                                                    "domain": {"variable": "hydra.core.model.Name"},
                                                                                                                                    "body": {"inject": {"typeName": "hydra.core.model.Type", "field": {"name": "variable", "term": {"variable": "x"}}}}}}}},
                                                                                                                            "argument": {"variable": "svars"}}}}}}},
                                                                                                                "argument": {
                                                                                                                  "application": {
                                                                                                                    "function": {
                                                                                                                      "application": {"function": {"variable": "hydra.core.substitution.composeTypeSubst"}, "argument": {"variable": "isubst"}}},
                                                                                                                    "argument": {"variable": "subst"}}}}}}}}},
                                                                                                    "argument": {
                                                                                                      "list": [
                                                                                                        {
                                                                                                          "record": {
                                                                                                            "typeName": "hydra.core.typing.TypeConstraint",
                                                                                                            "fields": [
                                                                                                              {"name": "left", "term": {"variable": "stype"}},
                                                                                                              {"name": "right", "term": {"variable": "ityp"}},
                                                                                                              {"name": "comment", "term": {"literal": {"string": "schema type of wrapper"}}}]}}]}}}}},
                                                                                            "argument": {
                                                                                              "lambda": {
                                                                                                "parameter": "mcResult",
                                                                                                "domain": {"variable": "hydra.core.typing.InferenceResult"},
                                                                                                "body": {
                                                                                                  "typeApplication": {
                                                                                                    "body": {
                                                                                                      "typeApplication": {"body": {"either": {"right": {"variable": "mcResult"}}}, "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                                    "type": {"variable": "hydra.core.typing.InferenceResult"}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {"literal": {"string": "Infer the type of a wrapped term (Either version). Paper: inference.tex, rule Wrp."}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.inference.inferTypesOfTemporaryBindings",
        "signature": {
          "typeParameters": [],
          "parameters": [
            {"name": "arg0", "type": {"variable": "hydra.core.typing.InferenceContext"}, "isLazy": false},
            {"name": "arg1", "type": {"variable": "hydra.core.graph.Graph"}, "isLazy": false},
            {"name": "arg2", "type": {"list": {"variable": "hydra.core.model.Binding"}}, "isLazy": false}],
          "result": {
            "type": {
              "either": {
                "left": {"variable": "hydra.core.errors.Error"},
                "right": {
                  "pair": {
                    "first": {
                      "pair": {
                        "first": {"list": {"variable": "hydra.core.model.Term"}},
                        "second": {
                          "pair": {
                            "first": {"list": {"variable": "hydra.core.model.Type"}},
                            "second": {
                              "pair": {
                                "first": {"variable": "hydra.core.typing.TypeSubst"},
                                "second": {
                                  "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}},
                    "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "fcx",
                "domain": {"variable": "hydra.core.typing.InferenceContext"},
                "body": {
                  "lambda": {
                    "parameter": "cx",
                    "domain": {"variable": "hydra.core.graph.Graph"},
                    "body": {
                      "lambda": {
                        "parameter": "bins",
                        "domain": {"list": {"variable": "hydra.core.model.Binding"}},
                        "body": {
                          "let": {
                            "bindings": [
                              {
                                "name": "emptyResult",
                                "term": {
                                  "typeLambda": {
                                    "parameter": "t0",
                                    "body": {
                                      "typeLambda": {
                                        "parameter": "t1",
                                        "body": {
                                          "typeLambda": {
                                            "parameter": "t2",
                                            "body": {
                                              "typeLambda": {
                                                "parameter": "t3",
                                                "body": {
                                                  "typeLambda": {
                                                    "parameter": "t4",
                                                    "body": {
                                                      "typeApplication": {
                                                        "body": {
                                                          "typeApplication": {
                                                            "body": {
                                                              "either": {
                                                                "right": {
                                                                  "typeApplication": {
                                                                    "body": {
                                                                      "typeApplication": {
                                                                        "body": {
                                                                          "pair": {
                                                                            "first": {
                                                                              "typeApplication": {
                                                                                "body": {
                                                                                  "typeApplication": {
                                                                                    "body": {
                                                                                      "pair": {
                                                                                        "first": {"typeApplication": {"body": {"list": []}, "type": {"variable": "t1"}}},
                                                                                        "second": {
                                                                                          "typeApplication": {
                                                                                            "body": {
                                                                                              "typeApplication": {
                                                                                                "body": {
                                                                                                  "pair": {
                                                                                                    "first": {"typeApplication": {"body": {"list": []}, "type": {"variable": "t2"}}},
                                                                                                    "second": {
                                                                                                      "typeApplication": {
                                                                                                        "body": {
                                                                                                          "typeApplication": {
                                                                                                            "body": {
                                                                                                              "pair": {
                                                                                                                "first": {"variable": "hydra.core.substitution.idTypeSubst"},
                                                                                                                "second": {
                                                                                                                  "typeApplication": {
                                                                                                                    "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.empty"}, "type": {"variable": "t3"}}},
                                                                                                                    "type": {"variable": "t4"}}}}},
                                                                                                            "type": {"variable": "hydra.core.typing.TypeSubst"}}},
                                                                                                        "type": {"map": {"keys": {"variable": "t3"}, "values": {"variable": "t4"}}}}}}},
                                                                                                "type": {"list": {"variable": "t2"}}}},
                                                                                            "type": {
                                                                                              "pair": {
                                                                                                "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                "second": {"map": {"keys": {"variable": "t3"}, "values": {"variable": "t4"}}}}}}}}},
                                                                                    "type": {"list": {"variable": "t1"}}}},
                                                                                "type": {
                                                                                  "pair": {
                                                                                    "first": {"list": {"variable": "t2"}},
                                                                                    "second": {
                                                                                      "pair": {
                                                                                        "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                        "second": {"map": {"keys": {"variable": "t3"}, "values": {"variable": "t4"}}}}}}}}},
                                                                            "second": {"variable": "fcx"}}},
                                                                        "type": {
                                                                          "pair": {
                                                                            "first": {"list": {"variable": "t1"}},
                                                                            "second": {
                                                                              "pair": {
                                                                                "first": {"list": {"variable": "t2"}},
                                                                                "second": {
                                                                                  "pair": {
                                                                                    "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                    "second": {"map": {"keys": {"variable": "t3"}, "values": {"variable": "t4"}}}}}}}}}}},
                                                                    "type": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                            "type": {"variable": "t0"}}},
                                                        "type": {
                                                          "pair": {
                                                            "first": {
                                                              "pair": {
                                                                "first": {"list": {"variable": "t1"}},
                                                                "second": {
                                                                  "pair": {
                                                                    "first": {"list": {"variable": "t2"}},
                                                                    "second": {
                                                                      "pair": {
                                                                        "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                        "second": {"map": {"keys": {"variable": "t3"}, "values": {"variable": "t4"}}}}}}}}},
                                                            "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}}}}}}}}}},
                                "typeScheme": {
                                  "variables": ["t0", "t1", "t2", "t3", "t4"],
                                  "body": {
                                    "either": {
                                      "left": {"variable": "t0"},
                                      "right": {
                                        "pair": {
                                          "first": {
                                            "pair": {
                                              "first": {"list": {"variable": "t1"}},
                                              "second": {
                                                "pair": {
                                                  "first": {"list": {"variable": "t2"}},
                                                  "second": {
                                                    "pair": {
                                                      "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                      "second": {"map": {"keys": {"variable": "t3"}, "values": {"variable": "t4"}}}}}}}}},
                                          "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                  "constraints": []}}],
                            "body": {
                              "application": {
                                "function": {
                                  "application": {
                                    "function": {
                                      "application": {
                                        "function": {
                                          "typeApplication": {
                                            "body": {
                                              "typeApplication": {
                                                "body": {"variable": "hydra.core.lib.optionals.match"},
                                                "type": {
                                                  "pair": {"first": {"variable": "hydra.core.model.Binding"}, "second": {"list": {"variable": "hydra.core.model.Binding"}}}}}},
                                            "type": {
                                              "either": {
                                                "left": {"variable": "hydra.core.errors.Error"},
                                                "right": {
                                                  "pair": {
                                                    "first": {
                                                      "pair": {
                                                        "first": {"list": {"variable": "hydra.core.model.Term"}},
                                                        "second": {
                                                          "pair": {
                                                            "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                            "second": {
                                                              "pair": {
                                                                "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                "second": {
                                                                  "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}},
                                                    "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}},
                                        "argument": {
                                          "application": {
                                            "function": {
                                              "typeApplication": {"body": {"variable": "hydra.core.lib.lists.uncons"}, "type": {"variable": "hydra.core.model.Binding"}}},
                                            "argument": {"variable": "bins"}}}}},
                                    "argument": {
                                      "typeApplication": {
                                        "body": {
                                          "typeApplication": {
                                            "body": {
                                              "typeApplication": {
                                                "body": {
                                                  "typeApplication": {
                                                    "body": {"typeApplication": {"body": {"variable": "emptyResult"}, "type": {"variable": "hydra.core.errors.Error"}}},
                                                    "type": {"variable": "hydra.core.model.Term"}}},
                                                "type": {"variable": "hydra.core.model.Type"}}},
                                            "type": {"variable": "hydra.core.model.Name"}}},
                                        "type": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}},
                                "argument": {
                                  "lambda": {
                                    "parameter": "binsUc",
                                    "domain": {
                                      "pair": {"first": {"variable": "hydra.core.model.Binding"}, "second": {"list": {"variable": "hydra.core.model.Binding"}}}},
                                    "body": {
                                      "let": {
                                        "bindings": [
                                          {
                                            "name": "binding",
                                            "term": {
                                              "application": {
                                                "function": {
                                                  "typeApplication": {
                                                    "body": {
                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"variable": "hydra.core.model.Binding"}}},
                                                    "type": {"list": {"variable": "hydra.core.model.Binding"}}}},
                                                "argument": {"variable": "binsUc"}}},
                                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Binding"}, "constraints": []}}],
                                        "body": {
                                          "let": {
                                            "bindings": [
                                              {
                                                "name": "tl",
                                                "term": {
                                                  "application": {
                                                    "function": {
                                                      "typeApplication": {
                                                        "body": {
                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"variable": "hydra.core.model.Binding"}}},
                                                        "type": {"list": {"variable": "hydra.core.model.Binding"}}}},
                                                    "argument": {"variable": "binsUc"}}},
                                                "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Binding"}}, "constraints": []}}],
                                            "body": {
                                              "let": {
                                                "bindings": [
                                                  {
                                                    "name": "k",
                                                    "term": {
                                                      "application": {
                                                        "function": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "name"}},
                                                        "argument": {"variable": "binding"}}},
                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Name"}, "constraints": []}}],
                                                "body": {
                                                  "let": {
                                                    "bindings": [
                                                      {
                                                        "name": "v",
                                                        "term": {
                                                          "application": {
                                                            "function": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "term"}},
                                                            "argument": {"variable": "binding"}}},
                                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                                    "body": {
                                                      "let": {
                                                        "bindings": [
                                                          {
                                                            "name": "fcxBind",
                                                            "term": {
                                                              "application": {
                                                                "function": {
                                                                  "application": {
                                                                    "function": {"variable": "hydra.core.names.pushSubtermStep"},
                                                                    "argument": {"inject": {"typeName": "hydra.core.paths.SubtermStep", "field": {"name": "letBinding", "term": {"variable": "k"}}}}}},
                                                                "argument": {"variable": "fcx"}}},
                                                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "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.InferenceResult"}}},
                                                                    "type": {
                                                                      "pair": {
                                                                        "first": {
                                                                          "pair": {
                                                                            "first": {"list": {"variable": "hydra.core.model.Term"}},
                                                                            "second": {
                                                                              "pair": {
                                                                                "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                "second": {
                                                                                  "pair": {
                                                                                    "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                    "second": {
                                                                                      "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}},
                                                                        "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                "argument": {
                                                                  "application": {
                                                                    "function": {
                                                                      "application": {
                                                                        "function": {
                                                                          "application": {
                                                                            "function": {"application": {"function": {"variable": "hydra.core.inference.inferTypeOfTerm"}, "argument": {"variable": "fcxBind"}}},
                                                                            "argument": {"variable": "cx"}}},
                                                                        "argument": {"variable": "v"}}},
                                                                    "argument": {
                                                                      "application": {
                                                                        "function": {"variable": "hydra.core.lib.strings.concat"},
                                                                        "argument": {
                                                                          "list": [
                                                                            {"literal": {"string": "temporary let binding '"}},
                                                                            {"application": {"function": {"unwrap": "hydra.core.model.Name"}, "argument": {"variable": "k"}}},
                                                                            {"literal": {"string": "'"}}]}}}}}}},
                                                            "argument": {
                                                              "lambda": {
                                                                "parameter": "result1",
                                                                "domain": {"variable": "hydra.core.typing.InferenceResult"},
                                                                "body": {
                                                                  "let": {
                                                                    "bindings": [
                                                                      {
                                                                        "name": "fcx2",
                                                                        "term": {
                                                                          "application": {
                                                                            "function": {"application": {"function": {"variable": "hydra.core.names.restoreTrace"}, "argument": {"variable": "fcx"}}},
                                                                            "argument": {
                                                                              "application": {
                                                                                "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "context"}},
                                                                                "argument": {"variable": "result1"}}}}},
                                                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "constraints": []}}],
                                                                    "body": {
                                                                      "let": {
                                                                        "bindings": [
                                                                          {
                                                                            "name": "j",
                                                                            "term": {
                                                                              "application": {
                                                                                "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "term"}},
                                                                                "argument": {"variable": "result1"}}},
                                                                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                                                        "body": {
                                                                          "let": {
                                                                            "bindings": [
                                                                              {
                                                                                "name": "u_prime",
                                                                                "term": {
                                                                                  "application": {
                                                                                    "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "type"}},
                                                                                    "argument": {"variable": "result1"}}},
                                                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
                                                                            "body": {
                                                                              "let": {
                                                                                "bindings": [
                                                                                  {
                                                                                    "name": "u",
                                                                                    "term": {
                                                                                      "application": {
                                                                                        "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "subst"}},
                                                                                        "argument": {"variable": "result1"}}},
                                                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.TypeSubst"}, "constraints": []}}],
                                                                                "body": {
                                                                                  "let": {
                                                                                    "bindings": [
                                                                                      {
                                                                                        "name": "c1Inferred",
                                                                                        "term": {
                                                                                          "application": {
                                                                                            "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "classConstraints"}},
                                                                                            "argument": {"variable": "result1"}}},
                                                                                        "typeScheme": {
                                                                                          "variables": [],
                                                                                          "body": {
                                                                                            "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}},
                                                                                          "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.TypeVariableConstraints"}}}}},
                                                                                                "type": {
                                                                                                  "pair": {
                                                                                                    "first": {
                                                                                                      "pair": {
                                                                                                        "first": {"list": {"variable": "hydra.core.model.Term"}},
                                                                                                        "second": {
                                                                                                          "pair": {
                                                                                                            "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                                            "second": {
                                                                                                              "pair": {
                                                                                                                "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                                "second": {
                                                                                                                  "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}},
                                                                                                    "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                            "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": {
                                                                                                                  "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}},
                                                                                                        "argument": {
                                                                                                          "application": {
                                                                                                            "function": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "typeScheme"}},
                                                                                                            "argument": {"variable": "binding"}}}}},
                                                                                                    "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.TypeVariableConstraints"}}}}},
                                                                                                            "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                                        "type": {
                                                                                                          "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}},
                                                                                                "argument": {
                                                                                                  "lambda": {
                                                                                                    "parameter": "ts",
                                                                                                    "domain": {"variable": "hydra.core.model.TypeScheme"},
                                                                                                    "body": {
                                                                                                      "let": {
                                                                                                        "bindings": [
                                                                                                          {
                                                                                                            "name": "tsResult",
                                                                                                            "term": {
                                                                                                              "application": {
                                                                                                                "function": {
                                                                                                                  "application": {"function": {"variable": "hydra.core.resolution.instantiateTypeScheme"}, "argument": {"variable": "fcx2"}}},
                                                                                                                "argument": {"variable": "ts"}}},
                                                                                                            "typeScheme": {
                                                                                                              "variables": [],
                                                                                                              "body": {
                                                                                                                "pair": {"first": {"variable": "hydra.core.model.TypeScheme"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                                              "constraints": []}}],
                                                                                                        "body": {
                                                                                                          "let": {
                                                                                                            "bindings": [
                                                                                                              {
                                                                                                                "name": "instantiatedTs",
                                                                                                                "term": {
                                                                                                                  "application": {
                                                                                                                    "function": {
                                                                                                                      "typeApplication": {
                                                                                                                        "body": {
                                                                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"variable": "hydra.core.model.TypeScheme"}}},
                                                                                                                        "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                                                    "argument": {"variable": "tsResult"}}},
                                                                                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.TypeScheme"}, "constraints": []}}],
                                                                                                            "body": {
                                                                                                              "let": {
                                                                                                                "bindings": [
                                                                                                                  {
                                                                                                                    "name": "freshConstraints",
                                                                                                                    "term": {
                                                                                                                      "application": {
                                                                                                                        "function": {"project": {"typeName": "hydra.core.model.TypeScheme", "fieldName": "constraints"}},
                                                                                                                        "argument": {"variable": "instantiatedTs"}}},
                                                                                                                    "typeScheme": {
                                                                                                                      "variables": [],
                                                                                                                      "body": {
                                                                                                                        "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}},
                                                                                                                      "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.TypeSubst"}}},
                                                                                                                            "type": {
                                                                                                                              "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}},
                                                                                                                        "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.UnificationError"}}},
                                                                                                                                                "type": {"variable": "hydra.core.typing.TypeSubst"}}},
                                                                                                                                            "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                                                                        "type": {"variable": "hydra.core.typing.TypeSubst"}}},
                                                                                                                                    "argument": {
                                                                                                                                      "lambda": {
                                                                                                                                        "parameter": "_e",
                                                                                                                                        "domain": {"variable": "hydra.core.errors.UnificationError"},
                                                                                                                                        "body": {
                                                                                                                                          "inject": {
                                                                                                                                            "typeName": "hydra.core.errors.Error",
                                                                                                                                            "field": {
                                                                                                                                              "name": "inference",
                                                                                                                                              "term": {
                                                                                                                                                "inject": {
                                                                                                                                                  "typeName": "hydra.core.errors.InferenceError",
                                                                                                                                                  "field": {
                                                                                                                                                    "name": "unification",
                                                                                                                                                    "term": {
                                                                                                                                                      "record": {
                                                                                                                                                        "typeName": "hydra.core.errors.UnificationInferenceError",
                                                                                                                                                        "fields": [
                                                                                                                                                          {
                                                                                                                                                            "name": "path",
                                                                                                                                                            "term": {
                                                                                                                                                              "wrap": {
                                                                                                                                                                "typeName": "hydra.core.paths.SubtermPath",
                                                                                                                                                                "body": {
                                                                                                                                                                  "application": {
                                                                                                                                                                    "function": {
                                                                                                                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.lists.reverse"}, "type": {"variable": "hydra.core.paths.SubtermStep"}}},
                                                                                                                                                                    "argument": {
                                                                                                                                                                      "application": {
                                                                                                                                                                        "function": {"project": {"typeName": "hydra.core.typing.InferenceContext", "fieldName": "trace"}},
                                                                                                                                                                        "argument": {"variable": "fcx2"}}}}}}}},
                                                                                                                                                          {"name": "cause", "term": {"variable": "_e"}}]}}}}}}}}}}}},
                                                                                                                                "argument": {"lambda": {"parameter": "_a", "domain": {"variable": "hydra.core.typing.TypeSubst"}, "body": {"variable": "_a"}}}}},
                                                                                                                            "argument": {
                                                                                                                              "application": {
                                                                                                                                "function": {
                                                                                                                                  "application": {
                                                                                                                                    "function": {
                                                                                                                                      "application": {
                                                                                                                                        "function": {
                                                                                                                                          "application": {
                                                                                                                                            "function": {
                                                                                                                                              "application": {
                                                                                                                                                "function": {
                                                                                                                                                  "typeApplication": {"body": {"variable": "hydra.core.unification.unifyTypes"}, "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                                                                                "argument": {"variable": "fcx2"}}},
                                                                                                                                            "argument": {
                                                                                                                                              "application": {
                                                                                                                                                "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "schemaTypes"}},
                                                                                                                                                "argument": {"variable": "cx"}}}}},
                                                                                                                                        "argument": {
                                                                                                                                          "application": {
                                                                                                                                            "function": {"project": {"typeName": "hydra.core.model.TypeScheme", "fieldName": "body"}},
                                                                                                                                            "argument": {"variable": "instantiatedTs"}}}}},
                                                                                                                                    "argument": {"variable": "u_prime"}}},
                                                                                                                                "argument": {"literal": {"string": "original binding type"}}}}}}}},
                                                                                                                    "argument": {
                                                                                                                      "lambda": {
                                                                                                                        "parameter": "unifySubst",
                                                                                                                        "domain": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                                        "body": {
                                                                                                                          "typeApplication": {
                                                                                                                            "body": {
                                                                                                                              "typeApplication": {
                                                                                                                                "body": {
                                                                                                                                  "either": {
                                                                                                                                    "right": {
                                                                                                                                      "application": {
                                                                                                                                        "function": {
                                                                                                                                          "application": {"function": {"variable": "hydra.core.substitution.substInClassConstraints"}, "argument": {"variable": "unifySubst"}}},
                                                                                                                                        "argument": {"variable": "freshConstraints"}}}}},
                                                                                                                                "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                                                            "type": {
                                                                                                                              "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}}}}}}}}}}}}}},
                                                                                        "argument": {
                                                                                          "lambda": {
                                                                                            "parameter": "originalBindingConstraints",
                                                                                            "domain": {
                                                                                              "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}},
                                                                                            "body": {
                                                                                              "let": {
                                                                                                "bindings": [
                                                                                                  {
                                                                                                    "name": "c1",
                                                                                                    "term": {
                                                                                                      "application": {
                                                                                                        "function": {
                                                                                                          "application": {
                                                                                                            "function": {
                                                                                                              "typeApplication": {"body": {"variable": "hydra.core.inference.mergeClassConstraints"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                            "argument": {"variable": "c1Inferred"}}},
                                                                                                        "argument": {"variable": "originalBindingConstraints"}}},
                                                                                                    "typeScheme": {
                                                                                                      "variables": [],
                                                                                                      "body": {
                                                                                                        "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}},
                                                                                                      "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": {
                                                                                                                  "pair": {
                                                                                                                    "first": {
                                                                                                                      "pair": {
                                                                                                                        "first": {"list": {"variable": "hydra.core.model.Term"}},
                                                                                                                        "second": {
                                                                                                                          "pair": {
                                                                                                                            "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                                                            "second": {
                                                                                                                              "pair": {
                                                                                                                                "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                                                "second": {
                                                                                                                                  "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}},
                                                                                                                    "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                                            "type": {
                                                                                                              "pair": {
                                                                                                                "first": {
                                                                                                                  "pair": {
                                                                                                                    "first": {"list": {"variable": "hydra.core.model.Term"}},
                                                                                                                    "second": {
                                                                                                                      "pair": {
                                                                                                                        "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                                                        "second": {
                                                                                                                          "pair": {
                                                                                                                            "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                                            "second": {
                                                                                                                              "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}},
                                                                                                                "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                                        "argument": {
                                                                                                          "application": {
                                                                                                            "function": {
                                                                                                              "application": {
                                                                                                                "function": {
                                                                                                                  "application": {"function": {"variable": "hydra.core.inference.inferTypesOfTemporaryBindings"}, "argument": {"variable": "fcx2"}}},
                                                                                                                "argument": {
                                                                                                                  "application": {
                                                                                                                    "function": {"application": {"function": {"variable": "hydra.core.substitution.substInContext"}, "argument": {"variable": "u"}}},
                                                                                                                    "argument": {"variable": "cx"}}}}},
                                                                                                            "argument": {"variable": "tl"}}}}},
                                                                                                    "argument": {
                                                                                                      "lambda": {
                                                                                                        "parameter": "rp2",
                                                                                                        "domain": {
                                                                                                          "pair": {
                                                                                                            "first": {
                                                                                                              "pair": {
                                                                                                                "first": {"list": {"variable": "hydra.core.model.Term"}},
                                                                                                                "second": {
                                                                                                                  "pair": {
                                                                                                                    "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                                                    "second": {
                                                                                                                      "pair": {
                                                                                                                        "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                                        "second": {
                                                                                                                          "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}},
                                                                                                            "second": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                                        "body": {
                                                                                                          "let": {
                                                                                                            "bindings": [
                                                                                                              {
                                                                                                                "name": "result2",
                                                                                                                "term": {
                                                                                                                  "application": {
                                                                                                                    "function": {
                                                                                                                      "typeApplication": {
                                                                                                                        "body": {
                                                                                                                          "typeApplication": {
                                                                                                                            "body": {"variable": "hydra.core.lib.pairs.first"},
                                                                                                                            "type": {
                                                                                                                              "pair": {
                                                                                                                                "first": {"list": {"variable": "hydra.core.model.Term"}},
                                                                                                                                "second": {
                                                                                                                                  "pair": {
                                                                                                                                    "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                                                                    "second": {
                                                                                                                                      "pair": {
                                                                                                                                        "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                                                        "second": {
                                                                                                                                          "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}}}},
                                                                                                                        "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                                                    "argument": {"variable": "rp2"}}},
                                                                                                                "typeScheme": {
                                                                                                                  "variables": [],
                                                                                                                  "body": {
                                                                                                                    "pair": {
                                                                                                                      "first": {"list": {"variable": "hydra.core.model.Term"}},
                                                                                                                      "second": {
                                                                                                                        "pair": {
                                                                                                                          "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                                                          "second": {
                                                                                                                            "pair": {
                                                                                                                              "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                                              "second": {
                                                                                                                                "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}},
                                                                                                                  "constraints": []}}],
                                                                                                            "body": {
                                                                                                              "let": {
                                                                                                                "bindings": [
                                                                                                                  {
                                                                                                                    "name": "fcx3",
                                                                                                                    "term": {
                                                                                                                      "application": {
                                                                                                                        "function": {
                                                                                                                          "typeApplication": {
                                                                                                                            "body": {
                                                                                                                              "typeApplication": {
                                                                                                                                "body": {"variable": "hydra.core.lib.pairs.second"},
                                                                                                                                "type": {
                                                                                                                                  "pair": {
                                                                                                                                    "first": {"list": {"variable": "hydra.core.model.Term"}},
                                                                                                                                    "second": {
                                                                                                                                      "pair": {
                                                                                                                                        "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                                                                        "second": {
                                                                                                                                          "pair": {
                                                                                                                                            "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                                                            "second": {
                                                                                                                                              "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}}}},
                                                                                                                            "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                                                        "argument": {"variable": "rp2"}}},
                                                                                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "constraints": []}}],
                                                                                                                "body": {
                                                                                                                  "let": {
                                                                                                                    "bindings": [
                                                                                                                      {
                                                                                                                        "name": "h",
                                                                                                                        "term": {
                                                                                                                          "application": {
                                                                                                                            "function": {
                                                                                                                              "typeApplication": {
                                                                                                                                "body": {
                                                                                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"list": {"variable": "hydra.core.model.Term"}}}},
                                                                                                                                "type": {
                                                                                                                                  "pair": {
                                                                                                                                    "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                                                                    "second": {
                                                                                                                                      "pair": {
                                                                                                                                        "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                                                        "second": {
                                                                                                                                          "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}},
                                                                                                                            "argument": {"variable": "result2"}}},
                                                                                                                        "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Term"}}, "constraints": []}}],
                                                                                                                    "body": {
                                                                                                                      "let": {
                                                                                                                        "bindings": [
                                                                                                                          {
                                                                                                                            "name": "r_prime",
                                                                                                                            "term": {
                                                                                                                              "application": {
                                                                                                                                "function": {
                                                                                                                                  "typeApplication": {
                                                                                                                                    "body": {
                                                                                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                                                                                                    "type": {
                                                                                                                                      "pair": {
                                                                                                                                        "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                                                        "second": {
                                                                                                                                          "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}},
                                                                                                                                "argument": {
                                                                                                                                  "application": {
                                                                                                                                    "function": {
                                                                                                                                      "typeApplication": {
                                                                                                                                        "body": {
                                                                                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"list": {"variable": "hydra.core.model.Term"}}}},
                                                                                                                                        "type": {
                                                                                                                                          "pair": {
                                                                                                                                            "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                                                                            "second": {
                                                                                                                                              "pair": {
                                                                                                                                                "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                                                                "second": {
                                                                                                                                                  "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}},
                                                                                                                                    "argument": {"variable": "result2"}}}}},
                                                                                                                            "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Type"}}, "constraints": []}}],
                                                                                                                        "body": {
                                                                                                                          "let": {
                                                                                                                            "bindings": [
                                                                                                                              {
                                                                                                                                "name": "restPair",
                                                                                                                                "term": {
                                                                                                                                  "application": {
                                                                                                                                    "function": {
                                                                                                                                      "typeApplication": {
                                                                                                                                        "body": {
                                                                                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                                                                                                        "type": {
                                                                                                                                          "pair": {
                                                                                                                                            "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                                                            "second": {
                                                                                                                                              "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}},
                                                                                                                                    "argument": {
                                                                                                                                      "application": {
                                                                                                                                        "function": {
                                                                                                                                          "typeApplication": {
                                                                                                                                            "body": {
                                                                                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"list": {"variable": "hydra.core.model.Term"}}}},
                                                                                                                                            "type": {
                                                                                                                                              "pair": {
                                                                                                                                                "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                                                                                "second": {
                                                                                                                                                  "pair": {
                                                                                                                                                    "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                                                                    "second": {
                                                                                                                                                      "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}},
                                                                                                                                        "argument": {"variable": "result2"}}}}},
                                                                                                                                "typeScheme": {
                                                                                                                                  "variables": [],
                                                                                                                                  "body": {
                                                                                                                                    "pair": {
                                                                                                                                      "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                                                      "second": {
                                                                                                                                        "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}},
                                                                                                                                  "constraints": []}}],
                                                                                                                            "body": {
                                                                                                                              "let": {
                                                                                                                                "bindings": [
                                                                                                                                  {
                                                                                                                                    "name": "r",
                                                                                                                                    "term": {
                                                                                                                                      "application": {
                                                                                                                                        "function": {
                                                                                                                                          "typeApplication": {
                                                                                                                                            "body": {
                                                                                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"variable": "hydra.core.typing.TypeSubst"}}},
                                                                                                                                            "type": {
                                                                                                                                              "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}},
                                                                                                                                        "argument": {"variable": "restPair"}}},
                                                                                                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.TypeSubst"}, "constraints": []}}],
                                                                                                                                "body": {
                                                                                                                                  "let": {
                                                                                                                                    "bindings": [
                                                                                                                                      {
                                                                                                                                        "name": "c2",
                                                                                                                                        "term": {
                                                                                                                                          "application": {
                                                                                                                                            "function": {
                                                                                                                                              "typeApplication": {
                                                                                                                                                "body": {
                                                                                                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"variable": "hydra.core.typing.TypeSubst"}}},
                                                                                                                                                "type": {
                                                                                                                                                  "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}},
                                                                                                                                            "argument": {"variable": "restPair"}}},
                                                                                                                                        "typeScheme": {
                                                                                                                                          "variables": [],
                                                                                                                                          "body": {
                                                                                                                                            "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}},
                                                                                                                                          "constraints": []}}],
                                                                                                                                    "body": {
                                                                                                                                      "let": {
                                                                                                                                        "bindings": [
                                                                                                                                          {
                                                                                                                                            "name": "c1Subst",
                                                                                                                                            "term": {
                                                                                                                                              "application": {
                                                                                                                                                "function": {
                                                                                                                                                  "application": {"function": {"variable": "hydra.core.substitution.substInClassConstraints"}, "argument": {"variable": "r"}}},
                                                                                                                                                "argument": {"variable": "c1"}}},
                                                                                                                                            "typeScheme": {
                                                                                                                                              "variables": [],
                                                                                                                                              "body": {
                                                                                                                                                "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}},
                                                                                                                                              "constraints": []}}],
                                                                                                                                        "body": {
                                                                                                                                          "let": {
                                                                                                                                            "bindings": [
                                                                                                                                              {
                                                                                                                                                "name": "mergedConstraints",
                                                                                                                                                "term": {
                                                                                                                                                  "application": {
                                                                                                                                                    "function": {
                                                                                                                                                      "application": {
                                                                                                                                                        "function": {
                                                                                                                                                          "typeApplication": {"body": {"variable": "hydra.core.inference.mergeClassConstraints"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                                                                        "argument": {"variable": "c1Subst"}}},
                                                                                                                                                    "argument": {"variable": "c2"}}},
                                                                                                                                                "typeScheme": {
                                                                                                                                                  "variables": [],
                                                                                                                                                  "body": {
                                                                                                                                                    "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}},
                                                                                                                                                  "constraints": []}}],
                                                                                                                                            "body": {
                                                                                                                                              "typeApplication": {
                                                                                                                                                "body": {
                                                                                                                                                  "typeApplication": {
                                                                                                                                                    "body": {
                                                                                                                                                      "either": {
                                                                                                                                                        "right": {
                                                                                                                                                          "typeApplication": {
                                                                                                                                                            "body": {
                                                                                                                                                              "typeApplication": {
                                                                                                                                                                "body": {
                                                                                                                                                                  "pair": {
                                                                                                                                                                    "first": {
                                                                                                                                                                      "typeApplication": {
                                                                                                                                                                        "body": {
                                                                                                                                                                          "typeApplication": {
                                                                                                                                                                            "body": {
                                                                                                                                                                              "pair": {
                                                                                                                                                                                "first": {
                                                                                                                                                                                  "application": {
                                                                                                                                                                                    "function": {
                                                                                                                                                                                      "application": {
                                                                                                                                                                                        "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.cons"}, "type": {"variable": "hydra.core.model.Term"}}},
                                                                                                                                                                                        "argument": {
                                                                                                                                                                                          "application": {
                                                                                                                                                                                            "function": {"application": {"function": {"variable": "hydra.core.substitution.substTypesInTerm"}, "argument": {"variable": "r"}}},
                                                                                                                                                                                            "argument": {"variable": "j"}}}}},
                                                                                                                                                                                    "argument": {"variable": "h"}}},
                                                                                                                                                                                "second": {
                                                                                                                                                                                  "typeApplication": {
                                                                                                                                                                                    "body": {
                                                                                                                                                                                      "typeApplication": {
                                                                                                                                                                                        "body": {
                                                                                                                                                                                          "pair": {
                                                                                                                                                                                            "first": {
                                                                                                                                                                                              "application": {
                                                                                                                                                                                                "function": {
                                                                                                                                                                                                  "application": {
                                                                                                                                                                                                    "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.cons"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                                                                                                                                                    "argument": {
                                                                                                                                                                                                      "application": {
                                                                                                                                                                                                        "function": {"application": {"function": {"variable": "hydra.core.substitution.substInType"}, "argument": {"variable": "r"}}},
                                                                                                                                                                                                        "argument": {"variable": "u_prime"}}}}},
                                                                                                                                                                                                "argument": {"variable": "r_prime"}}},
                                                                                                                                                                                            "second": {
                                                                                                                                                                                              "typeApplication": {
                                                                                                                                                                                                "body": {
                                                                                                                                                                                                  "typeApplication": {
                                                                                                                                                                                                    "body": {
                                                                                                                                                                                                      "pair": {
                                                                                                                                                                                                        "first": {
                                                                                                                                                                                                          "application": {
                                                                                                                                                                                                            "function": {"application": {"function": {"variable": "hydra.core.substitution.composeTypeSubst"}, "argument": {"variable": "u"}}},
                                                                                                                                                                                                            "argument": {"variable": "r"}}},
                                                                                                                                                                                                        "second": {"variable": "mergedConstraints"}}},
                                                                                                                                                                                                    "type": {"variable": "hydra.core.typing.TypeSubst"}}},
                                                                                                                                                                                                "type": {
                                                                                                                                                                                                  "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}},
                                                                                                                                                                                        "type": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                                                                                                                                                    "type": {
                                                                                                                                                                                      "pair": {
                                                                                                                                                                                        "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                                                                                                        "second": {
                                                                                                                                                                                          "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}},
                                                                                                                                                                            "type": {"list": {"variable": "hydra.core.model.Term"}}}},
                                                                                                                                                                        "type": {
                                                                                                                                                                          "pair": {
                                                                                                                                                                            "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                                                                                                            "second": {
                                                                                                                                                                              "pair": {
                                                                                                                                                                                "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                                                                                                "second": {
                                                                                                                                                                                  "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}},
                                                                                                                                                                    "second": {"variable": "fcx3"}}},
                                                                                                                                                                "type": {
                                                                                                                                                                  "pair": {
                                                                                                                                                                    "first": {"list": {"variable": "hydra.core.model.Term"}},
                                                                                                                                                                    "second": {
                                                                                                                                                                      "pair": {
                                                                                                                                                                        "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                                                                                                        "second": {
                                                                                                                                                                          "pair": {
                                                                                                                                                                            "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                                                                                            "second": {
                                                                                                                                                                              "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}}}},
                                                                                                                                                            "type": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                                                                                    "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                                                                                "type": {
                                                                                                                                                  "pair": {
                                                                                                                                                    "first": {
                                                                                                                                                      "pair": {
                                                                                                                                                        "first": {"list": {"variable": "hydra.core.model.Term"}},
                                                                                                                                                        "second": {
                                                                                                                                                          "pair": {
                                                                                                                                                            "first": {"list": {"variable": "hydra.core.model.Type"}},
                                                                                                                                                            "second": {
                                                                                                                                                              "pair": {
                                                                                                                                                                "first": {"variable": "hydra.core.typing.TypeSubst"},
                                                                                                                                                                "second": {
                                                                                                                                                                  "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}}}}}},
                                                                                                                                                    "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {"literal": {"string": "Infer types for temporary let bindings (Either version)"}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.inference.isUnbound",
        "signature": {
          "typeParameters": [],
          "parameters": [
            {"name": "arg0", "type": {"variable": "hydra.core.graph.Graph"}, "isLazy": false},
            {"name": "arg1", "type": {"variable": "hydra.core.model.Name"}, "isLazy": false}],
          "result": {"type": {"literal": "boolean"}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "cx",
                "domain": {"variable": "hydra.core.graph.Graph"},
                "body": {
                  "lambda": {
                    "parameter": "v",
                    "domain": {"variable": "hydra.core.model.Name"},
                    "body": {
                      "application": {
                        "function": {
                          "application": {
                            "function": {"variable": "hydra.core.lib.logic.and"},
                            "argument": {
                              "application": {
                                "function": {"variable": "hydra.core.lib.logic.not"},
                                "argument": {
                                  "application": {
                                    "function": {
                                      "application": {
                                        "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.member"}, "type": {"variable": "hydra.core.model.Name"}}},
                                        "argument": {"variable": "v"}}},
                                    "argument": {
                                      "application": {"function": {"variable": "hydra.core.inference.freeVariablesInContext"}, "argument": {"variable": "cx"}}}}}}}}},
                        "argument": {
                          "application": {
                            "function": {"variable": "hydra.core.lib.logic.not"},
                            "argument": {
                              "application": {
                                "function": {
                                  "application": {
                                    "function": {
                                      "typeApplication": {
                                        "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.member"}, "type": {"variable": "hydra.core.model.Name"}}},
                                        "type": {"variable": "hydra.core.model.TypeScheme"}}},
                                    "argument": {"variable": "v"}}},
                                "argument": {
                                  "application": {
                                    "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "schemaTypes"}},
                                    "argument": {"variable": "cx"}}}}}}}}}}}}},
            "annotation": {
              "map": [{"key": {"variable": "description"}, "value": {"literal": {"string": "Check if a variable is unbound in context"}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.inference.mapConstraints",
        "signature": {
          "typeParameters": [{"name": "t0", "constraints": []}],
          "parameters": [
            {"name": "arg0", "type": {"variable": "hydra.core.typing.InferenceContext"}, "isLazy": false},
            {"name": "arg1", "type": {"variable": "hydra.core.graph.Graph"}, "isLazy": false},
            {
              "name": "arg2",
              "type": {"function": {"domain": {"variable": "hydra.core.typing.TypeSubst"}, "codomain": {"variable": "t0"}}},
              "isLazy": false},
            {"name": "arg3", "type": {"list": {"variable": "hydra.core.typing.TypeConstraint"}}, "isLazy": false}],
          "result": {"type": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "t0"}}}}},
        "body": {
          "typeLambda": {
            "parameter": "t0",
            "body": {
              "annotated": {
                "body": {
                  "lambda": {
                    "parameter": "flowCx",
                    "domain": {"variable": "hydra.core.typing.InferenceContext"},
                    "body": {
                      "lambda": {
                        "parameter": "cx",
                        "domain": {"variable": "hydra.core.graph.Graph"},
                        "body": {
                          "lambda": {
                            "parameter": "f",
                            "domain": {"function": {"domain": {"variable": "hydra.core.typing.TypeSubst"}, "codomain": {"variable": "t0"}}},
                            "body": {
                              "lambda": {
                                "parameter": "constraints",
                                "domain": {"list": {"variable": "hydra.core.typing.TypeConstraint"}},
                                "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.TypeSubst"}}},
                                            "type": {"variable": "t0"}}},
                                        "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.UnificationError"}}},
                                                                "type": {"variable": "hydra.core.typing.TypeSubst"}}},
                                                            "type": {"variable": "hydra.core.errors.Error"}}},
                                                        "type": {"variable": "hydra.core.typing.TypeSubst"}}},
                                                    "argument": {
                                                      "lambda": {
                                                        "parameter": "_e",
                                                        "domain": {"variable": "hydra.core.errors.UnificationError"},
                                                        "body": {
                                                          "inject": {
                                                            "typeName": "hydra.core.errors.Error",
                                                            "field": {
                                                              "name": "inference",
                                                              "term": {
                                                                "inject": {
                                                                  "typeName": "hydra.core.errors.InferenceError",
                                                                  "field": {
                                                                    "name": "unification",
                                                                    "term": {
                                                                      "record": {
                                                                        "typeName": "hydra.core.errors.UnificationInferenceError",
                                                                        "fields": [
                                                                          {
                                                                            "name": "path",
                                                                            "term": {
                                                                              "wrap": {
                                                                                "typeName": "hydra.core.paths.SubtermPath",
                                                                                "body": {
                                                                                  "application": {
                                                                                    "function": {
                                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.lists.reverse"}, "type": {"variable": "hydra.core.paths.SubtermStep"}}},
                                                                                    "argument": {
                                                                                      "application": {
                                                                                        "function": {"project": {"typeName": "hydra.core.typing.InferenceContext", "fieldName": "trace"}},
                                                                                        "argument": {"variable": "flowCx"}}}}}}}},
                                                                          {"name": "cause", "term": {"variable": "_e"}}]}}}}}}}}}}}},
                                                "argument": {"lambda": {"parameter": "_a", "domain": {"variable": "hydra.core.typing.TypeSubst"}, "body": {"variable": "_a"}}}}},
                                            "argument": {
                                              "application": {
                                                "function": {
                                                  "application": {
                                                    "function": {
                                                      "application": {
                                                        "function": {
                                                          "typeApplication": {
                                                            "body": {"variable": "hydra.core.unification.unifyTypeConstraints"},
                                                            "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                        "argument": {"variable": "flowCx"}}},
                                                    "argument": {
                                                      "application": {
                                                        "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "schemaTypes"}},
                                                        "argument": {"variable": "cx"}}}}},
                                                "argument": {"variable": "constraints"}}}}}}},
                                    "argument": {
                                      "lambda": {
                                        "parameter": "s",
                                        "domain": {"variable": "hydra.core.typing.TypeSubst"},
                                        "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.TypeSubst"}}},
                                                    "type": {"variable": "t0"}}},
                                                "argument": {
                                                  "application": {
                                                    "function": {
                                                      "application": {
                                                        "function": {
                                                          "application": {
                                                            "function": {
                                                              "typeApplication": {"body": {"variable": "hydra.core.checking.checkTypeSubst"}, "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                            "argument": {"variable": "flowCx"}}},
                                                        "argument": {"variable": "cx"}}},
                                                    "argument": {"variable": "s"}}}}},
                                            "argument": {
                                              "lambda": {
                                                "parameter": "_",
                                                "domain": {"variable": "hydra.core.typing.TypeSubst"},
                                                "body": {
                                                  "typeApplication": {
                                                    "body": {
                                                      "typeApplication": {
                                                        "body": {"either": {"right": {"application": {"function": {"variable": "f"}, "argument": {"variable": "s"}}}}},
                                                        "type": {"variable": "hydra.core.errors.Error"}}},
                                                    "type": {"variable": "t0"}}}}}}}}}}}}}}}}}}},
                "annotation": {
                  "map": [{"key": {"variable": "description"}, "value": {"literal": {"string": "Map over type constraints after unification"}}}]}}}}}}},
    {
      "term": {
        "name": "hydra.core.inference.mergeClassConstraints",
        "signature": {
          "typeParameters": [{"name": "t0", "constraints": [{"simple": "ordering"}]}],
          "parameters": [
            {
              "name": "arg0",
              "type": {"map": {"keys": {"variable": "t0"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}},
              "isLazy": false},
            {
              "name": "arg1",
              "type": {"map": {"keys": {"variable": "t0"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}},
              "isLazy": false}],
          "result": {"type": {"map": {"keys": {"variable": "t0"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}},
        "body": {
          "typeLambda": {
            "parameter": "t0",
            "body": {
              "annotated": {
                "body": {
                  "lambda": {
                    "parameter": "m1",
                    "domain": {"map": {"keys": {"variable": "t0"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}},
                    "body": {
                      "lambda": {
                        "parameter": "m2",
                        "domain": {"map": {"keys": {"variable": "t0"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}},
                        "body": {
                          "application": {
                            "function": {
                              "application": {
                                "function": {
                                  "application": {
                                    "function": {
                                      "typeApplication": {
                                        "body": {
                                          "typeApplication": {
                                            "body": {"variable": "hydra.core.lib.lists.foldl"},
                                            "type": {"map": {"keys": {"variable": "t0"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}},
                                        "type": {"pair": {"first": {"variable": "t0"}, "second": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}},
                                    "argument": {
                                      "lambda": {
                                        "parameter": "acc",
                                        "domain": {"map": {"keys": {"variable": "t0"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}},
                                        "body": {
                                          "lambda": {
                                            "parameter": "pair",
                                            "domain": {"pair": {"first": {"variable": "t0"}, "second": {"variable": "hydra.core.model.TypeVariableConstraints"}}},
                                            "body": {
                                              "let": {
                                                "bindings": [
                                                  {
                                                    "name": "k",
                                                    "term": {
                                                      "application": {
                                                        "function": {
                                                          "typeApplication": {
                                                            "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"variable": "t0"}}},
                                                            "type": {"variable": "hydra.core.model.TypeVariableConstraints"}}},
                                                        "argument": {"variable": "pair"}}},
                                                    "typeScheme": {"variables": [], "body": {"variable": "t0"}, "constraints": []}}],
                                                "body": {
                                                  "let": {
                                                    "bindings": [
                                                      {
                                                        "name": "v",
                                                        "term": {
                                                          "application": {
                                                            "function": {
                                                              "typeApplication": {
                                                                "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"variable": "t0"}}},
                                                                "type": {"variable": "hydra.core.model.TypeVariableConstraints"}}},
                                                            "argument": {"variable": "pair"}}},
                                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.TypeVariableConstraints"}, "constraints": []}}],
                                                    "body": {
                                                      "application": {
                                                        "function": {
                                                          "application": {
                                                            "function": {
                                                              "application": {
                                                                "function": {
                                                                  "typeApplication": {
                                                                    "body": {
                                                                      "typeApplication": {
                                                                        "body": {"variable": "hydra.core.lib.optionals.match"},
                                                                        "type": {"variable": "hydra.core.model.TypeVariableConstraints"}}},
                                                                    "type": {"map": {"keys": {"variable": "t0"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}},
                                                                "argument": {
                                                                  "application": {
                                                                    "function": {
                                                                      "application": {
                                                                        "function": {
                                                                          "typeApplication": {
                                                                            "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.lookup"}, "type": {"variable": "t0"}}},
                                                                            "type": {"variable": "hydra.core.model.TypeVariableConstraints"}}},
                                                                        "argument": {"variable": "k"}}},
                                                                    "argument": {"variable": "acc"}}}}},
                                                            "argument": {
                                                              "application": {
                                                                "function": {
                                                                  "application": {
                                                                    "function": {
                                                                      "application": {
                                                                        "function": {
                                                                          "typeApplication": {
                                                                            "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.insert"}, "type": {"variable": "t0"}}},
                                                                            "type": {"variable": "hydra.core.model.TypeVariableConstraints"}}},
                                                                        "argument": {"variable": "k"}}},
                                                                    "argument": {"variable": "v"}}},
                                                                "argument": {"variable": "acc"}}}}},
                                                        "argument": {
                                                          "lambda": {
                                                            "parameter": "existing",
                                                            "domain": {"variable": "hydra.core.model.TypeVariableConstraints"},
                                                            "body": {
                                                              "let": {
                                                                "bindings": [
                                                                  {
                                                                    "name": "merged",
                                                                    "term": {
                                                                      "record": {
                                                                        "typeName": "hydra.core.model.TypeVariableConstraints",
                                                                        "fields": [
                                                                          {
                                                                            "name": "classes",
                                                                            "term": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "application": {
                                                                                    "function": {
                                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.sets.union"}, "type": {"variable": "hydra.core.model.TypeClassConstraint"}}},
                                                                                    "argument": {
                                                                                      "application": {
                                                                                        "function": {"project": {"typeName": "hydra.core.model.TypeVariableConstraints", "fieldName": "classes"}},
                                                                                        "argument": {"variable": "existing"}}}}},
                                                                                "argument": {
                                                                                  "application": {
                                                                                    "function": {"project": {"typeName": "hydra.core.model.TypeVariableConstraints", "fieldName": "classes"}},
                                                                                    "argument": {"variable": "v"}}}}}}]}},
                                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.TypeVariableConstraints"}, "constraints": []}}],
                                                                "body": {
                                                                  "application": {
                                                                    "function": {
                                                                      "application": {
                                                                        "function": {
                                                                          "application": {
                                                                            "function": {
                                                                              "typeApplication": {
                                                                                "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.insert"}, "type": {"variable": "t0"}}},
                                                                                "type": {"variable": "hydra.core.model.TypeVariableConstraints"}}},
                                                                            "argument": {"variable": "k"}}},
                                                                        "argument": {"variable": "merged"}}},
                                                                    "argument": {"variable": "acc"}}}}}}}}}}}}}}}}}}},
                                "argument": {"variable": "m1"}}},
                            "argument": {
                              "application": {
                                "function": {
                                  "typeApplication": {
                                    "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.toList"}, "type": {"variable": "t0"}}},
                                    "type": {"variable": "hydra.core.model.TypeVariableConstraints"}}},
                                "argument": {"variable": "m2"}}}}}}}}},
                "annotation": {
                  "map": [
                    {
                      "key": {"variable": "description"},
                      "value": {
                        "literal": {
                          "string": "Merge two maps of class constraints. When both maps have constraints for the same variable, union the class sets."}}}]}}}}}}},
    {
      "term": {
        "name": "hydra.core.inference.showInferenceResult",
        "signature": {
          "typeParameters": [],
          "parameters": [{"name": "arg0", "type": {"variable": "hydra.core.typing.InferenceResult"}, "isLazy": false}],
          "result": {"type": {"literal": "string"}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "result",
                "domain": {"variable": "hydra.core.typing.InferenceResult"},
                "body": {
                  "let": {
                    "bindings": [
                      {
                        "name": "term",
                        "term": {
                          "application": {
                            "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "term"}},
                            "argument": {"variable": "result"}}},
                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                    "body": {
                      "let": {
                        "bindings": [
                          {
                            "name": "typ",
                            "term": {
                              "application": {
                                "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "type"}},
                                "argument": {"variable": "result"}}},
                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
                        "body": {
                          "let": {
                            "bindings": [
                              {
                                "name": "subst",
                                "term": {
                                  "application": {
                                    "function": {"project": {"typeName": "hydra.core.typing.InferenceResult", "fieldName": "subst"}},
                                    "argument": {"variable": "result"}}},
                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.TypeSubst"}, "constraints": []}}],
                            "body": {
                              "application": {
                                "function": {"variable": "hydra.core.lib.strings.concat"},
                                "argument": {
                                  "list": [
                                    {"literal": {"string": "{term="}},
                                    {"application": {"function": {"variable": "hydra.core.print.model.term"}, "argument": {"variable": "term"}}},
                                    {"literal": {"string": ", type="}},
                                    {"application": {"function": {"variable": "hydra.core.print.model.type"}, "argument": {"variable": "typ"}}},
                                    {"literal": {"string": ", subst="}},
                                    {"application": {"function": {"variable": "hydra.core.print.typing.typeSubst"}, "argument": {"variable": "subst"}}},
                                    {"literal": {"string": "}"}}]}}}}}}}}}}},
            "annotation": {
              "map": [{"key": {"variable": "description"}, "value": {"literal": {"string": "Show an inference result for debugging"}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.inference.yield",
        "signature": {
          "typeParameters": [],
          "parameters": [
            {"name": "arg0", "type": {"variable": "hydra.core.typing.InferenceContext"}, "isLazy": false},
            {"name": "arg1", "type": {"variable": "hydra.core.model.Term"}, "isLazy": false},
            {"name": "arg2", "type": {"variable": "hydra.core.model.Type"}, "isLazy": false},
            {"name": "arg3", "type": {"variable": "hydra.core.typing.TypeSubst"}, "isLazy": false}],
          "result": {"type": {"variable": "hydra.core.typing.InferenceResult"}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "fcx",
                "domain": {"variable": "hydra.core.typing.InferenceContext"},
                "body": {
                  "lambda": {
                    "parameter": "term",
                    "domain": {"variable": "hydra.core.model.Term"},
                    "body": {
                      "lambda": {
                        "parameter": "typ",
                        "domain": {"variable": "hydra.core.model.Type"},
                        "body": {
                          "lambda": {
                            "parameter": "subst",
                            "domain": {"variable": "hydra.core.typing.TypeSubst"},
                            "body": {
                              "record": {
                                "typeName": "hydra.core.typing.InferenceResult",
                                "fields": [
                                  {
                                    "name": "term",
                                    "term": {
                                      "application": {
                                        "function": {
                                          "application": {"function": {"variable": "hydra.core.substitution.substTypesInTerm"}, "argument": {"variable": "subst"}}},
                                        "argument": {"variable": "term"}}}},
                                  {
                                    "name": "type",
                                    "term": {
                                      "application": {
                                        "function": {"application": {"function": {"variable": "hydra.core.substitution.substInType"}, "argument": {"variable": "subst"}}},
                                        "argument": {"variable": "typ"}}}},
                                  {"name": "subst", "term": {"variable": "subst"}},
                                  {
                                    "name": "classConstraints",
                                    "term": {
                                      "typeApplication": {
                                        "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.empty"}, "type": {"variable": "hydra.core.model.Name"}}},
                                        "type": {"variable": "hydra.core.model.TypeVariableConstraints"}}}},
                                  {"name": "context", "term": {"variable": "fcx"}}]}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {"literal": {"string": "Create an inference result with no class constraints"}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.inference.yieldChecked",
        "signature": {
          "typeParameters": [],
          "parameters": [
            {"name": "arg0", "type": {"variable": "hydra.core.typing.InferenceContext"}, "isLazy": false},
            {"name": "arg1", "type": {"variable": "hydra.core.model.Term"}, "isLazy": false},
            {"name": "arg2", "type": {"variable": "hydra.core.model.Type"}, "isLazy": false},
            {"name": "arg3", "type": {"variable": "hydra.core.typing.TypeSubst"}, "isLazy": false}],
          "result": {"type": {"variable": "hydra.core.typing.InferenceResult"}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "fcx",
                "domain": {"variable": "hydra.core.typing.InferenceContext"},
                "body": {
                  "lambda": {
                    "parameter": "term",
                    "domain": {"variable": "hydra.core.model.Term"},
                    "body": {
                      "lambda": {
                        "parameter": "typ",
                        "domain": {"variable": "hydra.core.model.Type"},
                        "body": {
                          "lambda": {
                            "parameter": "subst",
                            "domain": {"variable": "hydra.core.typing.TypeSubst"},
                            "body": {
                              "let": {
                                "bindings": [
                                  {
                                    "name": "iterm",
                                    "term": {
                                      "application": {
                                        "function": {
                                          "application": {"function": {"variable": "hydra.core.substitution.substTypesInTerm"}, "argument": {"variable": "subst"}}},
                                        "argument": {"variable": "term"}}},
                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                "body": {
                                  "let": {
                                    "bindings": [
                                      {
                                        "name": "itype",
                                        "term": {
                                          "application": {
                                            "function": {"application": {"function": {"variable": "hydra.core.substitution.substInType"}, "argument": {"variable": "subst"}}},
                                            "argument": {"variable": "typ"}}},
                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
                                    "body": {
                                      "record": {
                                        "typeName": "hydra.core.typing.InferenceResult",
                                        "fields": [
                                          {"name": "term", "term": {"variable": "iterm"}},
                                          {"name": "type", "term": {"variable": "itype"}},
                                          {"name": "subst", "term": {"variable": "subst"}},
                                          {
                                            "name": "classConstraints",
                                            "term": {
                                              "typeApplication": {
                                                "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.empty"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                "type": {"variable": "hydra.core.model.TypeVariableConstraints"}}}},
                                          {"name": "context", "term": {"variable": "fcx"}}]}}}}}}}}}}}}}},
            "annotation": {"map": [{"key": {"variable": "description"}, "value": {"literal": {"string": "Create a checked inference result"}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.inference.yieldCheckedWithConstraints",
        "signature": {
          "typeParameters": [],
          "parameters": [
            {"name": "arg0", "type": {"variable": "hydra.core.typing.InferenceContext"}, "isLazy": false},
            {"name": "arg1", "type": {"variable": "hydra.core.model.Term"}, "isLazy": false},
            {"name": "arg2", "type": {"variable": "hydra.core.model.Type"}, "isLazy": false},
            {"name": "arg3", "type": {"variable": "hydra.core.typing.TypeSubst"}, "isLazy": false},
            {
              "name": "arg4",
              "type": {
                "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}},
              "isLazy": false}],
          "result": {"type": {"variable": "hydra.core.typing.InferenceResult"}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "fcx",
                "domain": {"variable": "hydra.core.typing.InferenceContext"},
                "body": {
                  "lambda": {
                    "parameter": "term",
                    "domain": {"variable": "hydra.core.model.Term"},
                    "body": {
                      "lambda": {
                        "parameter": "typ",
                        "domain": {"variable": "hydra.core.model.Type"},
                        "body": {
                          "lambda": {
                            "parameter": "subst",
                            "domain": {"variable": "hydra.core.typing.TypeSubst"},
                            "body": {
                              "lambda": {
                                "parameter": "constraints",
                                "domain": {
                                  "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}},
                                "body": {
                                  "let": {
                                    "bindings": [
                                      {
                                        "name": "iterm",
                                        "term": {
                                          "application": {
                                            "function": {
                                              "application": {"function": {"variable": "hydra.core.substitution.substTypesInTerm"}, "argument": {"variable": "subst"}}},
                                            "argument": {"variable": "term"}}},
                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                    "body": {
                                      "let": {
                                        "bindings": [
                                          {
                                            "name": "itype",
                                            "term": {
                                              "application": {
                                                "function": {"application": {"function": {"variable": "hydra.core.substitution.substInType"}, "argument": {"variable": "subst"}}},
                                                "argument": {"variable": "typ"}}},
                                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
                                        "body": {
                                          "let": {
                                            "bindings": [
                                              {
                                                "name": "iconstraints",
                                                "term": {
                                                  "application": {
                                                    "function": {
                                                      "application": {"function": {"variable": "hydra.core.substitution.substInClassConstraints"}, "argument": {"variable": "subst"}}},
                                                    "argument": {"variable": "constraints"}}},
                                                "typeScheme": {
                                                  "variables": [],
                                                  "body": {
                                                    "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}},
                                                  "constraints": []}}],
                                            "body": {
                                              "record": {
                                                "typeName": "hydra.core.typing.InferenceResult",
                                                "fields": [
                                                  {"name": "term", "term": {"variable": "iterm"}},
                                                  {"name": "type", "term": {"variable": "itype"}},
                                                  {"name": "subst", "term": {"variable": "subst"}},
                                                  {"name": "classConstraints", "term": {"variable": "iconstraints"}},
                                                  {"name": "context", "term": {"variable": "fcx"}}]}}}}}}}}}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {"literal": {"string": "Create a checked inference result with class constraints"}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.inference.yieldWithConstraints",
        "signature": {
          "typeParameters": [],
          "parameters": [
            {"name": "arg0", "type": {"variable": "hydra.core.typing.InferenceContext"}, "isLazy": false},
            {"name": "arg1", "type": {"variable": "hydra.core.model.Term"}, "isLazy": false},
            {"name": "arg2", "type": {"variable": "hydra.core.model.Type"}, "isLazy": false},
            {"name": "arg3", "type": {"variable": "hydra.core.typing.TypeSubst"}, "isLazy": false},
            {
              "name": "arg4",
              "type": {
                "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}},
              "isLazy": false}],
          "result": {"type": {"variable": "hydra.core.typing.InferenceResult"}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "fcx",
                "domain": {"variable": "hydra.core.typing.InferenceContext"},
                "body": {
                  "lambda": {
                    "parameter": "term",
                    "domain": {"variable": "hydra.core.model.Term"},
                    "body": {
                      "lambda": {
                        "parameter": "typ",
                        "domain": {"variable": "hydra.core.model.Type"},
                        "body": {
                          "lambda": {
                            "parameter": "subst",
                            "domain": {"variable": "hydra.core.typing.TypeSubst"},
                            "body": {
                              "lambda": {
                                "parameter": "constraints",
                                "domain": {
                                  "map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeVariableConstraints"}}},
                                "body": {
                                  "record": {
                                    "typeName": "hydra.core.typing.InferenceResult",
                                    "fields": [
                                      {
                                        "name": "term",
                                        "term": {
                                          "application": {
                                            "function": {
                                              "application": {"function": {"variable": "hydra.core.substitution.substTypesInTerm"}, "argument": {"variable": "subst"}}},
                                            "argument": {"variable": "term"}}}},
                                      {
                                        "name": "type",
                                        "term": {
                                          "application": {
                                            "function": {"application": {"function": {"variable": "hydra.core.substitution.substInType"}, "argument": {"variable": "subst"}}},
                                            "argument": {"variable": "typ"}}}},
                                      {"name": "subst", "term": {"variable": "subst"}},
                                      {"name": "classConstraints", "term": {"variable": "constraints"}},
                                      {"name": "context", "term": {"variable": "fcx"}}]}}}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {"literal": {"string": "Create an inference result with class constraints"}}}]}}}}}]}