packages feed

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

{
  "name": "hydra.core.checking",
  "metadata": {
    "description": "Type checking and type reconstruction (type-of) for the results of Hydra unification and inference",
    "comments": [],
    "seeAlso": [],
    "provisions": []},
  "dependencies": [
    {"module": "hydra.core.coders"},
    {"module": "hydra.core.dependencies"},
    {"module": "hydra.core.error.checking"},
    {"module": "hydra.core.error.model"},
    {"module": "hydra.core.errors"},
    {"module": "hydra.core.extract.model"},
    {"module": "hydra.core.formatting"},
    {"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.optionals"},
    {"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.reflect"},
    {"module": "hydra.core.resolution"},
    {"module": "hydra.core.rewriting"},
    {"module": "hydra.core.scoping"},
    {"module": "hydra.core.strip"},
    {"module": "hydra.core.substitution"},
    {"module": "hydra.core.typing"},
    {"module": "hydra.core.variables"}],
  "definitions": [
    {
      "term": {
        "name": "hydra.core.checking.allEqual",
        "signature": {
          "typeParameters": [{"name": "t0", "constraints": [{"simple": "equality"}]}],
          "parameters": [{"name": "arg0", "type": {"list": {"variable": "t0"}}, "isLazy": false}],
          "result": {"type": {"literal": "boolean"}}},
        "body": {
          "typeLambda": {
            "parameter": "t0",
            "body": {
              "annotated": {
                "body": {
                  "lambda": {
                    "parameter": "els",
                    "domain": {"list": {"variable": "t0"}},
                    "body": {
                      "application": {
                        "function": {
                          "application": {
                            "function": {
                              "application": {
                                "function": {
                                  "typeApplication": {
                                    "body": {
                                      "typeApplication": {
                                        "body": {"variable": "hydra.core.lib.optionals.match"},
                                        "type": {"pair": {"first": {"variable": "t0"}, "second": {"list": {"variable": "t0"}}}}}},
                                    "type": {"literal": "boolean"}}},
                                "argument": {
                                  "application": {
                                    "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.uncons"}, "type": {"variable": "t0"}}},
                                    "argument": {"variable": "els"}}}}},
                            "argument": {"literal": {"boolean": true}}}},
                        "argument": {
                          "lambda": {
                            "parameter": "uc",
                            "domain": {"pair": {"first": {"variable": "t0"}, "second": {"list": {"variable": "t0"}}}},
                            "body": {
                              "let": {
                                "bindings": [
                                  {
                                    "name": "h",
                                    "term": {
                                      "application": {
                                        "function": {
                                          "typeApplication": {
                                            "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"variable": "t0"}}},
                                            "type": {"list": {"variable": "t0"}}}},
                                        "argument": {"variable": "uc"}}},
                                    "typeScheme": {"variables": [], "body": {"variable": "t0"}, "constraints": []}}],
                                "body": {
                                  "let": {
                                    "bindings": [
                                      {
                                        "name": "t",
                                        "term": {
                                          "application": {
                                            "function": {
                                              "typeApplication": {
                                                "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"variable": "t0"}}},
                                                "type": {"list": {"variable": "t0"}}}},
                                            "argument": {"variable": "uc"}}},
                                        "typeScheme": {"variables": [], "body": {"list": {"variable": "t0"}}, "constraints": []}}],
                                    "body": {
                                      "application": {
                                        "function": {
                                          "application": {
                                            "function": {
                                              "application": {
                                                "function": {
                                                  "typeApplication": {
                                                    "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.foldl"}, "type": {"literal": "boolean"}}},
                                                    "type": {"variable": "t0"}}},
                                                "argument": {
                                                  "lambda": {
                                                    "parameter": "b",
                                                    "domain": {"literal": "boolean"},
                                                    "body": {
                                                      "lambda": {
                                                        "parameter": "x",
                                                        "domain": {"variable": "t0"},
                                                        "body": {
                                                          "application": {
                                                            "function": {"application": {"function": {"variable": "hydra.core.lib.logic.and"}, "argument": {"variable": "b"}}},
                                                            "argument": {
                                                              "application": {
                                                                "function": {
                                                                  "application": {
                                                                    "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.equality.equal"}, "type": {"variable": "t0"}}},
                                                                    "argument": {"variable": "x"}}},
                                                                "argument": {"variable": "h"}}}}}}}}}}},
                                            "argument": {"literal": {"boolean": true}}}},
                                        "argument": {"variable": "t"}}}}}}}}}}}}},
                "annotation": {
                  "map": [
                    {
                      "key": {"variable": "description"},
                      "value": {
                        "literal": {"string": "True if every element of the list is equal to every other element (vacuously true for the empty list)"}}}]}}}}}}},
    {
      "term": {
        "name": "hydra.core.checking.applyTypeArgumentsToType",
        "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.Type"}}, "isLazy": false},
            {"name": "arg3", "type": {"variable": "hydra.core.model.Type"}, "isLazy": false}],
          "result": {"type": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.model.Type"}}}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "cx",
                "domain": {"variable": "hydra.core.typing.InferenceContext"},
                "body": {
                  "lambda": {
                    "parameter": "tx",
                    "domain": {"variable": "hydra.core.graph.Graph"},
                    "body": {
                      "lambda": {
                        "parameter": "typeArgs",
                        "domain": {"list": {"variable": "hydra.core.model.Type"}},
                        "body": {
                          "lambda": {
                            "parameter": "t",
                            "domain": {"variable": "hydra.core.model.Type"},
                            "body": {
                              "application": {
                                "function": {
                                  "application": {
                                    "function": {
                                      "application": {
                                        "function": {
                                          "typeApplication": {
                                            "body": {
                                              "typeApplication": {
                                                "body": {"variable": "hydra.core.lib.optionals.match"},
                                                "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"list": {"variable": "hydra.core.model.Type"}}}}}},
                                            "type": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.model.Type"}}}}},
                                        "argument": {
                                          "application": {
                                            "function": {
                                              "typeApplication": {"body": {"variable": "hydra.core.lib.lists.uncons"}, "type": {"variable": "hydra.core.model.Type"}}},
                                            "argument": {"variable": "typeArgs"}}}}},
                                    "argument": {
                                      "typeApplication": {
                                        "body": {"typeApplication": {"body": {"either": {"right": {"variable": "t"}}}, "type": {"variable": "hydra.core.errors.Error"}}},
                                        "type": {"variable": "hydra.core.model.Type"}}}}},
                                "argument": {
                                  "lambda": {
                                    "parameter": "uc",
                                    "domain": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"list": {"variable": "hydra.core.model.Type"}}}},
                                    "body": {
                                      "let": {
                                        "bindings": [
                                          {
                                            "name": "ah",
                                            "term": {
                                              "application": {
                                                "function": {
                                                  "typeApplication": {
                                                    "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                    "type": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                "argument": {"variable": "uc"}}},
                                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
                                        "body": {
                                          "let": {
                                            "bindings": [
                                              {
                                                "name": "at",
                                                "term": {
                                                  "application": {
                                                    "function": {
                                                      "typeApplication": {
                                                        "body": {
                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                        "type": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                    "argument": {"variable": "uc"}}},
                                                "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Type"}}, "constraints": []}}],
                                            "body": {
                                              "application": {
                                                "function": {
                                                  "cases": {
                                                    "typeName": "hydra.core.model.Type",
                                                    "default": {
                                                      "typeApplication": {
                                                        "body": {
                                                          "typeApplication": {
                                                            "body": {
                                                              "either": {
                                                                "left": {
                                                                  "inject": {
                                                                    "typeName": "hydra.core.errors.Error",
                                                                    "field": {
                                                                      "name": "extraction",
                                                                      "term": {
                                                                        "inject": {
                                                                          "typeName": "hydra.core.errors.ExtractionError",
                                                                          "field": {
                                                                            "name": "unexpectedShape",
                                                                            "term": {
                                                                              "record": {
                                                                                "typeName": "hydra.core.errors.UnexpectedShapeError",
                                                                                "fields": [
                                                                                  {"name": "expected", "term": {"literal": {"string": "forall type"}}},
                                                                                  {
                                                                                    "name": "actual",
                                                                                    "term": {
                                                                                      "application": {
                                                                                        "function": {"variable": "hydra.core.lib.strings.concat"},
                                                                                        "argument": {
                                                                                          "list": [
                                                                                            {"application": {"function": {"variable": "hydra.core.print.model.type"}, "argument": {"variable": "t"}}},
                                                                                            {"literal": {"string": ". Trying to apply "}},
                                                                                            {
                                                                                              "application": {
                                                                                                "function": {"variable": "hydra.core.lib.literals.printInt32"},
                                                                                                "argument": {
                                                                                                  "application": {
                                                                                                    "function": {
                                                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.lists.length"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                                                    "argument": {"variable": "typeArgs"}}}}},
                                                                                            {"literal": {"string": " type args: "}},
                                                                                            {
                                                                                              "application": {
                                                                                                "function": {
                                                                                                  "application": {
                                                                                                    "function": {
                                                                                                      "typeApplication": {"body": {"variable": "hydra.core.formatting.showList"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                                                    "argument": {"variable": "hydra.core.print.model.type"}}},
                                                                                                "argument": {"variable": "typeArgs"}}},
                                                                                            {"literal": {"string": ". Context has vars: {"}},
                                                                                            {
                                                                                              "application": {
                                                                                                "function": {"application": {"function": {"variable": "hydra.core.lib.strings.join"}, "argument": {"literal": {"string": ", "}}}},
                                                                                                "argument": {
                                                                                                  "application": {
                                                                                                    "function": {
                                                                                                      "application": {
                                                                                                        "function": {
                                                                                                          "typeApplication": {
                                                                                                            "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                            "type": {"literal": "string"}}},
                                                                                                        "argument": {"unwrap": "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": "boundTypes"}},
                                                                                                            "argument": {"variable": "tx"}}}}}}}}},
                                                                                            {"literal": {"string": "}"}}]}}}}]}}}}}}}}}},
                                                            "type": {"variable": "hydra.core.errors.Error"}}},
                                                        "type": {"variable": "hydra.core.model.Type"}}},
                                                    "cases": [
                                                      {
                                                        "name": "forall",
                                                        "handler": {
                                                          "lambda": {
                                                            "parameter": "ft",
                                                            "domain": {"variable": "hydra.core.model.ForallType"},
                                                            "body": {
                                                              "let": {
                                                                "bindings": [
                                                                  {
                                                                    "name": "v",
                                                                    "term": {
                                                                      "application": {
                                                                        "function": {"project": {"typeName": "hydra.core.model.ForallType", "fieldName": "parameter"}},
                                                                        "argument": {"variable": "ft"}}},
                                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Name"}, "constraints": []}}],
                                                                "body": {
                                                                  "let": {
                                                                    "bindings": [
                                                                      {
                                                                        "name": "tbody",
                                                                        "term": {
                                                                          "application": {
                                                                            "function": {"project": {"typeName": "hydra.core.model.ForallType", "fieldName": "body"}},
                                                                            "argument": {"variable": "ft"}}},
                                                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
                                                                    "body": {
                                                                      "application": {
                                                                        "function": {
                                                                          "application": {
                                                                            "function": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "application": {"function": {"variable": "hydra.core.checking.applyTypeArgumentsToType"}, "argument": {"variable": "cx"}}},
                                                                                "argument": {"variable": "tx"}}},
                                                                            "argument": {"variable": "at"}}},
                                                                        "argument": {
                                                                          "application": {
                                                                            "function": {
                                                                              "application": {
                                                                                "function": {"variable": "hydra.core.substitution.substInType"},
                                                                                "argument": {
                                                                                  "wrap": {
                                                                                    "typeName": "hydra.core.typing.TypeSubst",
                                                                                    "body": {
                                                                                      "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.Type"}}},
                                                                                            "argument": {"variable": "v"}}},
                                                                                        "argument": {"variable": "ah"}}}}}}},
                                                                            "argument": {"variable": "tbody"}}}}}}}}}}}},
                                                      {
                                                        "name": "variable",
                                                        "handler": {
                                                          "lambda": {
                                                            "parameter": "tname",
                                                            "domain": {"variable": "hydra.core.model.Name"},
                                                            "body": {
                                                              "application": {
                                                                "function": {
                                                                  "application": {
                                                                    "function": {
                                                                      "application": {
                                                                        "function": {
                                                                          "typeApplication": {
                                                                            "body": {
                                                                              "typeApplication": {
                                                                                "body": {
                                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.eithers.either"}, "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                "type": {
                                                                                  "pair": {"first": {"variable": "hydra.core.model.TypeScheme"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                            "type": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.model.Type"}}}}},
                                                                        "argument": {
                                                                          "lambda": {
                                                                            "parameter": "_",
                                                                            "domain": {"variable": "hydra.core.errors.Error"},
                                                                            "body": {
                                                                              "typeApplication": {
                                                                                "body": {
                                                                                  "typeApplication": {
                                                                                    "body": {
                                                                                      "either": {
                                                                                        "left": {
                                                                                          "inject": {
                                                                                            "typeName": "hydra.core.errors.Error",
                                                                                            "field": {
                                                                                              "name": "extraction",
                                                                                              "term": {
                                                                                                "inject": {
                                                                                                  "typeName": "hydra.core.errors.ExtractionError",
                                                                                                  "field": {
                                                                                                    "name": "unexpectedShape",
                                                                                                    "term": {
                                                                                                      "record": {
                                                                                                        "typeName": "hydra.core.errors.UnexpectedShapeError",
                                                                                                        "fields": [
                                                                                                          {"name": "expected", "term": {"literal": {"string": "forall type"}}},
                                                                                                          {
                                                                                                            "name": "actual",
                                                                                                            "term": {
                                                                                                              "application": {
                                                                                                                "function": {"variable": "hydra.core.lib.strings.concat"},
                                                                                                                "argument": {
                                                                                                                  "list": [
                                                                                                                    {"application": {"function": {"variable": "hydra.core.print.model.type"}, "argument": {"variable": "t"}}},
                                                                                                                    {"literal": {"string": ". Trying to apply "}},
                                                                                                                    {
                                                                                                                      "application": {
                                                                                                                        "function": {"variable": "hydra.core.lib.literals.printInt32"},
                                                                                                                        "argument": {
                                                                                                                          "application": {
                                                                                                                            "function": {
                                                                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.lists.length"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                                                                            "argument": {"variable": "typeArgs"}}}}},
                                                                                                                    {"literal": {"string": " type args: "}},
                                                                                                                    {
                                                                                                                      "application": {
                                                                                                                        "function": {
                                                                                                                          "application": {
                                                                                                                            "function": {
                                                                                                                              "typeApplication": {"body": {"variable": "hydra.core.formatting.showList"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                                                                            "argument": {"variable": "hydra.core.print.model.type"}}},
                                                                                                                        "argument": {"variable": "typeArgs"}}}]}}}}]}}}}}}}}}},
                                                                                    "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                "type": {"variable": "hydra.core.model.Type"}}}}}}},
                                                                    "argument": {
                                                                      "lambda": {
                                                                        "parameter": "schemaRes",
                                                                        "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": "schemaRes"}}},
                                                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.TypeScheme"}, "constraints": []}}],
                                                                            "body": {
                                                                              "let": {
                                                                                "bindings": [
                                                                                  {
                                                                                    "name": "schemaBody",
                                                                                    "term": {
                                                                                      "application": {
                                                                                        "function": {"variable": "hydra.core.strip.deannotateType"},
                                                                                        "argument": {
                                                                                          "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": {
                                                                                      "cases": {
                                                                                        "typeName": "hydra.core.model.Type",
                                                                                        "default": {
                                                                                          "typeApplication": {
                                                                                            "body": {"typeApplication": {"body": {"either": {"right": {"variable": "t"}}}, "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                            "type": {"variable": "hydra.core.model.Type"}}},
                                                                                        "cases": [
                                                                                          {
                                                                                            "name": "forall",
                                                                                            "handler": {
                                                                                              "lambda": {
                                                                                                "parameter": "_",
                                                                                                "domain": {"variable": "hydra.core.model.ForallType"},
                                                                                                "body": {
                                                                                                  "application": {
                                                                                                    "function": {
                                                                                                      "application": {
                                                                                                        "function": {
                                                                                                          "application": {
                                                                                                            "function": {
                                                                                                              "application": {"function": {"variable": "hydra.core.checking.applyTypeArgumentsToType"}, "argument": {"variable": "cx"}}},
                                                                                                            "argument": {"variable": "tx"}}},
                                                                                                        "argument": {"variable": "typeArgs"}}},
                                                                                                    "argument": {"variable": "schemaBody"}}}}}}]}},
                                                                                    "argument": {"variable": "schemaBody"}}}}}}}}}}},
                                                                "argument": {
                                                                  "application": {
                                                                    "function": {
                                                                      "application": {
                                                                        "function": {"application": {"function": {"variable": "hydra.core.resolution.requireSchemaType"}, "argument": {"variable": "cx"}}},
                                                                        "argument": {
                                                                          "application": {
                                                                            "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "schemaTypes"}},
                                                                            "argument": {"variable": "tx"}}}}},
                                                                    "argument": {"variable": "tname"}}}}}}}}]}},
                                                "argument": {"variable": "t"}}}}}}}}}}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {
                    "literal": {
                      "string": "Apply type arguments to a type, substituting forall-bound variables. Paper: inference.tex, 'Checking the witness' (consuming the pending-type-argument stack)."}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.checking.checkForUnboundTypeVariables",
        "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": "unit"}}}},
        "body": {
          "typeLambda": {
            "parameter": "t0",
            "body": {
              "annotated": {
                "body": {
                  "lambda": {
                    "parameter": "cx",
                    "domain": {"variable": "t0"},
                    "body": {
                      "lambda": {
                        "parameter": "tx",
                        "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": "tx"}}}}}}},
                                    "typeScheme": {"variables": [], "body": {"set": {"variable": "hydra.core.model.Name"}}, "constraints": []}}],
                                "body": {
                                  "let": {
                                    "bindings": [
                                      {
                                        "name": "checkRecursive",
                                        "term": {
                                          "lambda": {
                                            "parameter": "vars",
                                            "domain": {"set": {"variable": "hydra.core.model.Name"}},
                                            "body": {
                                              "lambda": {
                                                "parameter": "trace",
                                                "domain": {"list": {"literal": "string"}},
                                                "body": {
                                                  "lambda": {
                                                    "parameter": "lbinding",
                                                    "domain": {"optional": {"variable": "hydra.core.model.Binding"}},
                                                    "body": {
                                                      "lambda": {
                                                        "parameter": "term",
                                                        "domain": {"variable": "hydra.core.model.Term"},
                                                        "body": {
                                                          "let": {
                                                            "bindings": [
                                                              {
                                                                "name": "recurse",
                                                                "term": {
                                                                  "application": {
                                                                    "function": {
                                                                      "application": {
                                                                        "function": {"application": {"function": {"variable": "checkRecursive"}, "argument": {"variable": "vars"}}},
                                                                        "argument": {"variable": "trace"}}},
                                                                    "argument": {"variable": "lbinding"}}},
                                                                "typeScheme": {
                                                                  "variables": [],
                                                                  "body": {
                                                                    "function": {
                                                                      "domain": {"variable": "hydra.core.model.Term"},
                                                                      "codomain": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": "unit"}}}},
                                                                  "constraints": []}}],
                                                            "body": {
                                                              "let": {
                                                                "bindings": [
                                                                  {
                                                                    "name": "dflt",
                                                                    "term": {
                                                                      "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": {"variable": "hydra.core.model.Term"}}},
                                                                                            "type": "unit"}},
                                                                                        "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                    "argument": {"variable": "recurse"}}},
                                                                                "argument": {"application": {"function": {"variable": "hydra.core.rewriting.subterms"}, "argument": {"variable": "term"}}}}}}},
                                                                        "argument": {
                                                                          "lambda": {
                                                                            "parameter": "_",
                                                                            "domain": {"list": "unit"},
                                                                            "body": {
                                                                              "typeApplication": {
                                                                                "body": {"typeApplication": {"body": {"either": {"right": "unit"}}, "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                "type": "unit"}}}}}},
                                                                    "typeScheme": {
                                                                      "variables": [],
                                                                      "body": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": "unit"}},
                                                                      "constraints": []}}],
                                                                "body": {
                                                                  "let": {
                                                                    "bindings": [
                                                                      {
                                                                        "name": "check",
                                                                        "term": {
                                                                          "lambda": {
                                                                            "parameter": "typ",
                                                                            "domain": {"variable": "hydra.core.model.Type"},
                                                                            "body": {
                                                                              "let": {
                                                                                "bindings": [
                                                                                  {
                                                                                    "name": "freevars",
                                                                                    "term": {"application": {"function": {"variable": "hydra.core.variables.freeVariablesInType"}, "argument": {"variable": "typ"}}},
                                                                                    "typeScheme": {"variables": [], "body": {"set": {"variable": "hydra.core.model.Name"}}, "constraints": []}}],
                                                                                "body": {
                                                                                  "let": {
                                                                                    "bindings": [
                                                                                      {
                                                                                        "name": "badvars",
                                                                                        "term": {
                                                                                          "application": {
                                                                                            "function": {
                                                                                              "application": {
                                                                                                "function": {
                                                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.sets.difference"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                "argument": {
                                                                                                  "application": {
                                                                                                    "function": {
                                                                                                      "application": {
                                                                                                        "function": {
                                                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.sets.difference"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                        "argument": {"variable": "freevars"}}},
                                                                                                    "argument": {"variable": "vars"}}}}},
                                                                                            "argument": {"variable": "svars"}}},
                                                                                        "typeScheme": {"variables": [], "body": {"set": {"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": {
                                                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.sets.isEmpty"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                    "argument": {"variable": "badvars"}}}}},
                                                                                            "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": "checking",
                                                                                                          "term": {
                                                                                                            "inject": {
                                                                                                              "typeName": "hydra.core.error.checking.CheckingError",
                                                                                                              "field": {
                                                                                                                "name": "unboundTypeVariables",
                                                                                                                "term": {
                                                                                                                  "record": {
                                                                                                                    "typeName": "hydra.core.error.checking.UnboundTypeVariablesError",
                                                                                                                    "fields": [{"name": "variables", "term": {"variable": "badvars"}}, {"name": "type", "term": {"variable": "typ"}}]}}}}}}}}}},
                                                                                                "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                            "type": "unit"}}}}}}}}}},
                                                                        "typeScheme": {
                                                                          "variables": [],
                                                                          "body": {
                                                                            "function": {
                                                                              "domain": {"variable": "hydra.core.model.Type"},
                                                                              "codomain": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": "unit"}}}},
                                                                          "constraints": []}}],
                                                                    "body": {
                                                                      "let": {
                                                                        "bindings": [
                                                                          {
                                                                            "name": "checkOptional",
                                                                            "term": {
                                                                              "lambda": {
                                                                                "parameter": "m",
                                                                                "domain": {"optional": {"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": {"optional": "unit"}}},
                                                                                            "type": "unit"}},
                                                                                        "argument": {
                                                                                          "application": {
                                                                                            "function": {
                                                                                              "application": {
                                                                                                "function": {
                                                                                                  "typeApplication": {
                                                                                                    "body": {
                                                                                                      "typeApplication": {
                                                                                                        "body": {
                                                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.eithers.mapOptional"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                                                        "type": "unit"}},
                                                                                                    "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                                "argument": {"variable": "check"}}},
                                                                                            "argument": {"variable": "m"}}}}},
                                                                                    "argument": {
                                                                                      "lambda": {
                                                                                        "parameter": "_",
                                                                                        "domain": {"optional": "unit"},
                                                                                        "body": {
                                                                                          "typeApplication": {
                                                                                            "body": {"typeApplication": {"body": {"either": {"right": "unit"}}, "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                            "type": "unit"}}}}}}}},
                                                                            "typeScheme": {
                                                                              "variables": [],
                                                                              "body": {
                                                                                "function": {
                                                                                  "domain": {"optional": {"variable": "hydra.core.model.Type"}},
                                                                                  "codomain": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": "unit"}}}},
                                                                              "constraints": []}}],
                                                                        "body": {
                                                                          "application": {
                                                                            "function": {
                                                                              "cases": {
                                                                                "typeName": "hydra.core.model.Term",
                                                                                "default": {"variable": "dflt"},
                                                                                "cases": [
                                                                                  {
                                                                                    "name": "lambda",
                                                                                    "handler": {
                                                                                      "lambda": {
                                                                                        "parameter": "l",
                                                                                        "domain": {"variable": "hydra.core.model.Lambda"},
                                                                                        "body": {
                                                                                          "application": {
                                                                                            "function": {
                                                                                              "application": {
                                                                                                "function": {
                                                                                                  "typeApplication": {
                                                                                                    "body": {
                                                                                                      "typeApplication": {
                                                                                                        "body": {
                                                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.eithers.bind"}, "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                                        "type": "unit"}},
                                                                                                    "type": "unit"}},
                                                                                                "argument": {
                                                                                                  "application": {
                                                                                                    "function": {"variable": "checkOptional"},
                                                                                                    "argument": {
                                                                                                      "application": {"function": {"project": {"typeName": "hydra.core.model.Lambda", "fieldName": "domain"}}, "argument": {"variable": "l"}}}}}}},
                                                                                            "argument": {
                                                                                              "lambda": {
                                                                                                "parameter": "_",
                                                                                                "domain": "unit",
                                                                                                "body": {
                                                                                                  "application": {
                                                                                                    "function": {"variable": "recurse"},
                                                                                                    "argument": {
                                                                                                      "application": {"function": {"project": {"typeName": "hydra.core.model.Lambda", "fieldName": "body"}}, "argument": {"variable": "l"}}}}}}}}}}}},
                                                                                  {
                                                                                    "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": "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": {
                                                                                                          "let": {
                                                                                                            "bindings": [
                                                                                                              {
                                                                                                                "name": "newVars",
                                                                                                                "term": {
                                                                                                                  "application": {
                                                                                                                    "function": {
                                                                                                                      "application": {
                                                                                                                        "function": {
                                                                                                                          "application": {
                                                                                                                            "function": {
                                                                                                                              "typeApplication": {
                                                                                                                                "body": {
                                                                                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.optionals.match"}, "type": {"variable": "hydra.core.model.TypeScheme"}}},
                                                                                                                                "type": {"set": {"variable": "hydra.core.model.Name"}}}},
                                                                                                                            "argument": {
                                                                                                                              "application": {
                                                                                                                                "function": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "typeScheme"}},
                                                                                                                                "argument": {"variable": "b"}}}}},
                                                                                                                        "argument": {"variable": "vars"}}},
                                                                                                                    "argument": {
                                                                                                                      "lambda": {
                                                                                                                        "parameter": "ts",
                                                                                                                        "domain": {"variable": "hydra.core.model.TypeScheme"},
                                                                                                                        "body": {
                                                                                                                          "application": {
                                                                                                                            "function": {
                                                                                                                              "application": {
                                                                                                                                "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.union"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                                                "argument": {"variable": "vars"}}},
                                                                                                                            "argument": {
                                                                                                                              "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": "newTrace",
                                                                                                                    "term": {
                                                                                                                      "application": {
                                                                                                                        "function": {
                                                                                                                          "application": {
                                                                                                                            "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.cons"}, "type": {"literal": "string"}}},
                                                                                                                            "argument": {
                                                                                                                              "application": {
                                                                                                                                "function": {"unwrap": "hydra.core.model.Name"},
                                                                                                                                "argument": {
                                                                                                                                  "application": {"function": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "name"}}, "argument": {"variable": "b"}}}}}}},
                                                                                                                        "argument": {"variable": "trace"}}},
                                                                                                                    "typeScheme": {"variables": [], "body": {"list": {"literal": "string"}}, "constraints": []}}],
                                                                                                                "body": {
                                                                                                                  "application": {
                                                                                                                    "function": {
                                                                                                                      "application": {
                                                                                                                        "function": {
                                                                                                                          "application": {
                                                                                                                            "function": {"application": {"function": {"variable": "checkRecursive"}, "argument": {"variable": "newVars"}}},
                                                                                                                            "argument": {"variable": "newTrace"}}},
                                                                                                                        "argument": {"optional": {"variable": "b"}}}},
                                                                                                                    "argument": {"variable": "bterm"}}}}}}}}}}},
                                                                                                "typeScheme": {
                                                                                                  "variables": [],
                                                                                                  "body": {
                                                                                                    "function": {
                                                                                                      "domain": {"variable": "hydra.core.model.Binding"},
                                                                                                      "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": {"variable": "hydra.core.model.Binding"}}},
                                                                                                                    "type": "unit"}},
                                                                                                                "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                                            "argument": {"variable": "forBinding"}}},
                                                                                                        "argument": {
                                                                                                          "application": {"function": {"project": {"typeName": "hydra.core.model.Let", "fieldName": "bindings"}}, "argument": {"variable": "l"}}}}}}},
                                                                                                "argument": {
                                                                                                  "lambda": {
                                                                                                    "parameter": "_",
                                                                                                    "domain": {"list": "unit"},
                                                                                                    "body": {
                                                                                                      "application": {
                                                                                                        "function": {"variable": "recurse"},
                                                                                                        "argument": {
                                                                                                          "application": {"function": {"project": {"typeName": "hydra.core.model.Let", "fieldName": "body"}}, "argument": {"variable": "l"}}}}}}}}}}}}}},
                                                                                  {
                                                                                    "name": "typeApplication",
                                                                                    "handler": {
                                                                                      "lambda": {
                                                                                        "parameter": "tt",
                                                                                        "domain": {"variable": "hydra.core.model.TypeApplicationTerm"},
                                                                                        "body": {
                                                                                          "application": {
                                                                                            "function": {
                                                                                              "application": {
                                                                                                "function": {
                                                                                                  "typeApplication": {
                                                                                                    "body": {
                                                                                                      "typeApplication": {
                                                                                                        "body": {
                                                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.eithers.bind"}, "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                                        "type": "unit"}},
                                                                                                    "type": "unit"}},
                                                                                                "argument": {
                                                                                                  "application": {
                                                                                                    "function": {"variable": "check"},
                                                                                                    "argument": {
                                                                                                      "application": {
                                                                                                        "function": {"project": {"typeName": "hydra.core.model.TypeApplicationTerm", "fieldName": "type"}},
                                                                                                        "argument": {"variable": "tt"}}}}}}},
                                                                                            "argument": {
                                                                                              "lambda": {
                                                                                                "parameter": "_",
                                                                                                "domain": "unit",
                                                                                                "body": {
                                                                                                  "application": {
                                                                                                    "function": {"variable": "recurse"},
                                                                                                    "argument": {
                                                                                                      "application": {
                                                                                                        "function": {"project": {"typeName": "hydra.core.model.TypeApplicationTerm", "fieldName": "body"}},
                                                                                                        "argument": {"variable": "tt"}}}}}}}}}}}},
                                                                                  {
                                                                                    "name": "typeLambda",
                                                                                    "handler": {
                                                                                      "lambda": {
                                                                                        "parameter": "tl",
                                                                                        "domain": {"variable": "hydra.core.model.TypeLambda"},
                                                                                        "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": "unit"}},
                                                                                                "argument": {
                                                                                                  "application": {
                                                                                                    "function": {"variable": "check"},
                                                                                                    "argument": {
                                                                                                      "inject": {
                                                                                                        "typeName": "hydra.core.model.Type",
                                                                                                        "field": {
                                                                                                          "name": "variable",
                                                                                                          "term": {
                                                                                                            "application": {
                                                                                                              "function": {"project": {"typeName": "hydra.core.model.TypeLambda", "fieldName": "parameter"}},
                                                                                                              "argument": {"variable": "tl"}}}}}}}}}},
                                                                                            "argument": {
                                                                                              "lambda": {
                                                                                                "parameter": "_",
                                                                                                "domain": "unit",
                                                                                                "body": {
                                                                                                  "application": {
                                                                                                    "function": {"variable": "recurse"},
                                                                                                    "argument": {
                                                                                                      "application": {
                                                                                                        "function": {"project": {"typeName": "hydra.core.model.TypeLambda", "fieldName": "body"}},
                                                                                                        "argument": {"variable": "tl"}}}}}}}}}}}}]}},
                                                                            "argument": {"variable": "term"}}}}}}}}}}}}}}}}}}},
                                        "typeScheme": {
                                          "variables": [],
                                          "body": {
                                            "function": {
                                              "domain": {"set": {"variable": "hydra.core.model.Name"}},
                                              "codomain": {
                                                "function": {
                                                  "domain": {"list": {"literal": "string"}},
                                                  "codomain": {
                                                    "function": {
                                                      "domain": {"optional": {"variable": "hydra.core.model.Binding"}},
                                                      "codomain": {
                                                        "function": {
                                                          "domain": {"variable": "hydra.core.model.Term"},
                                                          "codomain": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": "unit"}}}}}}}}}},
                                          "constraints": []}}],
                                    "body": {
                                      "application": {
                                        "function": {
                                          "application": {
                                            "function": {
                                              "application": {
                                                "function": {
                                                  "application": {
                                                    "function": {"variable": "checkRecursive"},
                                                    "argument": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.empty"}, "type": {"variable": "hydra.core.model.Name"}}}}},
                                                "argument": {"list": [{"literal": {"string": "top level"}}]}}},
                                            "argument": {"typeApplication": {"body": {"optional": null}, "type": {"variable": "hydra.core.model.Binding"}}}}},
                                        "argument": {"variable": "term0"}}}}}}}}}}}}},
                "annotation": {
                  "map": [
                    {
                      "key": {"variable": "description"},
                      "value": {
                        "literal": {
                          "string": "Check that a term has no unbound type variables (Either version). Paper: inference.tex, 'Checking the witness' (always-on finalization invariant)."}}}]}}}}}}},
    {
      "term": {
        "name": "hydra.core.checking.checkSameType",
        "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": {"literal": "string"}, "isLazy": false},
            {"name": "arg3", "type": {"list": {"variable": "hydra.core.model.Type"}}, "isLazy": false}],
          "result": {"type": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.model.Type"}}}}},
        "body": {
          "typeLambda": {
            "parameter": "t0",
            "body": {
              "annotated": {
                "body": {
                  "lambda": {
                    "parameter": "cx",
                    "domain": {"variable": "t0"},
                    "body": {
                      "lambda": {
                        "parameter": "tx",
                        "domain": {"variable": "hydra.core.graph.Graph"},
                        "body": {
                          "lambda": {
                            "parameter": "desc",
                            "domain": {"literal": "string"},
                            "body": {
                              "lambda": {
                                "parameter": "types",
                                "domain": {"list": {"variable": "hydra.core.model.Type"}},
                                "body": {
                                  "let": {
                                    "bindings": [
                                      {
                                        "name": "unequalErr",
                                        "term": {
                                          "typeLambda": {
                                            "parameter": "t1",
                                            "body": {
                                              "typeApplication": {
                                                "body": {
                                                  "typeApplication": {
                                                    "body": {
                                                      "either": {
                                                        "left": {
                                                          "inject": {
                                                            "typeName": "hydra.core.errors.Error",
                                                            "field": {
                                                              "name": "checking",
                                                              "term": {
                                                                "inject": {
                                                                  "typeName": "hydra.core.error.checking.CheckingError",
                                                                  "field": {
                                                                    "name": "unequalTypes",
                                                                    "term": {
                                                                      "record": {
                                                                        "typeName": "hydra.core.error.checking.UnequalTypesError",
                                                                        "fields": [{"name": "types", "term": {"variable": "types"}}, {"name": "description", "term": {"variable": "desc"}}]}}}}}}}}}},
                                                    "type": {"variable": "hydra.core.errors.Error"}}},
                                                "type": {"variable": "t1"}}}}},
                                        "typeScheme": {
                                          "variables": ["t1"],
                                          "body": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "t1"}}},
                                          "constraints": []}}],
                                    "body": {
                                      "application": {
                                        "function": {
                                          "application": {
                                            "function": {
                                              "application": {
                                                "function": {
                                                  "typeApplication": {
                                                    "body": {"variable": "hydra.core.lib.logic.ifElse"},
                                                    "type": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.model.Type"}}}}},
                                                "argument": {
                                                  "application": {
                                                    "function": {
                                                      "application": {"function": {"variable": "hydra.core.checking.typesAllEffectivelyEqual"}, "argument": {"variable": "tx"}}},
                                                    "argument": {"variable": "types"}}}}},
                                            "argument": {
                                              "application": {
                                                "function": {
                                                  "application": {
                                                    "function": {
                                                      "application": {
                                                        "function": {
                                                          "typeApplication": {
                                                            "body": {
                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.optionals.match"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                            "type": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.model.Type"}}}}},
                                                        "argument": {
                                                          "application": {
                                                            "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.head"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                            "argument": {"variable": "types"}}}}},
                                                    "argument": {"typeApplication": {"body": {"variable": "unequalErr"}, "type": {"variable": "hydra.core.model.Type"}}}}},
                                                "argument": {
                                                  "lambda": {
                                                    "parameter": "t",
                                                    "domain": {"variable": "hydra.core.model.Type"},
                                                    "body": {
                                                      "typeApplication": {
                                                        "body": {"typeApplication": {"body": {"either": {"right": {"variable": "t"}}}, "type": {"variable": "hydra.core.errors.Error"}}},
                                                        "type": {"variable": "hydra.core.model.Type"}}}}}}}}},
                                        "argument": {"typeApplication": {"body": {"variable": "unequalErr"}, "type": {"variable": "hydra.core.model.Type"}}}}}}}}}}}}}}},
                "annotation": {
                  "map": [
                    {
                      "key": {"variable": "description"},
                      "value": {"literal": {"string": "Ensure all types in a list are equal and return the common type"}}}]}}}}}}},
    {
      "term": {
        "name": "hydra.core.checking.checkTypeSubst",
        "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.typing.TypeSubst"}, "isLazy": false}],
          "result": {
            "type": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.typing.TypeSubst"}}}}},
        "body": {
          "typeLambda": {
            "parameter": "t0",
            "body": {
              "annotated": {
                "body": {
                  "lambda": {
                    "parameter": "cx",
                    "domain": {"variable": "t0"},
                    "body": {
                      "lambda": {
                        "parameter": "tx",
                        "domain": {"variable": "hydra.core.graph.Graph"},
                        "body": {
                          "lambda": {
                            "parameter": "subst",
                            "domain": {"variable": "hydra.core.typing.TypeSubst"},
                            "body": {
                              "let": {
                                "bindings": [
                                  {
                                    "name": "s",
                                    "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": "vars",
                                        "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.Type"}}},
                                                "argument": {"variable": "s"}}}}},
                                        "typeScheme": {"variables": [], "body": {"set": {"variable": "hydra.core.model.Name"}}, "constraints": []}}],
                                    "body": {
                                      "let": {
                                        "bindings": [
                                          {
                                            "name": "suspectVars",
                                            "term": {
                                              "application": {
                                                "function": {
                                                  "application": {
                                                    "function": {
                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.sets.intersection"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                    "argument": {"variable": "vars"}}},
                                                "argument": {
                                                  "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": "tx"}}}}}}}}},
                                            "typeScheme": {"variables": [], "body": {"set": {"variable": "hydra.core.model.Name"}}, "constraints": []}}],
                                        "body": {
                                          "let": {
                                            "bindings": [
                                              {
                                                "name": "isNominal",
                                                "term": {
                                                  "lambda": {
                                                    "parameter": "ts",
                                                    "domain": {"variable": "hydra.core.model.TypeScheme"},
                                                    "body": {
                                                      "application": {
                                                        "function": {
                                                          "cases": {
                                                            "typeName": "hydra.core.model.Type",
                                                            "default": {"literal": {"boolean": false}},
                                                            "cases": [
                                                              {
                                                                "name": "record",
                                                                "handler": {
                                                                  "lambda": {
                                                                    "parameter": "_",
                                                                    "domain": {"list": {"variable": "hydra.core.model.FieldType"}},
                                                                    "body": {"literal": {"boolean": true}}}}},
                                                              {
                                                                "name": "union",
                                                                "handler": {
                                                                  "lambda": {
                                                                    "parameter": "_",
                                                                    "domain": {"list": {"variable": "hydra.core.model.FieldType"}},
                                                                    "body": {"literal": {"boolean": true}}}}},
                                                              {
                                                                "name": "wrap",
                                                                "handler": {"lambda": {"parameter": "_", "domain": {"variable": "hydra.core.model.Type"}, "body": {"literal": {"boolean": true}}}}}]}},
                                                        "argument": {
                                                          "application": {
                                                            "function": {"variable": "hydra.core.strip.deannotateType"},
                                                            "argument": {
                                                              "application": {
                                                                "function": {"project": {"typeName": "hydra.core.model.TypeScheme", "fieldName": "body"}},
                                                                "argument": {"variable": "ts"}}}}}}}}},
                                                "typeScheme": {
                                                  "variables": [],
                                                  "body": {"function": {"domain": {"variable": "hydra.core.model.TypeScheme"}, "codomain": {"literal": "boolean"}}},
                                                  "constraints": []}}],
                                            "body": {
                                              "let": {
                                                "bindings": [
                                                  {
                                                    "name": "badVars",
                                                    "term": {
                                                      "application": {
                                                        "function": {
                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.sets.fromList"}, "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": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "typeApplication": {
                                                                                    "body": {
                                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.optionals.match"}, "type": {"variable": "hydra.core.model.TypeScheme"}}},
                                                                                    "type": {"literal": "boolean"}}},
                                                                                "argument": {
                                                                                  "application": {
                                                                                    "function": {"application": {"function": {"variable": "hydra.core.lexical.dereferenceSchemaType"}, "argument": {"variable": "v"}}},
                                                                                    "argument": {
                                                                                      "application": {
                                                                                        "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "schemaTypes"}},
                                                                                        "argument": {"variable": "tx"}}}}}}},
                                                                            "argument": {"literal": {"boolean": false}}}},
                                                                        "argument": {"variable": "isNominal"}}}}}}},
                                                            "argument": {
                                                              "application": {
                                                                "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.toList"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                "argument": {"variable": "suspectVars"}}}}}}},
                                                    "typeScheme": {"variables": [], "body": {"set": {"variable": "hydra.core.model.Name"}}, "constraints": []}}],
                                                "body": {
                                                  "let": {
                                                    "bindings": [
                                                      {
                                                        "name": "badPairs",
                                                        "term": {
                                                          "application": {
                                                            "function": {
                                                              "application": {
                                                                "function": {
                                                                  "typeApplication": {
                                                                    "body": {"variable": "hydra.core.lib.lists.filter"},
                                                                    "type": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.model.Type"}}}}},
                                                                "argument": {
                                                                  "lambda": {
                                                                    "parameter": "p",
                                                                    "domain": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.model.Type"}}},
                                                                    "body": {
                                                                      "application": {
                                                                        "function": {
                                                                          "application": {
                                                                            "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.member"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                            "argument": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "typeApplication": {
                                                                                    "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                    "type": {"variable": "hydra.core.model.Type"}}},
                                                                                "argument": {"variable": "p"}}}}},
                                                                        "argument": {"variable": "badVars"}}}}}}},
                                                            "argument": {
                                                              "application": {
                                                                "function": {
                                                                  "typeApplication": {
                                                                    "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.toList"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                    "type": {"variable": "hydra.core.model.Type"}}},
                                                                "argument": {"variable": "s"}}}}},
                                                        "typeScheme": {
                                                          "variables": [],
                                                          "body": {"list": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.model.Type"}}}},
                                                          "constraints": []}}],
                                                    "body": {
                                                      "let": {
                                                        "bindings": [
                                                          {
                                                            "name": "printPair",
                                                            "term": {
                                                              "lambda": {
                                                                "parameter": "p",
                                                                "domain": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.model.Type"}}},
                                                                "body": {
                                                                  "application": {
                                                                    "function": {
                                                                      "application": {
                                                                        "function": {"variable": "hydra.core.lib.strings.concat2"},
                                                                        "argument": {
                                                                          "application": {
                                                                            "function": {
                                                                              "application": {
                                                                                "function": {"variable": "hydra.core.lib.strings.concat2"},
                                                                                "argument": {
                                                                                  "application": {
                                                                                    "function": {"unwrap": "hydra.core.model.Name"},
                                                                                    "argument": {
                                                                                      "application": {
                                                                                        "function": {
                                                                                          "typeApplication": {
                                                                                            "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                            "type": {"variable": "hydra.core.model.Type"}}},
                                                                                        "argument": {"variable": "p"}}}}}}},
                                                                            "argument": {"literal": {"string": " --> "}}}}}},
                                                                    "argument": {
                                                                      "application": {
                                                                        "function": {"variable": "hydra.core.print.model.type"},
                                                                        "argument": {
                                                                          "application": {
                                                                            "function": {
                                                                              "typeApplication": {
                                                                                "body": {
                                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                "type": {"variable": "hydra.core.model.Type"}}},
                                                                            "argument": {"variable": "p"}}}}}}}}},
                                                            "typeScheme": {
                                                              "variables": [],
                                                              "body": {
                                                                "function": {
                                                                  "domain": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.model.Type"}}},
                                                                  "codomain": {"literal": "string"}}},
                                                              "constraints": []}}],
                                                        "body": {
                                                          "application": {
                                                            "function": {
                                                              "application": {
                                                                "function": {
                                                                  "application": {
                                                                    "function": {
                                                                      "typeApplication": {
                                                                        "body": {"variable": "hydra.core.lib.logic.ifElse"},
                                                                        "type": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.typing.TypeSubst"}}}}},
                                                                    "argument": {
                                                                      "application": {
                                                                        "function": {
                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.sets.isEmpty"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                        "argument": {"variable": "badVars"}}}}},
                                                                "argument": {
                                                                  "typeApplication": {
                                                                    "body": {
                                                                      "typeApplication": {"body": {"either": {"right": {"variable": "subst"}}}, "type": {"variable": "hydra.core.errors.Error"}}},
                                                                    "type": {"variable": "hydra.core.typing.TypeSubst"}}}}},
                                                            "argument": {
                                                              "typeApplication": {
                                                                "body": {
                                                                  "typeApplication": {
                                                                    "body": {
                                                                      "either": {
                                                                        "left": {
                                                                          "inject": {
                                                                            "typeName": "hydra.core.errors.Error",
                                                                            "field": {
                                                                              "name": "checking",
                                                                              "term": {
                                                                                "inject": {
                                                                                  "typeName": "hydra.core.error.checking.CheckingError",
                                                                                  "field": {
                                                                                    "name": "incorrectUnification",
                                                                                    "term": {
                                                                                      "record": {
                                                                                        "typeName": "hydra.core.error.checking.IncorrectUnificationError",
                                                                                        "fields": [{"name": "substitution", "term": {"variable": "subst"}}]}}}}}}}}}},
                                                                    "type": {"variable": "hydra.core.errors.Error"}}},
                                                                "type": {"variable": "hydra.core.typing.TypeSubst"}}}}}}}}}}}}}}}}}}}}}}}}},
                "annotation": {
                  "map": [
                    {
                      "key": {"variable": "description"},
                      "value": {
                        "literal": {
                          "string": "Sanity-check a type substitution arising from unification. Specifically, check that schema types have not been inappropriately unified with type variables inferred from terms. Paper: inference.tex, 'Checking the witness' (always-on invariant: a substitution may not bind a type name as if it were an inference variable)."}}}]}}}}}}},
    {
      "term": {
        "name": "hydra.core.checking.containsInScopeTypeVars",
        "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": {"literal": "boolean"}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "tx",
                "domain": {"variable": "hydra.core.graph.Graph"},
                "body": {
                  "lambda": {
                    "parameter": "t",
                    "domain": {"variable": "hydra.core.model.Type"},
                    "body": {
                      "let": {
                        "bindings": [
                          {
                            "name": "vars",
                            "term": {
                              "application": {
                                "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "typeVariables"}},
                                "argument": {"variable": "tx"}}},
                            "typeScheme": {"variables": [], "body": {"set": {"variable": "hydra.core.model.Name"}}, "constraints": []}}],
                        "body": {
                          "let": {
                            "bindings": [
                              {
                                "name": "freeVars",
                                "term": {
                                  "application": {"function": {"variable": "hydra.core.variables.freeVariablesInTypeSimple"}, "argument": {"variable": "t"}}},
                                "typeScheme": {"variables": [], "body": {"set": {"variable": "hydra.core.model.Name"}}, "constraints": []}}],
                            "body": {
                              "application": {
                                "function": {"variable": "hydra.core.lib.logic.not"},
                                "argument": {
                                  "application": {
                                    "function": {
                                      "typeApplication": {"body": {"variable": "hydra.core.lib.sets.isEmpty"}, "type": {"variable": "hydra.core.model.Name"}}},
                                    "argument": {
                                      "application": {
                                        "function": {
                                          "application": {
                                            "function": {
                                              "typeApplication": {"body": {"variable": "hydra.core.lib.sets.intersection"}, "type": {"variable": "hydra.core.model.Name"}}},
                                            "argument": {"variable": "vars"}}},
                                        "argument": {"variable": "freeVars"}}}}}}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {"literal": {"string": "Check if a type contains any type variable from the current scope"}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.checking.normalizeTypeFreeVars",
        "signature": {
          "typeParameters": [],
          "parameters": [{"name": "arg0", "type": {"variable": "hydra.core.model.Type"}, "isLazy": false}],
          "result": {"type": {"variable": "hydra.core.model.Type"}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "typ",
                "domain": {"variable": "hydra.core.model.Type"},
                "body": {
                  "let": {
                    "bindings": [
                      {
                        "name": "collectVars",
                        "term": {
                          "lambda": {
                            "parameter": "acc",
                            "domain": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.Name"}}},
                            "body": {
                              "lambda": {
                                "parameter": "t",
                                "domain": {"variable": "hydra.core.model.Type"},
                                "body": {
                                  "application": {
                                    "function": {
                                      "cases": {
                                        "typeName": "hydra.core.model.Type",
                                        "default": {"variable": "acc"},
                                        "cases": [
                                          {
                                            "name": "variable",
                                            "handler": {
                                              "lambda": {
                                                "parameter": "v",
                                                "domain": {"variable": "hydra.core.model.Name"},
                                                "body": {
                                                  "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.Name"}}}}},
                                                            "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.Name"}}},
                                                                    "argument": {"variable": "v"}}},
                                                                "argument": {"variable": "acc"}}}}},
                                                        "argument": {"variable": "acc"}}},
                                                    "argument": {
                                                      "application": {
                                                        "function": {
                                                          "application": {
                                                            "function": {
                                                              "application": {
                                                                "function": {
                                                                  "typeApplication": {
                                                                    "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.insert"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                    "type": {"variable": "hydra.core.model.Name"}}},
                                                                "argument": {"variable": "v"}}},
                                                            "argument": {
                                                              "wrap": {
                                                                "typeName": "hydra.core.model.Name",
                                                                "body": {
                                                                  "application": {
                                                                    "function": {
                                                                      "application": {"function": {"variable": "hydra.core.lib.strings.concat2"}, "argument": {"literal": {"string": "_tv"}}}},
                                                                    "argument": {
                                                                      "application": {
                                                                        "function": {"variable": "hydra.core.lib.literals.printInt32"},
                                                                        "argument": {
                                                                          "application": {
                                                                            "function": {
                                                                              "typeApplication": {
                                                                                "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.size"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                "type": {"variable": "hydra.core.model.Name"}}},
                                                                            "argument": {"variable": "acc"}}}}}}}}}}},
                                                        "argument": {"variable": "acc"}}}}}}}}]}},
                                    "argument": {"variable": "t"}}}}}}},
                        "typeScheme": {
                          "variables": [],
                          "body": {
                            "function": {
                              "domain": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.Name"}}},
                              "codomain": {
                                "function": {
                                  "domain": {"variable": "hydra.core.model.Type"},
                                  "codomain": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.Name"}}}}}}},
                          "constraints": []}}],
                    "body": {
                      "let": {
                        "bindings": [
                          {
                            "name": "subst",
                            "term": {
                              "application": {
                                "function": {
                                  "application": {
                                    "function": {
                                      "application": {
                                        "function": {
                                          "application": {
                                            "function": {
                                              "typeApplication": {
                                                "body": {"variable": "hydra.core.rewriting.foldOverType"},
                                                "type": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.Name"}}}}},
                                            "argument": {"inject": {"typeName": "hydra.core.coders.TraversalOrder", "field": {"name": "pre", "term": "unit"}}}}},
                                        "argument": {"variable": "collectVars"}}},
                                    "argument": {
                                      "typeApplication": {
                                        "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.empty"}, "type": {"variable": "hydra.core.model.Name"}}},
                                        "type": {"variable": "hydra.core.model.Name"}}}}},
                                "argument": {"variable": "typ"}}},
                            "typeScheme": {
                              "variables": [],
                              "body": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.Name"}}},
                              "constraints": []}}],
                        "body": {
                          "application": {
                            "function": {
                              "application": {"function": {"variable": "hydra.core.variables.substituteTypeVariables"}, "argument": {"variable": "subst"}}},
                            "argument": {"variable": "typ"}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {
                    "literal": {
                      "string": "Normalize free type variables in a type to canonical names based on order of first occurrence. This allows comparing types that differ only in the naming of free type variables. Paper: inference.tex, 'Checking the witness' (effective equality)."}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.checking.toFContext",
        "signature": {
          "typeParameters": [],
          "parameters": [{"name": "arg0", "type": {"variable": "hydra.core.graph.Graph"}, "isLazy": false}],
          "result": {"type": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.Type"}}}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "cx",
                "domain": {"variable": "hydra.core.graph.Graph"},
                "body": {
                  "application": {
                    "function": {
                      "application": {
                        "function": {
                          "typeApplication": {
                            "body": {
                              "typeApplication": {
                                "body": {
                                  "typeApplication": {"body": {"variable": "hydra.core.lib.maps.map"}, "type": {"variable": "hydra.core.model.TypeScheme"}}},
                                "type": {"variable": "hydra.core.model.Type"}}},
                            "type": {"variable": "hydra.core.model.Name"}}},
                        "argument": {"variable": "hydra.core.scoping.typeSchemeToFType"}}},
                    "argument": {
                      "application": {
                        "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "boundTypes"}},
                        "argument": {"variable": "cx"}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {"literal": {"string": "Get the bound types from a graph as a type environment"}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.checking.typeListsEffectivelyEqual",
        "signature": {
          "typeParameters": [],
          "parameters": [
            {"name": "arg0", "type": {"variable": "hydra.core.graph.Graph"}, "isLazy": false},
            {"name": "arg1", "type": {"list": {"variable": "hydra.core.model.Type"}}, "isLazy": false},
            {"name": "arg2", "type": {"list": {"variable": "hydra.core.model.Type"}}, "isLazy": false}],
          "result": {"type": {"literal": "boolean"}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "tx",
                "domain": {"variable": "hydra.core.graph.Graph"},
                "body": {
                  "lambda": {
                    "parameter": "tlist1",
                    "domain": {"list": {"variable": "hydra.core.model.Type"}},
                    "body": {
                      "lambda": {
                        "parameter": "tlist2",
                        "domain": {"list": {"variable": "hydra.core.model.Type"}},
                        "body": {
                          "application": {
                            "function": {
                              "application": {
                                "function": {
                                  "application": {
                                    "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.logic.ifElse"}, "type": {"literal": "boolean"}}},
                                    "argument": {
                                      "application": {
                                        "function": {
                                          "application": {
                                            "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.equality.equal"}, "type": {"literal": {"integer": "int32"}}}},
                                            "argument": {
                                              "application": {
                                                "function": {
                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.lists.length"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                "argument": {"variable": "tlist1"}}}}},
                                        "argument": {
                                          "application": {
                                            "function": {
                                              "typeApplication": {"body": {"variable": "hydra.core.lib.lists.length"}, "type": {"variable": "hydra.core.model.Type"}}},
                                            "argument": {"variable": "tlist2"}}}}}}},
                                "argument": {
                                  "application": {
                                    "function": {
                                      "application": {
                                        "function": {
                                          "application": {
                                            "function": {
                                              "typeApplication": {
                                                "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.foldl"}, "type": {"literal": "boolean"}}},
                                                "type": {"literal": "boolean"}}},
                                            "argument": {"variable": "hydra.core.lib.logic.and"}}},
                                        "argument": {"literal": {"boolean": true}}}},
                                    "argument": {
                                      "application": {
                                        "function": {
                                          "application": {
                                            "function": {
                                              "application": {
                                                "function": {
                                                  "typeApplication": {
                                                    "body": {
                                                      "typeApplication": {
                                                        "body": {
                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.lists.zipWith"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                        "type": {"variable": "hydra.core.model.Type"}}},
                                                    "type": {"literal": "boolean"}}},
                                                "argument": {"application": {"function": {"variable": "hydra.core.checking.typesEffectivelyEqual"}, "argument": {"variable": "tx"}}}}},
                                            "argument": {"variable": "tlist1"}}},
                                        "argument": {"variable": "tlist2"}}}}}}},
                            "argument": {"literal": {"boolean": false}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {"literal": {"string": "Check whether two lists of types are effectively equal, disregarding type aliases"}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.checking.typeOf",
        "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.Type"}}, "isLazy": false},
            {"name": "arg3", "type": {"variable": "hydra.core.model.Term"}, "isLazy": false}],
          "result": {
            "type": {
              "either": {
                "left": {"variable": "hydra.core.errors.Error"},
                "right": {"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": {
                  "lambda": {
                    "parameter": "tx",
                    "domain": {"variable": "hydra.core.graph.Graph"},
                    "body": {
                      "lambda": {
                        "parameter": "typeArgs",
                        "domain": {"list": {"variable": "hydra.core.model.Type"}},
                        "body": {
                          "lambda": {
                            "parameter": "term",
                            "domain": {"variable": "hydra.core.model.Term"},
                            "body": {
                              "let": {
                                "bindings": [
                                  {
                                    "name": "cx1",
                                    "term": {"variable": "cx"},
                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "constraints": []}}],
                                "body": {
                                  "application": {
                                    "function": {
                                      "cases": {
                                        "typeName": "hydra.core.model.Term",
                                        "default": {
                                          "typeApplication": {
                                            "body": {
                                              "typeApplication": {
                                                "body": {
                                                  "either": {
                                                    "left": {
                                                      "inject": {
                                                        "typeName": "hydra.core.errors.Error",
                                                        "field": {
                                                          "name": "checking",
                                                          "term": {
                                                            "inject": {
                                                              "typeName": "hydra.core.error.checking.CheckingError",
                                                              "field": {
                                                                "name": "unsupportedTermVariant",
                                                                "term": {
                                                                  "record": {
                                                                    "typeName": "hydra.core.error.checking.UnsupportedTermVariantError",
                                                                    "fields": [
                                                                      {
                                                                        "name": "termVariant",
                                                                        "term": {"application": {"function": {"variable": "hydra.core.reflect.termVariant"}, "argument": {"variable": "term"}}}}]}}}}}}}}}},
                                                "type": {"variable": "hydra.core.errors.Error"}}},
                                            "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                        "cases": [
                                          {
                                            "name": "annotated",
                                            "handler": {
                                              "application": {
                                                "function": {
                                                  "application": {
                                                    "function": {"application": {"function": {"variable": "hydra.core.checking.typeOfAnnotatedTerm"}, "argument": {"variable": "cx1"}}},
                                                    "argument": {"variable": "tx"}}},
                                                "argument": {"variable": "typeArgs"}}}},
                                          {
                                            "name": "application",
                                            "handler": {
                                              "application": {
                                                "function": {
                                                  "application": {
                                                    "function": {"application": {"function": {"variable": "hydra.core.checking.typeOfApplication"}, "argument": {"variable": "cx1"}}},
                                                    "argument": {"variable": "tx"}}},
                                                "argument": {"variable": "typeArgs"}}}},
                                          {
                                            "name": "cases",
                                            "handler": {
                                              "application": {
                                                "function": {
                                                  "application": {
                                                    "function": {"application": {"function": {"variable": "hydra.core.checking.typeOfCaseStatement"}, "argument": {"variable": "cx1"}}},
                                                    "argument": {"variable": "tx"}}},
                                                "argument": {"variable": "typeArgs"}}}},
                                          {
                                            "name": "either",
                                            "handler": {
                                              "application": {
                                                "function": {
                                                  "application": {
                                                    "function": {"application": {"function": {"variable": "hydra.core.checking.typeOfEither"}, "argument": {"variable": "cx1"}}},
                                                    "argument": {"variable": "tx"}}},
                                                "argument": {"variable": "typeArgs"}}}},
                                          {
                                            "name": "lambda",
                                            "handler": {
                                              "application": {
                                                "function": {
                                                  "application": {
                                                    "function": {"application": {"function": {"variable": "hydra.core.checking.typeOfLambda"}, "argument": {"variable": "cx1"}}},
                                                    "argument": {"variable": "tx"}}},
                                                "argument": {"variable": "typeArgs"}}}},
                                          {
                                            "name": "let",
                                            "handler": {
                                              "application": {
                                                "function": {
                                                  "application": {
                                                    "function": {"application": {"function": {"variable": "hydra.core.checking.typeOfLet"}, "argument": {"variable": "cx1"}}},
                                                    "argument": {"variable": "tx"}}},
                                                "argument": {"variable": "typeArgs"}}}},
                                          {
                                            "name": "list",
                                            "handler": {
                                              "application": {
                                                "function": {
                                                  "application": {
                                                    "function": {"application": {"function": {"variable": "hydra.core.checking.typeOfList"}, "argument": {"variable": "cx1"}}},
                                                    "argument": {"variable": "tx"}}},
                                                "argument": {"variable": "typeArgs"}}}},
                                          {
                                            "name": "literal",
                                            "handler": {
                                              "application": {
                                                "function": {
                                                  "application": {
                                                    "function": {"application": {"function": {"variable": "hydra.core.checking.typeOfLiteral"}, "argument": {"variable": "cx1"}}},
                                                    "argument": {"variable": "tx"}}},
                                                "argument": {"variable": "typeArgs"}}}},
                                          {
                                            "name": "map",
                                            "handler": {
                                              "application": {
                                                "function": {
                                                  "application": {
                                                    "function": {"application": {"function": {"variable": "hydra.core.checking.typeOfMap"}, "argument": {"variable": "cx1"}}},
                                                    "argument": {"variable": "tx"}}},
                                                "argument": {"variable": "typeArgs"}}}},
                                          {
                                            "name": "optional",
                                            "handler": {
                                              "application": {
                                                "function": {
                                                  "application": {
                                                    "function": {"application": {"function": {"variable": "hydra.core.checking.typeOfMaybe"}, "argument": {"variable": "cx1"}}},
                                                    "argument": {"variable": "tx"}}},
                                                "argument": {"variable": "typeArgs"}}}},
                                          {
                                            "name": "pair",
                                            "handler": {
                                              "application": {
                                                "function": {
                                                  "application": {
                                                    "function": {"application": {"function": {"variable": "hydra.core.checking.typeOfPair"}, "argument": {"variable": "cx1"}}},
                                                    "argument": {"variable": "tx"}}},
                                                "argument": {"variable": "typeArgs"}}}},
                                          {
                                            "name": "project",
                                            "handler": {
                                              "application": {
                                                "function": {
                                                  "application": {
                                                    "function": {"application": {"function": {"variable": "hydra.core.checking.typeOfProjection"}, "argument": {"variable": "cx1"}}},
                                                    "argument": {"variable": "tx"}}},
                                                "argument": {"variable": "typeArgs"}}}},
                                          {
                                            "name": "record",
                                            "handler": {
                                              "application": {
                                                "function": {
                                                  "application": {
                                                    "function": {"application": {"function": {"variable": "hydra.core.checking.typeOfRecord"}, "argument": {"variable": "cx1"}}},
                                                    "argument": {"variable": "tx"}}},
                                                "argument": {"variable": "typeArgs"}}}},
                                          {
                                            "name": "set",
                                            "handler": {
                                              "application": {
                                                "function": {
                                                  "application": {
                                                    "function": {"application": {"function": {"variable": "hydra.core.checking.typeOfSet"}, "argument": {"variable": "cx1"}}},
                                                    "argument": {"variable": "tx"}}},
                                                "argument": {"variable": "typeArgs"}}}},
                                          {
                                            "name": "typeApplication",
                                            "handler": {
                                              "application": {
                                                "function": {
                                                  "application": {
                                                    "function": {
                                                      "application": {"function": {"variable": "hydra.core.checking.typeOfTypeApplication"}, "argument": {"variable": "cx1"}}},
                                                    "argument": {"variable": "tx"}}},
                                                "argument": {"variable": "typeArgs"}}}},
                                          {
                                            "name": "typeLambda",
                                            "handler": {
                                              "application": {
                                                "function": {
                                                  "application": {
                                                    "function": {"application": {"function": {"variable": "hydra.core.checking.typeOfTypeLambda"}, "argument": {"variable": "cx1"}}},
                                                    "argument": {"variable": "tx"}}},
                                                "argument": {"variable": "typeArgs"}}}},
                                          {
                                            "name": "inject",
                                            "handler": {
                                              "application": {
                                                "function": {
                                                  "application": {
                                                    "function": {"application": {"function": {"variable": "hydra.core.checking.typeOfInjection"}, "argument": {"variable": "cx1"}}},
                                                    "argument": {"variable": "tx"}}},
                                                "argument": {"variable": "typeArgs"}}}},
                                          {
                                            "name": "unit",
                                            "handler": {
                                              "lambda": {
                                                "parameter": "_",
                                                "domain": "unit",
                                                "body": {
                                                  "application": {
                                                    "function": {
                                                      "application": {
                                                        "function": {"application": {"function": {"variable": "hydra.core.checking.typeOfUnit"}, "argument": {"variable": "cx1"}}},
                                                        "argument": {"variable": "tx"}}},
                                                    "argument": {"variable": "typeArgs"}}}}}},
                                          {
                                            "name": "unwrap",
                                            "handler": {
                                              "application": {
                                                "function": {
                                                  "application": {
                                                    "function": {"application": {"function": {"variable": "hydra.core.checking.typeOfUnwrap"}, "argument": {"variable": "cx1"}}},
                                                    "argument": {"variable": "tx"}}},
                                                "argument": {"variable": "typeArgs"}}}},
                                          {
                                            "name": "variable",
                                            "handler": {
                                              "application": {
                                                "function": {
                                                  "application": {
                                                    "function": {"application": {"function": {"variable": "hydra.core.checking.typeOfVariable"}, "argument": {"variable": "cx1"}}},
                                                    "argument": {"variable": "tx"}}},
                                                "argument": {"variable": "typeArgs"}}}},
                                          {
                                            "name": "wrap",
                                            "handler": {
                                              "application": {
                                                "function": {
                                                  "application": {
                                                    "function": {"application": {"function": {"variable": "hydra.core.checking.typeOfWrappedTerm"}, "argument": {"variable": "cx1"}}},
                                                    "argument": {"variable": "tx"}}},
                                                "argument": {"variable": "typeArgs"}}}}]}},
                                    "argument": {"variable": "term"}}}}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {
                    "literal": {
                      "string": "Given a type context, reconstruct the type of a System F term. Paper: inference.tex, 'Checking the witness' -- the executable form of the System F typing judgment in the soundness theorem."}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.checking.typeOfAnnotatedTerm",
        "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.Type"}}, "isLazy": false},
            {"name": "arg3", "type": {"variable": "hydra.core.model.AnnotatedTerm"}, "isLazy": false}],
          "result": {
            "type": {
              "either": {
                "left": {"variable": "hydra.core.errors.Error"},
                "right": {"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": {
                  "lambda": {
                    "parameter": "tx",
                    "domain": {"variable": "hydra.core.graph.Graph"},
                    "body": {
                      "lambda": {
                        "parameter": "typeArgs",
                        "domain": {"list": {"variable": "hydra.core.model.Type"}},
                        "body": {
                          "lambda": {
                            "parameter": "at",
                            "domain": {"variable": "hydra.core.model.AnnotatedTerm"},
                            "body": {
                              "application": {
                                "function": {
                                  "application": {
                                    "function": {
                                      "application": {
                                        "function": {"application": {"function": {"variable": "hydra.core.checking.typeOf"}, "argument": {"variable": "cx"}}},
                                        "argument": {"variable": "tx"}}},
                                    "argument": {"variable": "typeArgs"}}},
                                "argument": {
                                  "application": {
                                    "function": {"project": {"typeName": "hydra.core.model.AnnotatedTerm", "fieldName": "body"}},
                                    "argument": {"variable": "at"}}}}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {
                    "literal": {
                      "string": "Reconstruct the type of an annotated term (Either/InferenceContext version). Paper: inference.tex, rule Ann (checking side)."}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.checking.typeOfApplication",
        "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.Type"}}, "isLazy": false},
            {"name": "arg3", "type": {"variable": "hydra.core.model.Application"}, "isLazy": false}],
          "result": {
            "type": {
              "either": {
                "left": {"variable": "hydra.core.errors.Error"},
                "right": {"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": {
                  "lambda": {
                    "parameter": "tx",
                    "domain": {"variable": "hydra.core.graph.Graph"},
                    "body": {
                      "lambda": {
                        "parameter": "typeArgs",
                        "domain": {"list": {"variable": "hydra.core.model.Type"}},
                        "body": {
                          "lambda": {
                            "parameter": "app",
                            "domain": {"variable": "hydra.core.model.Application"},
                            "body": {
                              "let": {
                                "bindings": [
                                  {
                                    "name": "fun",
                                    "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": "arg",
                                        "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": "tryType",
                                            "term": {
                                              "lambda": {
                                                "parameter": "cx0",
                                                "domain": {"variable": "hydra.core.typing.InferenceContext"},
                                                "body": {
                                                  "lambda": {
                                                    "parameter": "tfun",
                                                    "domain": {"variable": "hydra.core.model.Type"},
                                                    "body": {
                                                      "lambda": {
                                                        "parameter": "targ",
                                                        "domain": {"variable": "hydra.core.model.Type"},
                                                        "body": {
                                                          "application": {
                                                            "function": {
                                                              "cases": {
                                                                "typeName": "hydra.core.model.Type",
                                                                "default": {
                                                                  "typeApplication": {
                                                                    "body": {
                                                                      "typeApplication": {
                                                                        "body": {
                                                                          "either": {
                                                                            "left": {
                                                                              "inject": {
                                                                                "typeName": "hydra.core.errors.Error",
                                                                                "field": {
                                                                                  "name": "checking",
                                                                                  "term": {
                                                                                    "inject": {
                                                                                      "typeName": "hydra.core.error.checking.CheckingError",
                                                                                      "field": {
                                                                                        "name": "notAFunctionType",
                                                                                        "term": {
                                                                                          "record": {
                                                                                            "typeName": "hydra.core.error.checking.NotAFunctionTypeError",
                                                                                            "fields": [{"name": "type", "term": {"variable": "tfun"}}]}}}}}}}}}},
                                                                        "type": {"variable": "hydra.core.errors.Error"}}},
                                                                    "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                "cases": [
                                                                  {
                                                                    "name": "forall",
                                                                    "handler": {
                                                                      "lambda": {
                                                                        "parameter": "ft",
                                                                        "domain": {"variable": "hydra.core.model.ForallType"},
                                                                        "body": {
                                                                          "application": {
                                                                            "function": {
                                                                              "application": {
                                                                                "function": {"application": {"function": {"variable": "tryType"}, "argument": {"variable": "cx0"}}},
                                                                                "argument": {
                                                                                  "application": {
                                                                                    "function": {"project": {"typeName": "hydra.core.model.ForallType", "fieldName": "body"}},
                                                                                    "argument": {"variable": "ft"}}}}},
                                                                            "argument": {"variable": "targ"}}}}}},
                                                                  {
                                                                    "name": "function",
                                                                    "handler": {
                                                                      "lambda": {
                                                                        "parameter": "ft",
                                                                        "domain": {"variable": "hydra.core.model.FunctionType"},
                                                                        "body": {
                                                                          "let": {
                                                                            "bindings": [
                                                                              {
                                                                                "name": "dom",
                                                                                "term": {
                                                                                  "application": {
                                                                                    "function": {"project": {"typeName": "hydra.core.model.FunctionType", "fieldName": "domain"}},
                                                                                    "argument": {"variable": "ft"}}},
                                                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
                                                                            "body": {
                                                                              "let": {
                                                                                "bindings": [
                                                                                  {
                                                                                    "name": "cod",
                                                                                    "term": {
                                                                                      "application": {
                                                                                        "function": {"project": {"typeName": "hydra.core.model.FunctionType", "fieldName": "codomain"}},
                                                                                        "argument": {"variable": "ft"}}},
                                                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
                                                                                "body": {
                                                                                  "application": {
                                                                                    "function": {
                                                                                      "application": {
                                                                                        "function": {
                                                                                          "application": {
                                                                                            "function": {
                                                                                              "typeApplication": {
                                                                                                "body": {"variable": "hydra.core.lib.logic.ifElse"},
                                                                                                "type": {
                                                                                                  "either": {
                                                                                                    "left": {"variable": "hydra.core.errors.Error"},
                                                                                                    "right": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}},
                                                                                            "argument": {
                                                                                              "application": {
                                                                                                "function": {
                                                                                                  "application": {
                                                                                                    "function": {"application": {"function": {"variable": "hydra.core.checking.typesEffectivelyEqual"}, "argument": {"variable": "tx"}}},
                                                                                                    "argument": {"variable": "dom"}}},
                                                                                                "argument": {"variable": "targ"}}}}},
                                                                                        "argument": {
                                                                                          "typeApplication": {
                                                                                            "body": {
                                                                                              "typeApplication": {
                                                                                                "body": {
                                                                                                  "either": {
                                                                                                    "right": {
                                                                                                      "typeApplication": {
                                                                                                        "body": {
                                                                                                          "typeApplication": {
                                                                                                            "body": {"pair": {"first": {"variable": "cod"}, "second": {"variable": "cx0"}}},
                                                                                                            "type": {"variable": "hydra.core.model.Type"}}},
                                                                                                        "type": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                                "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                            "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}},
                                                                                    "argument": {
                                                                                      "typeApplication": {
                                                                                        "body": {
                                                                                          "typeApplication": {
                                                                                            "body": {
                                                                                              "either": {
                                                                                                "left": {
                                                                                                  "inject": {
                                                                                                    "typeName": "hydra.core.errors.Error",
                                                                                                    "field": {
                                                                                                      "name": "checking",
                                                                                                      "term": {
                                                                                                        "inject": {
                                                                                                          "typeName": "hydra.core.error.checking.CheckingError",
                                                                                                          "field": {
                                                                                                            "name": "typeMismatch",
                                                                                                            "term": {
                                                                                                              "record": {
                                                                                                                "typeName": "hydra.core.error.checking.TypeMismatchError",
                                                                                                                "fields": [{"name": "expectedType", "term": {"variable": "dom"}}, {"name": "actualType", "term": {"variable": "targ"}}]}}}}}}}}}},
                                                                                            "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                        "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}}}}}}}}},
                                                                  {
                                                                    "name": "variable",
                                                                    "handler": {
                                                                      "lambda": {
                                                                        "parameter": "v",
                                                                        "domain": {"variable": "hydra.core.model.Name"},
                                                                        "body": {
                                                                          "let": {
                                                                            "bindings": [
                                                                              {
                                                                                "name": "nameResult",
                                                                                "term": {"application": {"function": {"variable": "hydra.core.names.freshName"}, "argument": {"variable": "cx0"}}},
                                                                                "typeScheme": {
                                                                                  "variables": [],
                                                                                  "body": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                  "constraints": []}}],
                                                                            "body": {
                                                                              "let": {
                                                                                "bindings": [
                                                                                  {
                                                                                    "name": "freshN",
                                                                                    "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": "nameResult"}}},
                                                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Name"}, "constraints": []}}],
                                                                                "body": {
                                                                                  "let": {
                                                                                    "bindings": [
                                                                                      {
                                                                                        "name": "cx1",
                                                                                        "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": "nameResult"}}},
                                                                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "constraints": []}}],
                                                                                    "body": {
                                                                                      "typeApplication": {
                                                                                        "body": {
                                                                                          "typeApplication": {
                                                                                            "body": {
                                                                                              "either": {
                                                                                                "right": {
                                                                                                  "typeApplication": {
                                                                                                    "body": {
                                                                                                      "typeApplication": {
                                                                                                        "body": {
                                                                                                          "pair": {
                                                                                                            "first": {"inject": {"typeName": "hydra.core.model.Type", "field": {"name": "variable", "term": {"variable": "freshN"}}}},
                                                                                                            "second": {"variable": "cx1"}}},
                                                                                                        "type": {"variable": "hydra.core.model.Type"}}},
                                                                                                    "type": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                            "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                        "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}}}}}}}}}]}},
                                                            "argument": {"variable": "tfun"}}}}}}}}},
                                            "typeScheme": {
                                              "variables": [],
                                              "body": {
                                                "function": {
                                                  "domain": {"variable": "hydra.core.typing.InferenceContext"},
                                                  "codomain": {
                                                    "function": {
                                                      "domain": {"variable": "hydra.core.model.Type"},
                                                      "codomain": {
                                                        "function": {
                                                          "domain": {"variable": "hydra.core.model.Type"},
                                                          "codomain": {
                                                            "either": {
                                                              "left": {"variable": "hydra.core.errors.Error"},
                                                              "right": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"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.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                    "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                "argument": {
                                                  "application": {
                                                    "function": {
                                                      "application": {
                                                        "function": {
                                                          "application": {
                                                            "function": {"application": {"function": {"variable": "hydra.core.checking.typeOf"}, "argument": {"variable": "cx"}}},
                                                            "argument": {"variable": "tx"}}},
                                                        "argument": {"typeApplication": {"body": {"list": []}, "type": {"variable": "hydra.core.model.Type"}}}}},
                                                    "argument": {"variable": "fun"}}}}},
                                            "argument": {
                                              "lambda": {
                                                "parameter": "result1",
                                                "domain": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                "body": {
                                                  "let": {
                                                    "bindings": [
                                                      {
                                                        "name": "tfun",
                                                        "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": "result1"}}},
                                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
                                                    "body": {
                                                      "let": {
                                                        "bindings": [
                                                          {
                                                            "name": "cx2",
                                                            "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": "result1"}}},
                                                            "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.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                    "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                "argument": {
                                                                  "application": {
                                                                    "function": {
                                                                      "application": {
                                                                        "function": {
                                                                          "application": {
                                                                            "function": {"application": {"function": {"variable": "hydra.core.checking.typeOf"}, "argument": {"variable": "cx2"}}},
                                                                            "argument": {"variable": "tx"}}},
                                                                        "argument": {"typeApplication": {"body": {"list": []}, "type": {"variable": "hydra.core.model.Type"}}}}},
                                                                    "argument": {"variable": "arg"}}}}},
                                                            "argument": {
                                                              "lambda": {
                                                                "parameter": "result2",
                                                                "domain": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                "body": {
                                                                  "let": {
                                                                    "bindings": [
                                                                      {
                                                                        "name": "targ",
                                                                        "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": "result2"}}},
                                                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
                                                                    "body": {
                                                                      "let": {
                                                                        "bindings": [
                                                                          {
                                                                            "name": "cx3",
                                                                            "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": "result2"}}},
                                                                            "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.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                    "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                "argument": {
                                                                                  "application": {
                                                                                    "function": {
                                                                                      "application": {
                                                                                        "function": {"application": {"function": {"variable": "tryType"}, "argument": {"variable": "cx3"}}},
                                                                                        "argument": {"variable": "tfun"}}},
                                                                                    "argument": {"variable": "targ"}}}}},
                                                                            "argument": {
                                                                              "lambda": {
                                                                                "parameter": "result3",
                                                                                "domain": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                "body": {
                                                                                  "let": {
                                                                                    "bindings": [
                                                                                      {
                                                                                        "name": "t",
                                                                                        "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": "result3"}}},
                                                                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
                                                                                    "body": {
                                                                                      "let": {
                                                                                        "bindings": [
                                                                                          {
                                                                                            "name": "cx4",
                                                                                            "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": "result3"}}},
                                                                                            "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.model.Type"}}},
                                                                                                    "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                                "argument": {
                                                                                                  "application": {
                                                                                                    "function": {
                                                                                                      "application": {
                                                                                                        "function": {
                                                                                                          "application": {
                                                                                                            "function": {
                                                                                                              "application": {"function": {"variable": "hydra.core.checking.applyTypeArgumentsToType"}, "argument": {"variable": "cx4"}}},
                                                                                                            "argument": {"variable": "tx"}}},
                                                                                                        "argument": {"variable": "typeArgs"}}},
                                                                                                    "argument": {"variable": "t"}}}}},
                                                                                            "argument": {
                                                                                              "lambda": {
                                                                                                "parameter": "applied",
                                                                                                "domain": {"variable": "hydra.core.model.Type"},
                                                                                                "body": {
                                                                                                  "typeApplication": {
                                                                                                    "body": {
                                                                                                      "typeApplication": {
                                                                                                        "body": {
                                                                                                          "either": {
                                                                                                            "right": {
                                                                                                              "typeApplication": {
                                                                                                                "body": {
                                                                                                                  "typeApplication": {
                                                                                                                    "body": {"pair": {"first": {"variable": "applied"}, "second": {"variable": "cx4"}}},
                                                                                                                    "type": {"variable": "hydra.core.model.Type"}}},
                                                                                                                "type": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                                        "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                                    "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {
                    "literal": {
                      "string": "Reconstruct the type of an application term (Either/InferenceContext version). Paper: inference.tex, rule App (checking side)."}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.checking.typeOfCaseStatement",
        "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.Type"}}, "isLazy": false},
            {"name": "arg3", "type": {"variable": "hydra.core.model.CaseStatement"}, "isLazy": false}],
          "result": {
            "type": {
              "either": {
                "left": {"variable": "hydra.core.errors.Error"},
                "right": {"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": {
                  "lambda": {
                    "parameter": "tx",
                    "domain": {"variable": "hydra.core.graph.Graph"},
                    "body": {
                      "lambda": {
                        "parameter": "typeArgs",
                        "domain": {"list": {"variable": "hydra.core.model.Type"}},
                        "body": {
                          "lambda": {
                            "parameter": "cs",
                            "domain": {"variable": "hydra.core.model.CaseStatement"},
                            "body": {
                              "let": {
                                "bindings": [
                                  {
                                    "name": "tname",
                                    "term": {
                                      "application": {
                                        "function": {"project": {"typeName": "hydra.core.model.CaseStatement", "fieldName": "typeName"}},
                                        "argument": {"variable": "cs"}}},
                                    "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": "cs"}}},
                                        "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": "cs"}}},
                                            "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.CaseAlternative"}}, "constraints": []}}],
                                        "body": {
                                          "let": {
                                            "bindings": [
                                              {
                                                "name": "cterms",
                                                "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.Term"}}},
                                                        "argument": {"project": {"typeName": "hydra.core.model.CaseAlternative", "fieldName": "handler"}}}},
                                                    "argument": {"variable": "match"}}},
                                                "typeScheme": {"variables": [], "body": {"list": {"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": {
                                                              "optional": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}},
                                                        "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                    "argument": {
                                                      "application": {
                                                        "function": {
                                                          "application": {
                                                            "function": {
                                                              "typeApplication": {
                                                                "body": {
                                                                  "typeApplication": {
                                                                    "body": {
                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.eithers.mapOptional"}, "type": {"variable": "hydra.core.model.Term"}}},
                                                                    "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                "type": {"variable": "hydra.core.errors.Error"}}},
                                                            "argument": {
                                                              "lambda": {
                                                                "parameter": "e",
                                                                "domain": {"variable": "hydra.core.model.Term"},
                                                                "body": {
                                                                  "application": {
                                                                    "function": {
                                                                      "application": {
                                                                        "function": {
                                                                          "application": {
                                                                            "function": {"application": {"function": {"variable": "hydra.core.checking.typeOf"}, "argument": {"variable": "cx"}}},
                                                                            "argument": {"variable": "tx"}}},
                                                                        "argument": {"typeApplication": {"body": {"list": []}, "type": {"variable": "hydra.core.model.Type"}}}}},
                                                                    "argument": {"variable": "e"}}}}}}},
                                                        "argument": {"variable": "dflt"}}}}},
                                                "argument": {
                                                  "lambda": {
                                                    "parameter": "dfltResult",
                                                    "domain": {
                                                      "optional": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}},
                                                    "body": {
                                                      "let": {
                                                        "bindings": [
                                                          {
                                                            "name": "tdflt",
                                                            "term": {
                                                              "application": {
                                                                "function": {
                                                                  "application": {
                                                                    "function": {
                                                                      "typeApplication": {
                                                                        "body": {
                                                                          "typeApplication": {
                                                                            "body": {"variable": "hydra.core.lib.optionals.map"},
                                                                            "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                        "type": {"variable": "hydra.core.model.Type"}}},
                                                                    "argument": {
                                                                      "typeApplication": {
                                                                        "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                        "type": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                "argument": {"variable": "dfltResult"}}},
                                                            "typeScheme": {"variables": [], "body": {"optional": {"variable": "hydra.core.model.Type"}}, "constraints": []}}],
                                                        "body": {
                                                          "let": {
                                                            "bindings": [
                                                              {
                                                                "name": "cx2",
                                                                "term": {
                                                                  "application": {
                                                                    "function": {
                                                                      "application": {
                                                                        "function": {
                                                                          "application": {
                                                                            "function": {
                                                                              "typeApplication": {
                                                                                "body": {
                                                                                  "typeApplication": {
                                                                                    "body": {"variable": "hydra.core.lib.optionals.match"},
                                                                                    "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                            "argument": {"variable": "dfltResult"}}},
                                                                        "argument": {"variable": "cx"}}},
                                                                    "argument": {
                                                                      "typeApplication": {
                                                                        "body": {
                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                        "type": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "constraints": []}}],
                                                            "body": {
                                                              "let": {
                                                                "bindings": [
                                                                  {
                                                                    "name": "foldResult",
                                                                    "term": {
                                                                      "application": {
                                                                        "function": {
                                                                          "application": {
                                                                            "function": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "typeApplication": {
                                                                                    "body": {
                                                                                      "typeApplication": {
                                                                                        "body": {"variable": "hydra.core.lib.lists.foldl"},
                                                                                        "type": {
                                                                                          "either": {
                                                                                            "left": {"variable": "hydra.core.errors.Error"},
                                                                                            "right": {
                                                                                              "pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}},
                                                                                    "type": {"variable": "hydra.core.model.Term"}}},
                                                                                "argument": {
                                                                                  "lambda": {
                                                                                    "parameter": "acc",
                                                                                    "domain": {
                                                                                      "either": {
                                                                                        "left": {"variable": "hydra.core.errors.Error"},
                                                                                        "right": {
                                                                                          "pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                    "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": {
                                                                                                          "pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                                    "type": {
                                                                                                      "pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                                "argument": {"variable": "acc"}}},
                                                                                            "argument": {
                                                                                              "lambda": {
                                                                                                "parameter": "accR",
                                                                                                "domain": {
                                                                                                  "pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                                "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": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                                            "argument": {"variable": "accR"}}},
                                                                                                        "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Type"}}, "constraints": []}}],
                                                                                                    "body": {
                                                                                                      "let": {
                                                                                                        "bindings": [
                                                                                                          {
                                                                                                            "name": "cxA",
                                                                                                            "term": {
                                                                                                              "application": {
                                                                                                                "function": {
                                                                                                                  "typeApplication": {
                                                                                                                    "body": {
                                                                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                                                                                    "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                                                "argument": {"variable": "accR"}}},
                                                                                                            "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.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                                                    "type": {
                                                                                                                      "pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                                                "argument": {
                                                                                                                  "application": {
                                                                                                                    "function": {
                                                                                                                      "application": {
                                                                                                                        "function": {
                                                                                                                          "application": {
                                                                                                                            "function": {"application": {"function": {"variable": "hydra.core.checking.typeOf"}, "argument": {"variable": "cxA"}}},
                                                                                                                            "argument": {"variable": "tx"}}},
                                                                                                                        "argument": {"typeApplication": {"body": {"list": []}, "type": {"variable": "hydra.core.model.Type"}}}}},
                                                                                                                    "argument": {"variable": "term"}}}}},
                                                                                                            "argument": {
                                                                                                              "lambda": {
                                                                                                                "parameter": "tResult",
                                                                                                                "domain": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                                                "body": {
                                                                                                                  "let": {
                                                                                                                    "bindings": [
                                                                                                                      {
                                                                                                                        "name": "t",
                                                                                                                        "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": "tResult"}}},
                                                                                                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
                                                                                                                    "body": {
                                                                                                                      "let": {
                                                                                                                        "bindings": [
                                                                                                                          {
                                                                                                                            "name": "cxB",
                                                                                                                            "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": "tResult"}}},
                                                                                                                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "constraints": []}}],
                                                                                                                        "body": {
                                                                                                                          "typeApplication": {
                                                                                                                            "body": {
                                                                                                                              "typeApplication": {
                                                                                                                                "body": {
                                                                                                                                  "either": {
                                                                                                                                    "right": {
                                                                                                                                      "typeApplication": {
                                                                                                                                        "body": {
                                                                                                                                          "typeApplication": {
                                                                                                                                            "body": {
                                                                                                                                              "pair": {
                                                                                                                                                "first": {
                                                                                                                                                  "application": {
                                                                                                                                                    "function": {
                                                                                                                                                      "application": {
                                                                                                                                                        "function": {
                                                                                                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.lists.concat2"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                                                                                                        "argument": {"variable": "types"}}},
                                                                                                                                                    "argument": {
                                                                                                                                                      "application": {
                                                                                                                                                        "function": {
                                                                                                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.lists.singleton"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                                                                                                        "argument": {"variable": "t"}}}}},
                                                                                                                                                "second": {"variable": "cxB"}}},
                                                                                                                                            "type": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                                                                                                        "type": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                                                                "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                                                            "type": {
                                                                                                                              "pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}}}}}}}}}}}}}}}}}}}}}},
                                                                            "argument": {
                                                                              "typeApplication": {
                                                                                "body": {
                                                                                  "typeApplication": {
                                                                                    "body": {
                                                                                      "either": {
                                                                                        "right": {
                                                                                          "typeApplication": {
                                                                                            "body": {
                                                                                              "typeApplication": {
                                                                                                "body": {
                                                                                                  "pair": {
                                                                                                    "first": {"typeApplication": {"body": {"list": []}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                                                    "second": {"variable": "cx2"}}},
                                                                                                "type": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                                                            "type": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                    "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                "type": {
                                                                                  "pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}},
                                                                        "argument": {"variable": "cterms"}}},
                                                                    "typeScheme": {
                                                                      "variables": [],
                                                                      "body": {
                                                                        "either": {
                                                                          "left": {"variable": "hydra.core.errors.Error"},
                                                                          "right": {
                                                                            "pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"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": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                            "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                        "argument": {"variable": "foldResult"}}},
                                                                    "argument": {
                                                                      "lambda": {
                                                                        "parameter": "foldR",
                                                                        "domain": {
                                                                          "pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                        "body": {
                                                                          "let": {
                                                                            "bindings": [
                                                                              {
                                                                                "name": "tcterms",
                                                                                "term": {
                                                                                  "application": {
                                                                                    "function": {
                                                                                      "typeApplication": {
                                                                                        "body": {
                                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                                                        "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                    "argument": {"variable": "foldR"}}},
                                                                                "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Type"}}, "constraints": []}}],
                                                                            "body": {
                                                                              "let": {
                                                                                "bindings": [
                                                                                  {
                                                                                    "name": "cx3",
                                                                                    "term": {
                                                                                      "application": {
                                                                                        "function": {
                                                                                          "typeApplication": {
                                                                                            "body": {
                                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                                                            "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                        "argument": {"variable": "foldR"}}},
                                                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "constraints": []}}],
                                                                                "body": {
                                                                                  "let": {
                                                                                    "bindings": [
                                                                                      {
                                                                                        "name": "fcodsResult",
                                                                                        "term": {
                                                                                          "application": {
                                                                                            "function": {
                                                                                              "application": {
                                                                                                "function": {
                                                                                                  "application": {
                                                                                                    "function": {
                                                                                                      "typeApplication": {
                                                                                                        "body": {
                                                                                                          "typeApplication": {
                                                                                                            "body": {"variable": "hydra.core.lib.lists.foldl"},
                                                                                                            "type": {
                                                                                                              "either": {
                                                                                                                "left": {"variable": "hydra.core.errors.Error"},
                                                                                                                "right": {
                                                                                                                  "pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}},
                                                                                                        "type": {"variable": "hydra.core.model.Type"}}},
                                                                                                    "argument": {
                                                                                                      "lambda": {
                                                                                                        "parameter": "acc",
                                                                                                        "domain": {
                                                                                                          "either": {
                                                                                                            "left": {"variable": "hydra.core.errors.Error"},
                                                                                                            "right": {
                                                                                                              "pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                                        "body": {
                                                                                                          "lambda": {
                                                                                                            "parameter": "t",
                                                                                                            "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": {
                                                                                                                              "pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                                                        "type": {
                                                                                                                          "pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                                                    "argument": {"variable": "acc"}}},
                                                                                                                "argument": {
                                                                                                                  "lambda": {
                                                                                                                    "parameter": "accR",
                                                                                                                    "domain": {
                                                                                                                      "pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                                                    "body": {
                                                                                                                      "let": {
                                                                                                                        "bindings": [
                                                                                                                          {
                                                                                                                            "name": "cods",
                                                                                                                            "term": {
                                                                                                                              "application": {
                                                                                                                                "function": {
                                                                                                                                  "typeApplication": {
                                                                                                                                    "body": {
                                                                                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                                                                                                    "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                                                                "argument": {"variable": "accR"}}},
                                                                                                                            "typeScheme": {"variables": [], "body": {"list": {"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.FunctionType"}}},
                                                                                                                                    "type": {
                                                                                                                                      "pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                                                                "argument": {"application": {"function": {"variable": "hydra.core.extract.model.functionType"}, "argument": {"variable": "t"}}}}},
                                                                                                                            "argument": {
                                                                                                                              "lambda": {
                                                                                                                                "parameter": "ft",
                                                                                                                                "domain": {"variable": "hydra.core.model.FunctionType"},
                                                                                                                                "body": {
                                                                                                                                  "typeApplication": {
                                                                                                                                    "body": {
                                                                                                                                      "typeApplication": {
                                                                                                                                        "body": {
                                                                                                                                          "either": {
                                                                                                                                            "right": {
                                                                                                                                              "typeApplication": {
                                                                                                                                                "body": {
                                                                                                                                                  "typeApplication": {
                                                                                                                                                    "body": {
                                                                                                                                                      "pair": {
                                                                                                                                                        "first": {
                                                                                                                                                          "application": {
                                                                                                                                                            "function": {
                                                                                                                                                              "application": {
                                                                                                                                                                "function": {
                                                                                                                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.lists.concat2"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                                                                                                                "argument": {"variable": "cods"}}},
                                                                                                                                                            "argument": {
                                                                                                                                                              "application": {
                                                                                                                                                                "function": {
                                                                                                                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.lists.singleton"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                                                                                                                "argument": {
                                                                                                                                                                  "application": {
                                                                                                                                                                    "function": {"project": {"typeName": "hydra.core.model.FunctionType", "fieldName": "codomain"}},
                                                                                                                                                                    "argument": {"variable": "ft"}}}}}}},
                                                                                                                                                        "second": {"variable": "cx3"}}},
                                                                                                                                                    "type": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                                                                                                                "type": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                                                                        "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                                                                    "type": {
                                                                                                                                      "pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}}}}}}}}}}}}}}}},
                                                                                                "argument": {
                                                                                                  "typeApplication": {
                                                                                                    "body": {
                                                                                                      "typeApplication": {
                                                                                                        "body": {
                                                                                                          "either": {
                                                                                                            "right": {
                                                                                                              "typeApplication": {
                                                                                                                "body": {
                                                                                                                  "typeApplication": {
                                                                                                                    "body": {
                                                                                                                      "pair": {
                                                                                                                        "first": {"typeApplication": {"body": {"list": []}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                                                                        "second": {"variable": "cx3"}}},
                                                                                                                    "type": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                                                                                "type": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                                        "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                                    "type": {
                                                                                                      "pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}},
                                                                                            "argument": {"variable": "tcterms"}}},
                                                                                        "typeScheme": {
                                                                                          "variables": [],
                                                                                          "body": {
                                                                                            "either": {
                                                                                              "left": {"variable": "hydra.core.errors.Error"},
                                                                                              "right": {
                                                                                                "pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"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": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                                "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                            "argument": {"variable": "fcodsResult"}}},
                                                                                        "argument": {
                                                                                          "lambda": {
                                                                                            "parameter": "fcodsR",
                                                                                            "domain": {
                                                                                              "pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                            "body": {
                                                                                              "let": {
                                                                                                "bindings": [
                                                                                                  {
                                                                                                    "name": "fcods",
                                                                                                    "term": {
                                                                                                      "application": {
                                                                                                        "function": {
                                                                                                          "typeApplication": {
                                                                                                            "body": {
                                                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                                                                            "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                                        "argument": {"variable": "fcodsR"}}},
                                                                                                    "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Type"}}, "constraints": []}}],
                                                                                                "body": {
                                                                                                  "let": {
                                                                                                    "bindings": [
                                                                                                      {
                                                                                                        "name": "cods",
                                                                                                        "term": {
                                                                                                          "application": {
                                                                                                            "function": {
                                                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.optionals.givens"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                                                            "argument": {
                                                                                                              "application": {
                                                                                                                "function": {
                                                                                                                  "application": {
                                                                                                                    "function": {
                                                                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.lists.cons"}, "type": {"optional": {"variable": "hydra.core.model.Type"}}}},
                                                                                                                    "argument": {"variable": "tdflt"}}},
                                                                                                                "argument": {
                                                                                                                  "application": {
                                                                                                                    "function": {
                                                                                                                      "application": {
                                                                                                                        "function": {
                                                                                                                          "typeApplication": {
                                                                                                                            "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                                                                            "type": {"optional": {"variable": "hydra.core.model.Type"}}}},
                                                                                                                        "argument": {
                                                                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.optionals.given"}, "type": {"variable": "hydra.core.model.Type"}}}}},
                                                                                                                    "argument": {"variable": "fcods"}}}}}}},
                                                                                                        "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Type"}}, "constraints": []}}],
                                                                                                    "body": {
                                                                                                      "application": {
                                                                                                        "function": {
                                                                                                          "application": {
                                                                                                            "function": {
                                                                                                              "typeApplication": {
                                                                                                                "body": {
                                                                                                                  "typeApplication": {
                                                                                                                    "body": {
                                                                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.eithers.bind"}, "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                                                    "type": {"variable": "hydra.core.model.Type"}}},
                                                                                                                "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                                            "argument": {
                                                                                                              "application": {
                                                                                                                "function": {
                                                                                                                  "application": {
                                                                                                                    "function": {
                                                                                                                      "application": {
                                                                                                                        "function": {
                                                                                                                          "application": {
                                                                                                                            "function": {
                                                                                                                              "typeApplication": {"body": {"variable": "hydra.core.checking.checkSameType"}, "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                                                            "argument": {"variable": "cx3"}}},
                                                                                                                        "argument": {"variable": "tx"}}},
                                                                                                                    "argument": {"literal": {"string": "case branches"}}}},
                                                                                                                "argument": {"variable": "cods"}}}}},
                                                                                                        "argument": {
                                                                                                          "lambda": {
                                                                                                            "parameter": "cod",
                                                                                                            "domain": {"variable": "hydra.core.model.Type"},
                                                                                                            "body": {
                                                                                                              "typeApplication": {
                                                                                                                "body": {
                                                                                                                  "typeApplication": {
                                                                                                                    "body": {
                                                                                                                      "either": {
                                                                                                                        "right": {
                                                                                                                          "typeApplication": {
                                                                                                                            "body": {
                                                                                                                              "typeApplication": {
                                                                                                                                "body": {
                                                                                                                                  "pair": {
                                                                                                                                    "first": {
                                                                                                                                      "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": {"variable": "typeArgs"}}}},
                                                                                                                                                {"name": "codomain", "term": {"variable": "cod"}}]}}}}},
                                                                                                                                    "second": {"variable": "cx3"}}},
                                                                                                                                "type": {"variable": "hydra.core.model.Type"}}},
                                                                                                                            "type": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                                                    "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                                                "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {
                    "literal": {
                      "string": "Reconstruct the type of a case statement (Either/InferenceContext version). Paper: inference.tex, rules Case and Case_d (checking side)."}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.checking.typeOfEither",
        "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.Type"}}, "isLazy": false},
            {
              "name": "arg3",
              "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": {"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": {
                  "lambda": {
                    "parameter": "tx",
                    "domain": {"variable": "hydra.core.graph.Graph"},
                    "body": {
                      "lambda": {
                        "parameter": "typeArgs",
                        "domain": {"list": {"variable": "hydra.core.model.Type"}},
                        "body": {
                          "lambda": {
                            "parameter": "et",
                            "domain": {"either": {"left": {"variable": "hydra.core.model.Term"}, "right": {"variable": "hydra.core.model.Term"}}},
                            "body": {
                              "let": {
                                "bindings": [
                                  {
                                    "name": "n",
                                    "term": {
                                      "application": {
                                        "function": {
                                          "typeApplication": {"body": {"variable": "hydra.core.lib.lists.length"}, "type": {"variable": "hydra.core.model.Type"}}},
                                        "argument": {"variable": "typeArgs"}}},
                                    "typeScheme": {"variables": [], "body": {"literal": {"integer": "int32"}}, "constraints": []}}],
                                "body": {
                                  "let": {
                                    "bindings": [
                                      {
                                        "name": "arityErr",
                                        "term": {
                                          "typeLambda": {
                                            "parameter": "t0",
                                            "body": {
                                              "typeApplication": {
                                                "body": {
                                                  "typeApplication": {
                                                    "body": {
                                                      "either": {
                                                        "left": {
                                                          "inject": {
                                                            "typeName": "hydra.core.errors.Error",
                                                            "field": {
                                                              "name": "checking",
                                                              "term": {
                                                                "inject": {
                                                                  "typeName": "hydra.core.error.checking.CheckingError",
                                                                  "field": {
                                                                    "name": "typeArityMismatch",
                                                                    "term": {
                                                                      "record": {
                                                                        "typeName": "hydra.core.error.checking.TypeArityMismatchError",
                                                                        "fields": [
                                                                          {
                                                                            "name": "type",
                                                                            "term": {
                                                                              "inject": {
                                                                                "typeName": "hydra.core.model.Type",
                                                                                "field": {
                                                                                  "name": "either",
                                                                                  "term": {
                                                                                    "record": {
                                                                                      "typeName": "hydra.core.model.EitherType",
                                                                                      "fields": [
                                                                                        {"name": "left", "term": {"inject": {"typeName": "hydra.core.model.Type", "field": {"name": "unit", "term": "unit"}}}},
                                                                                        {"name": "right", "term": {"inject": {"typeName": "hydra.core.model.Type", "field": {"name": "unit", "term": "unit"}}}}]}}}}}},
                                                                          {"name": "expectedArity", "term": {"literal": {"integer": {"int32": 2}}}},
                                                                          {"name": "actualArity", "term": {"variable": "n"}},
                                                                          {"name": "typeArguments", "term": {"variable": "typeArgs"}}]}}}}}}}}}},
                                                    "type": {"variable": "hydra.core.errors.Error"}}},
                                                "type": {"variable": "t0"}}}}},
                                        "typeScheme": {
                                          "variables": ["t0"],
                                          "body": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "t0"}}},
                                          "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.Type"}, "second": {"list": {"variable": "hydra.core.model.Type"}}}}}},
                                                    "type": {
                                                      "either": {
                                                        "left": {"variable": "hydra.core.errors.Error"},
                                                        "right": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}},
                                                "argument": {
                                                  "application": {
                                                    "function": {
                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.lists.uncons"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                    "argument": {"variable": "typeArgs"}}}}},
                                            "argument": {
                                              "typeApplication": {
                                                "body": {"variable": "arityErr"},
                                                "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}},
                                        "argument": {
                                          "lambda": {
                                            "parameter": "uc0",
                                            "domain": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"list": {"variable": "hydra.core.model.Type"}}}},
                                            "body": {
                                              "let": {
                                                "bindings": [
                                                  {
                                                    "name": "ta0",
                                                    "term": {
                                                      "application": {
                                                        "function": {
                                                          "typeApplication": {
                                                            "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                            "type": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                        "argument": {"variable": "uc0"}}},
                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "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.Type"}, "second": {"list": {"variable": "hydra.core.model.Type"}}}}}},
                                                                "type": {
                                                                  "either": {
                                                                    "left": {"variable": "hydra.core.errors.Error"},
                                                                    "right": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}},
                                                            "argument": {
                                                              "application": {
                                                                "function": {
                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.lists.uncons"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                "argument": {
                                                                  "application": {
                                                                    "function": {
                                                                      "typeApplication": {
                                                                        "body": {
                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                        "type": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                                    "argument": {"variable": "uc0"}}}}}}},
                                                        "argument": {
                                                          "typeApplication": {
                                                            "body": {"variable": "arityErr"},
                                                            "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}},
                                                    "argument": {
                                                      "lambda": {
                                                        "parameter": "uc1",
                                                        "domain": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                        "body": {
                                                          "let": {
                                                            "bindings": [
                                                              {
                                                                "name": "ta1",
                                                                "term": {
                                                                  "application": {
                                                                    "function": {
                                                                      "typeApplication": {
                                                                        "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                        "type": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                                    "argument": {"variable": "uc1"}}},
                                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
                                                            "body": {
                                                              "application": {
                                                                "function": {
                                                                  "application": {
                                                                    "function": {
                                                                      "application": {
                                                                        "function": {
                                                                          "typeApplication": {
                                                                            "body": {"variable": "hydra.core.lib.logic.ifElse"},
                                                                            "type": {
                                                                              "either": {
                                                                                "left": {"variable": "hydra.core.errors.Error"},
                                                                                "right": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}},
                                                                        "argument": {
                                                                          "application": {
                                                                            "function": {
                                                                              "application": {
                                                                                "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.equality.equal"}, "type": {"literal": {"integer": "int32"}}}},
                                                                                "argument": {"variable": "n"}}},
                                                                            "argument": {"literal": {"integer": {"int32": 2}}}}}}},
                                                                    "argument": {
                                                                      "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": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}},
                                                                                "argument": {
                                                                                  "lambda": {
                                                                                    "parameter": "leftTerm",
                                                                                    "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": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                                "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                            "argument": {
                                                                                              "application": {
                                                                                                "function": {
                                                                                                  "application": {
                                                                                                    "function": {
                                                                                                      "application": {
                                                                                                        "function": {"application": {"function": {"variable": "hydra.core.checking.typeOf"}, "argument": {"variable": "cx"}}},
                                                                                                        "argument": {"variable": "tx"}}},
                                                                                                    "argument": {"typeApplication": {"body": {"list": []}, "type": {"variable": "hydra.core.model.Type"}}}}},
                                                                                                "argument": {"variable": "leftTerm"}}}}},
                                                                                        "argument": {
                                                                                          "lambda": {
                                                                                            "parameter": "result",
                                                                                            "domain": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                            "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": "result"}}},
                                                                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
                                                                                                "body": {
                                                                                                  "let": {
                                                                                                    "bindings": [
                                                                                                      {
                                                                                                        "name": "cx2",
                                                                                                        "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": "result"}}},
                                                                                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "constraints": []}}],
                                                                                                    "body": {
                                                                                                      "typeApplication": {
                                                                                                        "body": {
                                                                                                          "typeApplication": {
                                                                                                            "body": {
                                                                                                              "either": {
                                                                                                                "right": {
                                                                                                                  "typeApplication": {
                                                                                                                    "body": {
                                                                                                                      "typeApplication": {
                                                                                                                        "body": {
                                                                                                                          "pair": {
                                                                                                                            "first": {
                                                                                                                              "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": "ta1"}}]}}}}},
                                                                                                                            "second": {"variable": "cx2"}}},
                                                                                                                        "type": {"variable": "hydra.core.model.Type"}}},
                                                                                                                    "type": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                                            "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                                        "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}}}}}}}}}}}},
                                                                            "argument": {
                                                                              "lambda": {
                                                                                "parameter": "rightTerm",
                                                                                "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": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                            "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                        "argument": {
                                                                                          "application": {
                                                                                            "function": {
                                                                                              "application": {
                                                                                                "function": {
                                                                                                  "application": {
                                                                                                    "function": {"application": {"function": {"variable": "hydra.core.checking.typeOf"}, "argument": {"variable": "cx"}}},
                                                                                                    "argument": {"variable": "tx"}}},
                                                                                                "argument": {"typeApplication": {"body": {"list": []}, "type": {"variable": "hydra.core.model.Type"}}}}},
                                                                                            "argument": {"variable": "rightTerm"}}}}},
                                                                                    "argument": {
                                                                                      "lambda": {
                                                                                        "parameter": "result",
                                                                                        "domain": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                        "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": "result"}}},
                                                                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
                                                                                            "body": {
                                                                                              "let": {
                                                                                                "bindings": [
                                                                                                  {
                                                                                                    "name": "cx2",
                                                                                                    "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": "result"}}},
                                                                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "constraints": []}}],
                                                                                                "body": {
                                                                                                  "typeApplication": {
                                                                                                    "body": {
                                                                                                      "typeApplication": {
                                                                                                        "body": {
                                                                                                          "either": {
                                                                                                            "right": {
                                                                                                              "typeApplication": {
                                                                                                                "body": {
                                                                                                                  "typeApplication": {
                                                                                                                    "body": {
                                                                                                                      "pair": {
                                                                                                                        "first": {
                                                                                                                          "inject": {
                                                                                                                            "typeName": "hydra.core.model.Type",
                                                                                                                            "field": {
                                                                                                                              "name": "either",
                                                                                                                              "term": {
                                                                                                                                "record": {
                                                                                                                                  "typeName": "hydra.core.model.EitherType",
                                                                                                                                  "fields": [{"name": "left", "term": {"variable": "ta0"}}, {"name": "right", "term": {"variable": "rightType"}}]}}}}},
                                                                                                                        "second": {"variable": "cx2"}}},
                                                                                                                    "type": {"variable": "hydra.core.model.Type"}}},
                                                                                                                "type": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                                        "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                                    "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}}}}}}}}}}}},
                                                                        "argument": {"variable": "et"}}}}},
                                                                "argument": {
                                                                  "typeApplication": {
                                                                    "body": {"variable": "arityErr"},
                                                                    "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {
                    "literal": {
                      "string": "Reconstruct the type of an either value (Either/InferenceContext version). Paper: inference.tex, rules Eith_L and Eith_R (checking side)."}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.checking.typeOfInjection",
        "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.Type"}}, "isLazy": false},
            {"name": "arg3", "type": {"variable": "hydra.core.model.Injection"}, "isLazy": false}],
          "result": {
            "type": {
              "either": {
                "left": {"variable": "hydra.core.errors.Error"},
                "right": {"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": {
                  "lambda": {
                    "parameter": "tx",
                    "domain": {"variable": "hydra.core.graph.Graph"},
                    "body": {
                      "lambda": {
                        "parameter": "typeArgs",
                        "domain": {"list": {"variable": "hydra.core.model.Type"}},
                        "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": "fterm",
                                                "term": {
                                                  "application": {
                                                    "function": {"project": {"typeName": "hydra.core.model.Field", "fieldName": "term"}},
                                                    "argument": {"variable": "field"}}},
                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                            "body": {
                                              "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": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                    "argument": {
                                                      "application": {
                                                        "function": {
                                                          "application": {
                                                            "function": {"application": {"function": {"variable": "hydra.core.resolution.requireSchemaType"}, "argument": {"variable": "cx"}}},
                                                            "argument": {
                                                              "application": {
                                                                "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "schemaTypes"}},
                                                                "argument": {"variable": "tx"}}}}},
                                                        "argument": {"variable": "tname"}}}}},
                                                "argument": {
                                                  "lambda": {
                                                    "parameter": "schemaResult",
                                                    "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": "schemaResult"}}},
                                                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.TypeScheme"}, "constraints": []}}],
                                                        "body": {
                                                          "let": {
                                                            "bindings": [
                                                              {
                                                                "name": "cx2",
                                                                "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": "schemaResult"}}},
                                                                "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": "sbody",
                                                                        "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": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                            "argument": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "application": {
                                                                                    "function": {
                                                                                      "typeApplication": {"body": {"variable": "hydra.core.extract.model.unionType"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                    "argument": {"variable": "tname"}}},
                                                                                "argument": {"variable": "sbody"}}}}},
                                                                        "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": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                    "argument": {
                                                                                      "application": {
                                                                                        "function": {
                                                                                          "application": {
                                                                                            "function": {
                                                                                              "application": {
                                                                                                "function": {
                                                                                                  "typeApplication": {
                                                                                                    "body": {"variable": "hydra.core.resolution.findFieldType"},
                                                                                                    "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                                "argument": {"variable": "cx2"}}},
                                                                                            "argument": {"variable": "fname"}}},
                                                                                        "argument": {"variable": "sfields"}}}}},
                                                                                "argument": {
                                                                                  "lambda": {
                                                                                    "parameter": "ftyp",
                                                                                    "domain": {"variable": "hydra.core.model.Type"},
                                                                                    "body": {
                                                                                      "typeApplication": {
                                                                                        "body": {
                                                                                          "typeApplication": {
                                                                                            "body": {
                                                                                              "either": {
                                                                                                "right": {
                                                                                                  "typeApplication": {
                                                                                                    "body": {
                                                                                                      "typeApplication": {
                                                                                                        "body": {
                                                                                                          "pair": {
                                                                                                            "first": {
                                                                                                              "application": {
                                                                                                                "function": {
                                                                                                                  "application": {"function": {"variable": "hydra.core.resolution.nominalApplication"}, "argument": {"variable": "tname"}}},
                                                                                                                "argument": {"variable": "typeArgs"}}},
                                                                                                            "second": {"variable": "cx2"}}},
                                                                                                        "type": {"variable": "hydra.core.model.Type"}}},
                                                                                                    "type": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                            "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                        "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {
                    "literal": {
                      "string": "Reconstruct the type of a union injection (Either/InferenceContext version). Paper: inference.tex, rule Inj (checking side)."}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.checking.typeOfLambda",
        "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.Type"}}, "isLazy": false},
            {"name": "arg3", "type": {"variable": "hydra.core.model.Lambda"}, "isLazy": false}],
          "result": {
            "type": {
              "either": {
                "left": {"variable": "hydra.core.errors.Error"},
                "right": {"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": {
                  "lambda": {
                    "parameter": "tx",
                    "domain": {"variable": "hydra.core.graph.Graph"},
                    "body": {
                      "lambda": {
                        "parameter": "typeArgs",
                        "domain": {"list": {"variable": "hydra.core.model.Type"}},
                        "body": {
                          "lambda": {
                            "parameter": "l",
                            "domain": {"variable": "hydra.core.model.Lambda"},
                            "body": {
                              "let": {
                                "bindings": [
                                  {
                                    "name": "v",
                                    "term": {
                                      "application": {
                                        "function": {"project": {"typeName": "hydra.core.model.Lambda", "fieldName": "parameter"}},
                                        "argument": {"variable": "l"}}},
                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Name"}, "constraints": []}}],
                                "body": {
                                  "let": {
                                    "bindings": [
                                      {
                                        "name": "mdom",
                                        "term": {
                                          "application": {"function": {"project": {"typeName": "hydra.core.model.Lambda", "fieldName": "domain"}}, "argument": {"variable": "l"}}},
                                        "typeScheme": {"variables": [], "body": {"optional": {"variable": "hydra.core.model.Type"}}, "constraints": []}}],
                                    "body": {
                                      "let": {
                                        "bindings": [
                                          {
                                            "name": "body",
                                            "term": {
                                              "application": {"function": {"project": {"typeName": "hydra.core.model.Lambda", "fieldName": "body"}}, "argument": {"variable": "l"}}},
                                            "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.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                    "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "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.Type"}}},
                                                                "type": {
                                                                  "either": {
                                                                    "left": {"variable": "hydra.core.errors.Error"},
                                                                    "right": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}},
                                                            "argument": {"variable": "mdom"}}},
                                                        "argument": {
                                                          "typeApplication": {
                                                            "body": {
                                                              "typeApplication": {
                                                                "body": {
                                                                  "either": {
                                                                    "left": {
                                                                      "inject": {
                                                                        "typeName": "hydra.core.errors.Error",
                                                                        "field": {
                                                                          "name": "checking",
                                                                          "term": {
                                                                            "inject": {
                                                                              "typeName": "hydra.core.error.checking.CheckingError",
                                                                              "field": {
                                                                                "name": "untypedLambda",
                                                                                "term": {"record": {"typeName": "hydra.core.error.checking.UntypedLambdaError", "fields": []}}}}}}}}}},
                                                                "type": {"variable": "hydra.core.errors.Error"}}},
                                                            "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}},
                                                    "argument": {
                                                      "lambda": {
                                                        "parameter": "dom",
                                                        "domain": {"variable": "hydra.core.model.Type"},
                                                        "body": {
                                                          "let": {
                                                            "bindings": [
                                                              {
                                                                "name": "types2",
                                                                "term": {
                                                                  "application": {
                                                                    "function": {
                                                                      "application": {
                                                                        "function": {
                                                                          "application": {
                                                                            "function": {
                                                                              "typeApplication": {
                                                                                "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.insert"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                "type": {"variable": "hydra.core.model.TypeScheme"}}},
                                                                            "argument": {"variable": "v"}}},
                                                                        "argument": {"application": {"function": {"variable": "hydra.core.scoping.fTypeToTypeScheme"}, "argument": {"variable": "dom"}}}}},
                                                                    "argument": {
                                                                      "application": {
                                                                        "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "boundTypes"}},
                                                                        "argument": {"variable": "tx"}}}}},
                                                                "typeScheme": {
                                                                  "variables": [],
                                                                  "body": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeScheme"}}},
                                                                  "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.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                        "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                    "argument": {
                                                                      "application": {
                                                                        "function": {
                                                                          "application": {
                                                                            "function": {
                                                                              "application": {
                                                                                "function": {"application": {"function": {"variable": "hydra.core.checking.typeOf"}, "argument": {"variable": "cx"}}},
                                                                                "argument": {
                                                                                  "record": {
                                                                                    "typeName": "hydra.core.graph.Graph",
                                                                                    "fields": [
                                                                                      {
                                                                                        "name": "boundTerms",
                                                                                        "term": {
                                                                                          "application": {
                                                                                            "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "boundTerms"}},
                                                                                            "argument": {"variable": "tx"}}}},
                                                                                      {"name": "boundTypes", "term": {"variable": "types2"}},
                                                                                      {
                                                                                        "name": "classConstraints",
                                                                                        "term": {
                                                                                          "application": {
                                                                                            "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "classConstraints"}},
                                                                                            "argument": {"variable": "tx"}}}},
                                                                                      {
                                                                                        "name": "lambdaVariables",
                                                                                        "term": {
                                                                                          "application": {
                                                                                            "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "lambdaVariables"}},
                                                                                            "argument": {"variable": "tx"}}}},
                                                                                      {
                                                                                        "name": "metadata",
                                                                                        "term": {
                                                                                          "application": {
                                                                                            "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "metadata"}},
                                                                                            "argument": {"variable": "tx"}}}},
                                                                                      {
                                                                                        "name": "primitives",
                                                                                        "term": {
                                                                                          "application": {
                                                                                            "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "primitives"}},
                                                                                            "argument": {"variable": "tx"}}}},
                                                                                      {
                                                                                        "name": "schemaTypes",
                                                                                        "term": {
                                                                                          "application": {
                                                                                            "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "schemaTypes"}},
                                                                                            "argument": {"variable": "tx"}}}},
                                                                                      {
                                                                                        "name": "typeVariables",
                                                                                        "term": {
                                                                                          "application": {
                                                                                            "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "typeVariables"}},
                                                                                            "argument": {"variable": "tx"}}}}]}}}},
                                                                            "argument": {"typeApplication": {"body": {"list": []}, "type": {"variable": "hydra.core.model.Type"}}}}},
                                                                        "argument": {"variable": "body"}}}}},
                                                                "argument": {
                                                                  "lambda": {
                                                                    "parameter": "codResult",
                                                                    "domain": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                    "body": {
                                                                      "let": {
                                                                        "bindings": [
                                                                          {
                                                                            "name": "cod",
                                                                            "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": "codResult"}}},
                                                                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
                                                                        "body": {
                                                                          "let": {
                                                                            "bindings": [
                                                                              {
                                                                                "name": "cx2",
                                                                                "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": "codResult"}}},
                                                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "constraints": []}}],
                                                                            "body": {
                                                                              "typeApplication": {
                                                                                "body": {
                                                                                  "typeApplication": {
                                                                                    "body": {
                                                                                      "either": {
                                                                                        "right": {
                                                                                          "typeApplication": {
                                                                                            "body": {
                                                                                              "typeApplication": {
                                                                                                "body": {
                                                                                                  "pair": {
                                                                                                    "first": {
                                                                                                      "inject": {
                                                                                                        "typeName": "hydra.core.model.Type",
                                                                                                        "field": {
                                                                                                          "name": "function",
                                                                                                          "term": {
                                                                                                            "record": {
                                                                                                              "typeName": "hydra.core.model.FunctionType",
                                                                                                              "fields": [{"name": "domain", "term": {"variable": "dom"}}, {"name": "codomain", "term": {"variable": "cod"}}]}}}}},
                                                                                                    "second": {"variable": "cx2"}}},
                                                                                                "type": {"variable": "hydra.core.model.Type"}}},
                                                                                            "type": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                    "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}}}}}}}}}}}}}}}},
                                            "argument": {
                                              "lambda": {
                                                "parameter": "tbodyResult",
                                                "domain": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                "body": {
                                                  "let": {
                                                    "bindings": [
                                                      {
                                                        "name": "tbody",
                                                        "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": "tbodyResult"}}},
                                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
                                                    "body": {
                                                      "let": {
                                                        "bindings": [
                                                          {
                                                            "name": "cx3",
                                                            "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": "tbodyResult"}}},
                                                            "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.model.Type"}}},
                                                                    "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                "argument": {
                                                                  "application": {
                                                                    "function": {
                                                                      "application": {
                                                                        "function": {
                                                                          "application": {
                                                                            "function": {
                                                                              "application": {"function": {"variable": "hydra.core.checking.applyTypeArgumentsToType"}, "argument": {"variable": "cx3"}}},
                                                                            "argument": {"variable": "tx"}}},
                                                                        "argument": {"variable": "typeArgs"}}},
                                                                    "argument": {"variable": "tbody"}}}}},
                                                            "argument": {
                                                              "lambda": {
                                                                "parameter": "applied",
                                                                "domain": {"variable": "hydra.core.model.Type"},
                                                                "body": {
                                                                  "typeApplication": {
                                                                    "body": {
                                                                      "typeApplication": {
                                                                        "body": {
                                                                          "either": {
                                                                            "right": {
                                                                              "typeApplication": {
                                                                                "body": {
                                                                                  "typeApplication": {
                                                                                    "body": {"pair": {"first": {"variable": "applied"}, "second": {"variable": "cx3"}}},
                                                                                    "type": {"variable": "hydra.core.model.Type"}}},
                                                                                "type": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                        "type": {"variable": "hydra.core.errors.Error"}}},
                                                                    "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {
                    "literal": {
                      "string": "Reconstruct the type of a lambda function (Either/InferenceContext version). Paper: inference.tex, rule Abs (checking side)."}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.checking.typeOfLet",
        "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.Type"}}, "isLazy": false},
            {"name": "arg3", "type": {"variable": "hydra.core.model.Let"}, "isLazy": false}],
          "result": {
            "type": {
              "either": {
                "left": {"variable": "hydra.core.errors.Error"},
                "right": {"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": {
                  "lambda": {
                    "parameter": "tx",
                    "domain": {"variable": "hydra.core.graph.Graph"},
                    "body": {
                      "lambda": {
                        "parameter": "typeArgs",
                        "domain": {"list": {"variable": "hydra.core.model.Type"}},
                        "body": {
                          "lambda": {
                            "parameter": "letTerm",
                            "domain": {"variable": "hydra.core.model.Let"},
                            "body": {
                              "let": {
                                "bindings": [
                                  {
                                    "name": "bs",
                                    "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": "body",
                                        "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": "bs"}}},
                                            "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Name"}}, "constraints": []}}],
                                        "body": {
                                          "let": {
                                            "bindings": [
                                              {
                                                "name": "bindingType",
                                                "term": {
                                                  "lambda": {
                                                    "parameter": "b",
                                                    "domain": {"variable": "hydra.core.model.Binding"},
                                                    "body": {
                                                      "application": {
                                                        "function": {
                                                          "application": {
                                                            "function": {
                                                              "application": {
                                                                "function": {
                                                                  "typeApplication": {
                                                                    "body": {
                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.optionals.match"}, "type": {"variable": "hydra.core.model.TypeScheme"}}},
                                                                    "type": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.model.Type"}}}}},
                                                                "argument": {
                                                                  "application": {
                                                                    "function": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "typeScheme"}},
                                                                    "argument": {"variable": "b"}}}}},
                                                            "argument": {
                                                              "typeApplication": {
                                                                "body": {
                                                                  "typeApplication": {
                                                                    "body": {
                                                                      "either": {
                                                                        "left": {
                                                                          "inject": {
                                                                            "typeName": "hydra.core.errors.Error",
                                                                            "field": {
                                                                              "name": "checking",
                                                                              "term": {
                                                                                "inject": {
                                                                                  "typeName": "hydra.core.error.checking.CheckingError",
                                                                                  "field": {
                                                                                    "name": "untypedLetBinding",
                                                                                    "term": {
                                                                                      "record": {
                                                                                        "typeName": "hydra.core.error.checking.UntypedLetBindingError",
                                                                                        "fields": [{"name": "binding", "term": {"variable": "b"}}]}}}}}}}}}},
                                                                    "type": {"variable": "hydra.core.errors.Error"}}},
                                                                "type": {"variable": "hydra.core.model.Type"}}}}},
                                                        "argument": {
                                                          "lambda": {
                                                            "parameter": "ts",
                                                            "domain": {"variable": "hydra.core.model.TypeScheme"},
                                                            "body": {
                                                              "typeApplication": {
                                                                "body": {
                                                                  "typeApplication": {
                                                                    "body": {
                                                                      "either": {
                                                                        "right": {"application": {"function": {"variable": "hydra.core.scoping.typeSchemeToFType"}, "argument": {"variable": "ts"}}}}},
                                                                    "type": {"variable": "hydra.core.errors.Error"}}},
                                                                "type": {"variable": "hydra.core.model.Type"}}}}}}}}},
                                                "typeScheme": {
                                                  "variables": [],
                                                  "body": {
                                                    "function": {
                                                      "domain": {"variable": "hydra.core.model.Binding"},
                                                      "codomain": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.model.Type"}}}}},
                                                  "constraints": []}}],
                                            "body": {
                                              "let": {
                                                "bindings": [
                                                  {
                                                    "name": "btypesResult",
                                                    "term": {
                                                      "application": {
                                                        "function": {
                                                          "application": {
                                                            "function": {
                                                              "application": {
                                                                "function": {
                                                                  "typeApplication": {
                                                                    "body": {
                                                                      "typeApplication": {
                                                                        "body": {"variable": "hydra.core.lib.lists.foldl"},
                                                                        "type": {
                                                                          "either": {
                                                                            "left": {"variable": "hydra.core.errors.Error"},
                                                                            "right": {"pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": "unit"}}}}}},
                                                                    "type": {"variable": "hydra.core.model.Binding"}}},
                                                                "argument": {
                                                                  "lambda": {
                                                                    "parameter": "acc",
                                                                    "domain": {
                                                                      "either": {
                                                                        "left": {"variable": "hydra.core.errors.Error"},
                                                                        "right": {"pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": "unit"}}}},
                                                                    "body": {
                                                                      "lambda": {
                                                                        "parameter": "b",
                                                                        "domain": {"variable": "hydra.core.model.Binding"},
                                                                        "body": {
                                                                          "application": {
                                                                            "function": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "typeApplication": {
                                                                                    "body": {
                                                                                      "typeApplication": {
                                                                                        "body": {
                                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.eithers.bind"}, "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                        "type": {"pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": "unit"}}}},
                                                                                    "type": {"pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": "unit"}}}},
                                                                                "argument": {"variable": "acc"}}},
                                                                            "argument": {
                                                                              "lambda": {
                                                                                "parameter": "accR",
                                                                                "domain": {"pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": "unit"}},
                                                                                "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": "unit"}},
                                                                                            "argument": {"variable": "accR"}}},
                                                                                        "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Type"}}, "constraints": []}}],
                                                                                    "body": {
                                                                                      "application": {
                                                                                        "function": {
                                                                                          "application": {
                                                                                            "function": {
                                                                                              "typeApplication": {
                                                                                                "body": {
                                                                                                  "typeApplication": {
                                                                                                    "body": {
                                                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.eithers.bind"}, "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                                    "type": {"variable": "hydra.core.model.Type"}}},
                                                                                                "type": {"pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": "unit"}}}},
                                                                                            "argument": {"application": {"function": {"variable": "bindingType"}, "argument": {"variable": "b"}}}}},
                                                                                        "argument": {
                                                                                          "lambda": {
                                                                                            "parameter": "btype",
                                                                                            "domain": {"variable": "hydra.core.model.Type"},
                                                                                            "body": {
                                                                                              "typeApplication": {
                                                                                                "body": {
                                                                                                  "typeApplication": {
                                                                                                    "body": {
                                                                                                      "either": {
                                                                                                        "right": {
                                                                                                          "typeApplication": {
                                                                                                            "body": {
                                                                                                              "typeApplication": {
                                                                                                                "body": {
                                                                                                                  "pair": {
                                                                                                                    "first": {
                                                                                                                      "application": {
                                                                                                                        "function": {
                                                                                                                          "application": {
                                                                                                                            "function": {
                                                                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.lists.concat2"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                                                                            "argument": {"variable": "types"}}},
                                                                                                                        "argument": {
                                                                                                                          "application": {
                                                                                                                            "function": {
                                                                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.lists.singleton"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                                                                            "argument": {"variable": "btype"}}}}},
                                                                                                                    "second": "unit"}},
                                                                                                                "type": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                                                                            "type": "unit"}}}},
                                                                                                    "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                                "type": {"pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": "unit"}}}}}}}}}}}}}}}}}}}},
                                                            "argument": {
                                                              "typeApplication": {
                                                                "body": {
                                                                  "typeApplication": {
                                                                    "body": {
                                                                      "either": {
                                                                        "right": {
                                                                          "typeApplication": {
                                                                            "body": {
                                                                              "typeApplication": {
                                                                                "body": {
                                                                                  "pair": {"first": {"typeApplication": {"body": {"list": []}, "type": {"variable": "hydra.core.model.Type"}}}, "second": "unit"}},
                                                                                "type": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                                            "type": "unit"}}}},
                                                                    "type": {"variable": "hydra.core.errors.Error"}}},
                                                                "type": {"pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": "unit"}}}}}},
                                                        "argument": {"variable": "bs"}}},
                                                    "typeScheme": {
                                                      "variables": [],
                                                      "body": {
                                                        "either": {
                                                          "left": {"variable": "hydra.core.errors.Error"},
                                                          "right": {"pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": "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": {"pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": "unit"}}}},
                                                            "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                        "argument": {"variable": "btypesResult"}}},
                                                    "argument": {
                                                      "lambda": {
                                                        "parameter": "btypesR",
                                                        "domain": {"pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": "unit"}},
                                                        "body": {
                                                          "let": {
                                                            "bindings": [
                                                              {
                                                                "name": "btypes",
                                                                "term": {
                                                                  "application": {
                                                                    "function": {
                                                                      "typeApplication": {
                                                                        "body": {
                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                                        "type": "unit"}},
                                                                    "argument": {"variable": "btypesR"}}},
                                                                "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Type"}}, "constraints": []}}],
                                                            "body": {
                                                              "let": {
                                                                "bindings": [
                                                                  {
                                                                    "name": "tx2",
                                                                    "term": {
                                                                      "record": {
                                                                        "typeName": "hydra.core.graph.Graph",
                                                                        "fields": [
                                                                          {
                                                                            "name": "boundTerms",
                                                                            "term": {
                                                                              "application": {
                                                                                "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "boundTerms"}},
                                                                                "argument": {"variable": "tx"}}}},
                                                                          {
                                                                            "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": {
                                                                                          "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": {"variable": "hydra.core.scoping.fTypeToTypeScheme"}}},
                                                                                                "argument": {"variable": "btypes"}}}}}}}}},
                                                                                "argument": {
                                                                                  "application": {
                                                                                    "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "boundTypes"}},
                                                                                    "argument": {"variable": "tx"}}}}}},
                                                                          {
                                                                            "name": "classConstraints",
                                                                            "term": {
                                                                              "application": {
                                                                                "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "classConstraints"}},
                                                                                "argument": {"variable": "tx"}}}},
                                                                          {
                                                                            "name": "lambdaVariables",
                                                                            "term": {
                                                                              "application": {
                                                                                "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "lambdaVariables"}},
                                                                                "argument": {"variable": "tx"}}}},
                                                                          {
                                                                            "name": "metadata",
                                                                            "term": {
                                                                              "application": {
                                                                                "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "metadata"}},
                                                                                "argument": {"variable": "tx"}}}},
                                                                          {
                                                                            "name": "primitives",
                                                                            "term": {
                                                                              "application": {
                                                                                "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "primitives"}},
                                                                                "argument": {"variable": "tx"}}}},
                                                                          {
                                                                            "name": "schemaTypes",
                                                                            "term": {
                                                                              "application": {
                                                                                "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "schemaTypes"}},
                                                                                "argument": {"variable": "tx"}}}},
                                                                          {
                                                                            "name": "typeVariables",
                                                                            "term": {
                                                                              "application": {
                                                                                "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "typeVariables"}},
                                                                                "argument": {"variable": "tx"}}}}]}},
                                                                    "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": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                            "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                        "argument": {
                                                                          "application": {
                                                                            "function": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "application": {
                                                                                    "function": {"application": {"function": {"variable": "hydra.core.checking.typeOf"}, "argument": {"variable": "cx"}}},
                                                                                    "argument": {"variable": "tx2"}}},
                                                                                "argument": {"typeApplication": {"body": {"list": []}, "type": {"variable": "hydra.core.model.Type"}}}}},
                                                                            "argument": {"variable": "body"}}}}},
                                                                    "argument": {
                                                                      "lambda": {
                                                                        "parameter": "tResult",
                                                                        "domain": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                        "body": {
                                                                          "let": {
                                                                            "bindings": [
                                                                              {
                                                                                "name": "t",
                                                                                "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": "tResult"}}},
                                                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
                                                                            "body": {
                                                                              "let": {
                                                                                "bindings": [
                                                                                  {
                                                                                    "name": "cx2",
                                                                                    "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": "tResult"}}},
                                                                                    "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.model.Type"}}},
                                                                                            "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                        "argument": {
                                                                                          "application": {
                                                                                            "function": {
                                                                                              "application": {
                                                                                                "function": {
                                                                                                  "application": {
                                                                                                    "function": {
                                                                                                      "application": {"function": {"variable": "hydra.core.checking.applyTypeArgumentsToType"}, "argument": {"variable": "cx2"}}},
                                                                                                    "argument": {"variable": "tx"}}},
                                                                                                "argument": {"variable": "typeArgs"}}},
                                                                                            "argument": {"variable": "t"}}}}},
                                                                                    "argument": {
                                                                                      "lambda": {
                                                                                        "parameter": "applied",
                                                                                        "domain": {"variable": "hydra.core.model.Type"},
                                                                                        "body": {
                                                                                          "typeApplication": {
                                                                                            "body": {
                                                                                              "typeApplication": {
                                                                                                "body": {
                                                                                                  "either": {
                                                                                                    "right": {
                                                                                                      "typeApplication": {
                                                                                                        "body": {
                                                                                                          "typeApplication": {
                                                                                                            "body": {"pair": {"first": {"variable": "applied"}, "second": {"variable": "cx2"}}},
                                                                                                            "type": {"variable": "hydra.core.model.Type"}}},
                                                                                                        "type": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                                "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                            "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {
                    "literal": {
                      "string": "Reconstruct the type of a let binding (Either/InferenceContext version). Paper: inference.tex, rule Let (checking side)."}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.checking.typeOfList",
        "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.Type"}}, "isLazy": false},
            {"name": "arg3", "type": {"list": {"variable": "hydra.core.model.Term"}}, "isLazy": false}],
          "result": {
            "type": {
              "either": {
                "left": {"variable": "hydra.core.errors.Error"},
                "right": {"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": {
                  "lambda": {
                    "parameter": "tx",
                    "domain": {"variable": "hydra.core.graph.Graph"},
                    "body": {
                      "lambda": {
                        "parameter": "typeArgs",
                        "domain": {"list": {"variable": "hydra.core.model.Type"}},
                        "body": {
                          "lambda": {
                            "parameter": "els",
                            "domain": {"list": {"variable": "hydra.core.model.Term"}},
                            "body": {
                              "let": {
                                "bindings": [
                                  {
                                    "name": "listArityErr",
                                    "term": {
                                      "typeLambda": {
                                        "parameter": "t0",
                                        "body": {
                                          "typeApplication": {
                                            "body": {
                                              "typeApplication": {
                                                "body": {
                                                  "either": {
                                                    "left": {
                                                      "inject": {
                                                        "typeName": "hydra.core.errors.Error",
                                                        "field": {
                                                          "name": "checking",
                                                          "term": {
                                                            "inject": {
                                                              "typeName": "hydra.core.error.checking.CheckingError",
                                                              "field": {
                                                                "name": "typeArityMismatch",
                                                                "term": {
                                                                  "record": {
                                                                    "typeName": "hydra.core.error.checking.TypeArityMismatchError",
                                                                    "fields": [
                                                                      {
                                                                        "name": "type",
                                                                        "term": {
                                                                          "inject": {
                                                                            "typeName": "hydra.core.model.Type",
                                                                            "field": {"name": "list", "term": {"inject": {"typeName": "hydra.core.model.Type", "field": {"name": "unit", "term": "unit"}}}}}}},
                                                                      {"name": "expectedArity", "term": {"literal": {"integer": {"int32": 1}}}},
                                                                      {
                                                                        "name": "actualArity",
                                                                        "term": {
                                                                          "application": {
                                                                            "function": {
                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.lists.length"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                            "argument": {"variable": "typeArgs"}}}},
                                                                      {"name": "typeArguments", "term": {"variable": "typeArgs"}}]}}}}}}}}}},
                                                "type": {"variable": "hydra.core.errors.Error"}}},
                                            "type": {"variable": "t0"}}}}},
                                    "typeScheme": {
                                      "variables": ["t0"],
                                      "body": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "t0"}}},
                                      "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": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}},
                                            "argument": {
                                              "application": {
                                                "function": {
                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.lists.isEmpty"}, "type": {"variable": "hydra.core.model.Term"}}},
                                                "argument": {"variable": "els"}}}}},
                                        "argument": {
                                          "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": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}},
                                                    "argument": {
                                                      "application": {
                                                        "function": {
                                                          "application": {
                                                            "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.equality.equal"}, "type": {"literal": {"integer": "int32"}}}},
                                                            "argument": {
                                                              "application": {
                                                                "function": {
                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.lists.length"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                "argument": {"variable": "typeArgs"}}}}},
                                                        "argument": {"literal": {"integer": {"int32": 1}}}}}}},
                                                "argument": {
                                                  "application": {
                                                    "function": {
                                                      "application": {
                                                        "function": {
                                                          "application": {
                                                            "function": {
                                                              "typeApplication": {
                                                                "body": {
                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.optionals.match"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                "type": {
                                                                  "either": {
                                                                    "left": {"variable": "hydra.core.errors.Error"},
                                                                    "right": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}},
                                                            "argument": {
                                                              "application": {
                                                                "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.head"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                "argument": {"variable": "typeArgs"}}}}},
                                                        "argument": {
                                                          "typeApplication": {
                                                            "body": {"variable": "listArityErr"},
                                                            "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}},
                                                    "argument": {
                                                      "lambda": {
                                                        "parameter": "ta0",
                                                        "domain": {"variable": "hydra.core.model.Type"},
                                                        "body": {
                                                          "typeApplication": {
                                                            "body": {
                                                              "typeApplication": {
                                                                "body": {
                                                                  "either": {
                                                                    "right": {
                                                                      "typeApplication": {
                                                                        "body": {
                                                                          "typeApplication": {
                                                                            "body": {
                                                                              "pair": {
                                                                                "first": {"inject": {"typeName": "hydra.core.model.Type", "field": {"name": "list", "term": {"variable": "ta0"}}}},
                                                                                "second": {"variable": "cx"}}},
                                                                            "type": {"variable": "hydra.core.model.Type"}}},
                                                                        "type": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                "type": {"variable": "hydra.core.errors.Error"}}},
                                                            "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}}}}}},
                                            "argument": {
                                              "typeApplication": {
                                                "body": {"variable": "listArityErr"},
                                                "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}}}},
                                    "argument": {
                                      "let": {
                                        "bindings": [
                                          {
                                            "name": "foldResult",
                                            "term": {
                                              "application": {
                                                "function": {
                                                  "application": {
                                                    "function": {
                                                      "application": {
                                                        "function": {
                                                          "typeApplication": {
                                                            "body": {
                                                              "typeApplication": {
                                                                "body": {"variable": "hydra.core.lib.lists.foldl"},
                                                                "type": {
                                                                  "either": {
                                                                    "left": {"variable": "hydra.core.errors.Error"},
                                                                    "right": {
                                                                      "pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}},
                                                            "type": {"variable": "hydra.core.model.Term"}}},
                                                        "argument": {
                                                          "lambda": {
                                                            "parameter": "acc",
                                                            "domain": {
                                                              "either": {
                                                                "left": {"variable": "hydra.core.errors.Error"},
                                                                "right": {
                                                                  "pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                            "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": {
                                                                                  "pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                            "type": {
                                                                              "pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                        "argument": {"variable": "acc"}}},
                                                                    "argument": {
                                                                      "lambda": {
                                                                        "parameter": "accR",
                                                                        "domain": {
                                                                          "pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                        "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": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                    "argument": {"variable": "accR"}}},
                                                                                "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Type"}}, "constraints": []}}],
                                                                            "body": {
                                                                              "let": {
                                                                                "bindings": [
                                                                                  {
                                                                                    "name": "cxA",
                                                                                    "term": {
                                                                                      "application": {
                                                                                        "function": {
                                                                                          "typeApplication": {
                                                                                            "body": {
                                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                                                            "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                        "argument": {"variable": "accR"}}},
                                                                                    "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.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                            "type": {
                                                                                              "pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                        "argument": {
                                                                                          "application": {
                                                                                            "function": {
                                                                                              "application": {
                                                                                                "function": {
                                                                                                  "application": {
                                                                                                    "function": {"application": {"function": {"variable": "hydra.core.checking.typeOf"}, "argument": {"variable": "cxA"}}},
                                                                                                    "argument": {"variable": "tx"}}},
                                                                                                "argument": {"typeApplication": {"body": {"list": []}, "type": {"variable": "hydra.core.model.Type"}}}}},
                                                                                            "argument": {"variable": "term"}}}}},
                                                                                    "argument": {
                                                                                      "lambda": {
                                                                                        "parameter": "tResult",
                                                                                        "domain": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                        "body": {
                                                                                          "let": {
                                                                                            "bindings": [
                                                                                              {
                                                                                                "name": "t",
                                                                                                "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": "tResult"}}},
                                                                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
                                                                                            "body": {
                                                                                              "let": {
                                                                                                "bindings": [
                                                                                                  {
                                                                                                    "name": "cxB",
                                                                                                    "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": "tResult"}}},
                                                                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "constraints": []}}],
                                                                                                "body": {
                                                                                                  "typeApplication": {
                                                                                                    "body": {
                                                                                                      "typeApplication": {
                                                                                                        "body": {
                                                                                                          "either": {
                                                                                                            "right": {
                                                                                                              "typeApplication": {
                                                                                                                "body": {
                                                                                                                  "typeApplication": {
                                                                                                                    "body": {
                                                                                                                      "pair": {
                                                                                                                        "first": {
                                                                                                                          "application": {
                                                                                                                            "function": {
                                                                                                                              "application": {
                                                                                                                                "function": {
                                                                                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.lists.concat2"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                                                                                "argument": {"variable": "types"}}},
                                                                                                                            "argument": {
                                                                                                                              "application": {
                                                                                                                                "function": {
                                                                                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.lists.singleton"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                                                                                "argument": {"variable": "t"}}}}},
                                                                                                                        "second": {"variable": "cxB"}}},
                                                                                                                    "type": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                                                                                "type": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                                        "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                                    "type": {
                                                                                                      "pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}}}}}}}}}}}}}}}}}}}}}},
                                                    "argument": {
                                                      "typeApplication": {
                                                        "body": {
                                                          "typeApplication": {
                                                            "body": {
                                                              "either": {
                                                                "right": {
                                                                  "typeApplication": {
                                                                    "body": {
                                                                      "typeApplication": {
                                                                        "body": {
                                                                          "pair": {
                                                                            "first": {"typeApplication": {"body": {"list": []}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                            "second": {"variable": "cx"}}},
                                                                        "type": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                                    "type": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                            "type": {"variable": "hydra.core.errors.Error"}}},
                                                        "type": {
                                                          "pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}},
                                                "argument": {"variable": "els"}}},
                                            "typeScheme": {
                                              "variables": [],
                                              "body": {
                                                "either": {
                                                  "left": {"variable": "hydra.core.errors.Error"},
                                                  "right": {
                                                    "pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"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": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                    "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                "argument": {"variable": "foldResult"}}},
                                            "argument": {
                                              "lambda": {
                                                "parameter": "foldR",
                                                "domain": {
                                                  "pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                "body": {
                                                  "let": {
                                                    "bindings": [
                                                      {
                                                        "name": "eltypes",
                                                        "term": {
                                                          "application": {
                                                            "function": {
                                                              "typeApplication": {
                                                                "body": {
                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                                "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                            "argument": {"variable": "foldR"}}},
                                                        "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Type"}}, "constraints": []}}],
                                                    "body": {
                                                      "let": {
                                                        "bindings": [
                                                          {
                                                            "name": "cx2",
                                                            "term": {
                                                              "application": {
                                                                "function": {
                                                                  "typeApplication": {
                                                                    "body": {
                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                                    "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                "argument": {"variable": "foldR"}}},
                                                            "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.model.Type"}}},
                                                                    "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                "argument": {
                                                                  "application": {
                                                                    "function": {
                                                                      "application": {
                                                                        "function": {
                                                                          "application": {
                                                                            "function": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "typeApplication": {"body": {"variable": "hydra.core.checking.checkSameType"}, "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                "argument": {"variable": "cx2"}}},
                                                                            "argument": {"variable": "tx"}}},
                                                                        "argument": {"literal": {"string": "list elements"}}}},
                                                                    "argument": {"variable": "eltypes"}}}}},
                                                            "argument": {
                                                              "lambda": {
                                                                "parameter": "unifiedType",
                                                                "domain": {"variable": "hydra.core.model.Type"},
                                                                "body": {
                                                                  "typeApplication": {
                                                                    "body": {
                                                                      "typeApplication": {
                                                                        "body": {
                                                                          "either": {
                                                                            "right": {
                                                                              "typeApplication": {
                                                                                "body": {
                                                                                  "typeApplication": {
                                                                                    "body": {
                                                                                      "pair": {
                                                                                        "first": {"inject": {"typeName": "hydra.core.model.Type", "field": {"name": "list", "term": {"variable": "unifiedType"}}}},
                                                                                        "second": {"variable": "cx2"}}},
                                                                                    "type": {"variable": "hydra.core.model.Type"}}},
                                                                                "type": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                        "type": {"variable": "hydra.core.errors.Error"}}},
                                                                    "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {
                    "literal": {
                      "string": "Reconstruct the type of a list (Either/InferenceContext version). Paper: inference.tex, rules Lst_0 and Lst_+ (checking side)."}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.checking.typeOfLiteral",
        "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.Type"}}, "isLazy": false},
            {"name": "arg3", "type": {"variable": "hydra.core.model.Literal"}, "isLazy": false}],
          "result": {
            "type": {
              "either": {
                "left": {"variable": "hydra.core.errors.Error"},
                "right": {"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": {
                  "lambda": {
                    "parameter": "tx",
                    "domain": {"variable": "hydra.core.graph.Graph"},
                    "body": {
                      "lambda": {
                        "parameter": "typeArgs",
                        "domain": {"list": {"variable": "hydra.core.model.Type"}},
                        "body": {
                          "lambda": {
                            "parameter": "lit",
                            "domain": {"variable": "hydra.core.model.Literal"},
                            "body": {
                              "let": {
                                "bindings": [
                                  {
                                    "name": "t",
                                    "term": {
                                      "inject": {
                                        "typeName": "hydra.core.model.Type",
                                        "field": {
                                          "name": "literal",
                                          "term": {"application": {"function": {"variable": "hydra.core.reflect.literalType"}, "argument": {"variable": "lit"}}}}}},
                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
                                "body": {
                                  "application": {
                                    "function": {
                                      "application": {
                                        "function": {
                                          "typeApplication": {
                                            "body": {
                                              "typeApplication": {
                                                "body": {
                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.eithers.bind"}, "type": {"variable": "hydra.core.errors.Error"}}},
                                                "type": {"variable": "hydra.core.model.Type"}}},
                                            "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                        "argument": {
                                          "application": {
                                            "function": {
                                              "application": {
                                                "function": {
                                                  "application": {
                                                    "function": {
                                                      "application": {"function": {"variable": "hydra.core.checking.applyTypeArgumentsToType"}, "argument": {"variable": "cx"}}},
                                                    "argument": {"variable": "tx"}}},
                                                "argument": {"variable": "typeArgs"}}},
                                            "argument": {"variable": "t"}}}}},
                                    "argument": {
                                      "lambda": {
                                        "parameter": "applied",
                                        "domain": {"variable": "hydra.core.model.Type"},
                                        "body": {
                                          "typeApplication": {
                                            "body": {
                                              "typeApplication": {
                                                "body": {
                                                  "either": {
                                                    "right": {
                                                      "typeApplication": {
                                                        "body": {
                                                          "typeApplication": {
                                                            "body": {"pair": {"first": {"variable": "applied"}, "second": {"variable": "cx"}}},
                                                            "type": {"variable": "hydra.core.model.Type"}}},
                                                        "type": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                "type": {"variable": "hydra.core.errors.Error"}}},
                                            "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}}}}}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {
                    "literal": {
                      "string": "Reconstruct the type of a literal (Either/InferenceContext version). Paper: inference.tex, rule Lit (checking side)."}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.checking.typeOfMap",
        "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.Type"}}, "isLazy": false},
            {
              "name": "arg3",
              "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": {"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": {
                  "lambda": {
                    "parameter": "tx",
                    "domain": {"variable": "hydra.core.graph.Graph"},
                    "body": {
                      "lambda": {
                        "parameter": "typeArgs",
                        "domain": {"list": {"variable": "hydra.core.model.Type"}},
                        "body": {
                          "lambda": {
                            "parameter": "m",
                            "domain": {"map": {"keys": {"variable": "hydra.core.model.Term"}, "values": {"variable": "hydra.core.model.Term"}}},
                            "body": {
                              "let": {
                                "bindings": [
                                  {
                                    "name": "mapArityErr",
                                    "term": {
                                      "typeLambda": {
                                        "parameter": "t0",
                                        "body": {
                                          "typeApplication": {
                                            "body": {
                                              "typeApplication": {
                                                "body": {
                                                  "either": {
                                                    "left": {
                                                      "inject": {
                                                        "typeName": "hydra.core.errors.Error",
                                                        "field": {
                                                          "name": "checking",
                                                          "term": {
                                                            "inject": {
                                                              "typeName": "hydra.core.error.checking.CheckingError",
                                                              "field": {
                                                                "name": "typeArityMismatch",
                                                                "term": {
                                                                  "record": {
                                                                    "typeName": "hydra.core.error.checking.TypeArityMismatchError",
                                                                    "fields": [
                                                                      {
                                                                        "name": "type",
                                                                        "term": {
                                                                          "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": "unit", "term": "unit"}}}},
                                                                                    {"name": "values", "term": {"inject": {"typeName": "hydra.core.model.Type", "field": {"name": "unit", "term": "unit"}}}}]}}}}}},
                                                                      {"name": "expectedArity", "term": {"literal": {"integer": {"int32": 2}}}},
                                                                      {
                                                                        "name": "actualArity",
                                                                        "term": {
                                                                          "application": {
                                                                            "function": {
                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.lists.length"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                            "argument": {"variable": "typeArgs"}}}},
                                                                      {"name": "typeArguments", "term": {"variable": "typeArgs"}}]}}}}}}}}}},
                                                "type": {"variable": "hydra.core.errors.Error"}}},
                                            "type": {"variable": "t0"}}}}},
                                    "typeScheme": {
                                      "variables": ["t0"],
                                      "body": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "t0"}}},
                                      "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": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}},
                                            "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": {
                                          "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": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}},
                                                    "argument": {
                                                      "application": {
                                                        "function": {
                                                          "application": {
                                                            "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.equality.equal"}, "type": {"literal": {"integer": "int32"}}}},
                                                            "argument": {
                                                              "application": {
                                                                "function": {
                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.lists.length"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                "argument": {"variable": "typeArgs"}}}}},
                                                        "argument": {"literal": {"integer": {"int32": 2}}}}}}},
                                                "argument": {
                                                  "application": {
                                                    "function": {
                                                      "application": {
                                                        "function": {
                                                          "application": {
                                                            "function": {
                                                              "typeApplication": {
                                                                "body": {
                                                                  "typeApplication": {
                                                                    "body": {"variable": "hydra.core.lib.optionals.match"},
                                                                    "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"list": {"variable": "hydra.core.model.Type"}}}}}},
                                                                "type": {
                                                                  "either": {
                                                                    "left": {"variable": "hydra.core.errors.Error"},
                                                                    "right": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}},
                                                            "argument": {
                                                              "application": {
                                                                "function": {
                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.lists.uncons"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                "argument": {"variable": "typeArgs"}}}}},
                                                        "argument": {
                                                          "typeApplication": {
                                                            "body": {"variable": "mapArityErr"},
                                                            "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}},
                                                    "argument": {
                                                      "lambda": {
                                                        "parameter": "uc0",
                                                        "domain": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                        "body": {
                                                          "let": {
                                                            "bindings": [
                                                              {
                                                                "name": "ta0",
                                                                "term": {
                                                                  "application": {
                                                                    "function": {
                                                                      "typeApplication": {
                                                                        "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                        "type": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                                    "argument": {"variable": "uc0"}}},
                                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "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.Type"}, "second": {"list": {"variable": "hydra.core.model.Type"}}}}}},
                                                                            "type": {
                                                                              "either": {
                                                                                "left": {"variable": "hydra.core.errors.Error"},
                                                                                "right": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}},
                                                                        "argument": {
                                                                          "application": {
                                                                            "function": {
                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.lists.uncons"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                            "argument": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "typeApplication": {
                                                                                    "body": {
                                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                                    "type": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                                                "argument": {"variable": "uc0"}}}}}}},
                                                                    "argument": {
                                                                      "typeApplication": {
                                                                        "body": {"variable": "mapArityErr"},
                                                                        "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}},
                                                                "argument": {
                                                                  "lambda": {
                                                                    "parameter": "uc1",
                                                                    "domain": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                                    "body": {
                                                                      "let": {
                                                                        "bindings": [
                                                                          {
                                                                            "name": "ta1",
                                                                            "term": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "typeApplication": {
                                                                                    "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                                    "type": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                                                "argument": {"variable": "uc1"}}},
                                                                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
                                                                        "body": {
                                                                          "typeApplication": {
                                                                            "body": {
                                                                              "typeApplication": {
                                                                                "body": {
                                                                                  "either": {
                                                                                    "right": {
                                                                                      "typeApplication": {
                                                                                        "body": {
                                                                                          "typeApplication": {
                                                                                            "body": {
                                                                                              "pair": {
                                                                                                "first": {
                                                                                                  "inject": {
                                                                                                    "typeName": "hydra.core.model.Type",
                                                                                                    "field": {
                                                                                                      "name": "map",
                                                                                                      "term": {
                                                                                                        "record": {
                                                                                                          "typeName": "hydra.core.model.MapType",
                                                                                                          "fields": [{"name": "keys", "term": {"variable": "ta0"}}, {"name": "values", "term": {"variable": "ta1"}}]}}}}},
                                                                                                "second": {"variable": "cx"}}},
                                                                                            "type": {"variable": "hydra.core.model.Type"}}},
                                                                                        "type": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                "type": {"variable": "hydra.core.errors.Error"}}},
                                                                            "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}}}}}}}}}}}}}},
                                            "argument": {
                                              "typeApplication": {
                                                "body": {"variable": "mapArityErr"},
                                                "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}}}},
                                    "argument": {
                                      "let": {
                                        "bindings": [
                                          {
                                            "name": "pairs",
                                            "term": {
                                              "application": {
                                                "function": {
                                                  "typeApplication": {
                                                    "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.toList"}, "type": {"variable": "hydra.core.model.Term"}}},
                                                    "type": {"variable": "hydra.core.model.Term"}}},
                                                "argument": {"variable": "m"}}},
                                            "typeScheme": {
                                              "variables": [],
                                              "body": {"list": {"pair": {"first": {"variable": "hydra.core.model.Term"}, "second": {"variable": "hydra.core.model.Term"}}}},
                                              "constraints": []}}],
                                        "body": {
                                          "let": {
                                            "bindings": [
                                              {
                                                "name": "keyFoldResult",
                                                "term": {
                                                  "application": {
                                                    "function": {
                                                      "application": {
                                                        "function": {
                                                          "application": {
                                                            "function": {
                                                              "typeApplication": {
                                                                "body": {
                                                                  "typeApplication": {
                                                                    "body": {"variable": "hydra.core.lib.lists.foldl"},
                                                                    "type": {
                                                                      "either": {
                                                                        "left": {"variable": "hydra.core.errors.Error"},
                                                                        "right": {
                                                                          "pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}},
                                                                "type": {"pair": {"first": {"variable": "hydra.core.model.Term"}, "second": {"variable": "hydra.core.model.Term"}}}}},
                                                            "argument": {
                                                              "lambda": {
                                                                "parameter": "acc",
                                                                "domain": {
                                                                  "either": {
                                                                    "left": {"variable": "hydra.core.errors.Error"},
                                                                    "right": {
                                                                      "pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                "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": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                "type": {
                                                                                  "pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                            "argument": {"variable": "acc"}}},
                                                                        "argument": {
                                                                          "lambda": {
                                                                            "parameter": "accR",
                                                                            "domain": {
                                                                              "pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                            "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": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                        "argument": {"variable": "accR"}}},
                                                                                    "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Type"}}, "constraints": []}}],
                                                                                "body": {
                                                                                  "let": {
                                                                                    "bindings": [
                                                                                      {
                                                                                        "name": "cxA",
                                                                                        "term": {
                                                                                          "application": {
                                                                                            "function": {
                                                                                              "typeApplication": {
                                                                                                "body": {
                                                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                                                                "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                            "argument": {"variable": "accR"}}},
                                                                                        "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.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                                "type": {
                                                                                                  "pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                            "argument": {
                                                                                              "application": {
                                                                                                "function": {
                                                                                                  "application": {
                                                                                                    "function": {
                                                                                                      "application": {
                                                                                                        "function": {"application": {"function": {"variable": "hydra.core.checking.typeOf"}, "argument": {"variable": "cxA"}}},
                                                                                                        "argument": {"variable": "tx"}}},
                                                                                                    "argument": {"typeApplication": {"body": {"list": []}, "type": {"variable": "hydra.core.model.Type"}}}}},
                                                                                                "argument": {
                                                                                                  "application": {
                                                                                                    "function": {
                                                                                                      "typeApplication": {
                                                                                                        "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"variable": "hydra.core.model.Term"}}},
                                                                                                        "type": {"variable": "hydra.core.model.Term"}}},
                                                                                                    "argument": {"variable": "p"}}}}}}},
                                                                                        "argument": {
                                                                                          "lambda": {
                                                                                            "parameter": "tResult",
                                                                                            "domain": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                            "body": {
                                                                                              "let": {
                                                                                                "bindings": [
                                                                                                  {
                                                                                                    "name": "t",
                                                                                                    "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": "tResult"}}},
                                                                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
                                                                                                "body": {
                                                                                                  "let": {
                                                                                                    "bindings": [
                                                                                                      {
                                                                                                        "name": "cxB",
                                                                                                        "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": "tResult"}}},
                                                                                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "constraints": []}}],
                                                                                                    "body": {
                                                                                                      "typeApplication": {
                                                                                                        "body": {
                                                                                                          "typeApplication": {
                                                                                                            "body": {
                                                                                                              "either": {
                                                                                                                "right": {
                                                                                                                  "typeApplication": {
                                                                                                                    "body": {
                                                                                                                      "typeApplication": {
                                                                                                                        "body": {
                                                                                                                          "pair": {
                                                                                                                            "first": {
                                                                                                                              "application": {
                                                                                                                                "function": {
                                                                                                                                  "application": {
                                                                                                                                    "function": {
                                                                                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.lists.concat2"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                                                                                    "argument": {"variable": "types"}}},
                                                                                                                                "argument": {
                                                                                                                                  "application": {
                                                                                                                                    "function": {
                                                                                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.lists.singleton"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                                                                                    "argument": {"variable": "t"}}}}},
                                                                                                                            "second": {"variable": "cxB"}}},
                                                                                                                        "type": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                                                                                    "type": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                                            "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                                        "type": {
                                                                                                          "pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}}}}}}}}}}}}}}}}}}}}}},
                                                        "argument": {
                                                          "typeApplication": {
                                                            "body": {
                                                              "typeApplication": {
                                                                "body": {
                                                                  "either": {
                                                                    "right": {
                                                                      "typeApplication": {
                                                                        "body": {
                                                                          "typeApplication": {
                                                                            "body": {
                                                                              "pair": {
                                                                                "first": {"typeApplication": {"body": {"list": []}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                                "second": {"variable": "cx"}}},
                                                                            "type": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                                        "type": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                "type": {"variable": "hydra.core.errors.Error"}}},
                                                            "type": {
                                                              "pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}},
                                                    "argument": {"variable": "pairs"}}},
                                                "typeScheme": {
                                                  "variables": [],
                                                  "body": {
                                                    "either": {
                                                      "left": {"variable": "hydra.core.errors.Error"},
                                                      "right": {
                                                        "pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"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": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                        "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                    "argument": {"variable": "keyFoldResult"}}},
                                                "argument": {
                                                  "lambda": {
                                                    "parameter": "keyFoldR",
                                                    "domain": {
                                                      "pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                    "body": {
                                                      "let": {
                                                        "bindings": [
                                                          {
                                                            "name": "keyTypes",
                                                            "term": {
                                                              "application": {
                                                                "function": {
                                                                  "typeApplication": {
                                                                    "body": {
                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                                    "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                "argument": {"variable": "keyFoldR"}}},
                                                            "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Type"}}, "constraints": []}}],
                                                        "body": {
                                                          "let": {
                                                            "bindings": [
                                                              {
                                                                "name": "cx2",
                                                                "term": {
                                                                  "application": {
                                                                    "function": {
                                                                      "typeApplication": {
                                                                        "body": {
                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                                        "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                    "argument": {"variable": "keyFoldR"}}},
                                                                "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.model.Type"}}},
                                                                        "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                    "argument": {
                                                                      "application": {
                                                                        "function": {
                                                                          "application": {
                                                                            "function": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "application": {
                                                                                    "function": {
                                                                                      "typeApplication": {"body": {"variable": "hydra.core.checking.checkSameType"}, "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                    "argument": {"variable": "cx2"}}},
                                                                                "argument": {"variable": "tx"}}},
                                                                            "argument": {"literal": {"string": "map keys"}}}},
                                                                        "argument": {"variable": "keyTypes"}}}}},
                                                                "argument": {
                                                                  "lambda": {
                                                                    "parameter": "kt",
                                                                    "domain": {"variable": "hydra.core.model.Type"},
                                                                    "body": {
                                                                      "let": {
                                                                        "bindings": [
                                                                          {
                                                                            "name": "valFoldResult",
                                                                            "term": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "application": {
                                                                                    "function": {
                                                                                      "application": {
                                                                                        "function": {
                                                                                          "typeApplication": {
                                                                                            "body": {
                                                                                              "typeApplication": {
                                                                                                "body": {"variable": "hydra.core.lib.lists.foldl"},
                                                                                                "type": {
                                                                                                  "either": {
                                                                                                    "left": {"variable": "hydra.core.errors.Error"},
                                                                                                    "right": {
                                                                                                      "pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}},
                                                                                            "type": {"pair": {"first": {"variable": "hydra.core.model.Term"}, "second": {"variable": "hydra.core.model.Term"}}}}},
                                                                                        "argument": {
                                                                                          "lambda": {
                                                                                            "parameter": "acc",
                                                                                            "domain": {
                                                                                              "either": {
                                                                                                "left": {"variable": "hydra.core.errors.Error"},
                                                                                                "right": {
                                                                                                  "pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                            "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": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                                            "type": {
                                                                                                              "pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                                        "argument": {"variable": "acc"}}},
                                                                                                    "argument": {
                                                                                                      "lambda": {
                                                                                                        "parameter": "accR",
                                                                                                        "domain": {
                                                                                                          "pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                                        "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": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                                                    "argument": {"variable": "accR"}}},
                                                                                                                "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Type"}}, "constraints": []}}],
                                                                                                            "body": {
                                                                                                              "let": {
                                                                                                                "bindings": [
                                                                                                                  {
                                                                                                                    "name": "cxA",
                                                                                                                    "term": {
                                                                                                                      "application": {
                                                                                                                        "function": {
                                                                                                                          "typeApplication": {
                                                                                                                            "body": {
                                                                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                                                                                            "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                                                        "argument": {"variable": "accR"}}},
                                                                                                                    "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.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                                                            "type": {
                                                                                                                              "pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                                                        "argument": {
                                                                                                                          "application": {
                                                                                                                            "function": {
                                                                                                                              "application": {
                                                                                                                                "function": {
                                                                                                                                  "application": {
                                                                                                                                    "function": {"application": {"function": {"variable": "hydra.core.checking.typeOf"}, "argument": {"variable": "cxA"}}},
                                                                                                                                    "argument": {"variable": "tx"}}},
                                                                                                                                "argument": {"typeApplication": {"body": {"list": []}, "type": {"variable": "hydra.core.model.Type"}}}}},
                                                                                                                            "argument": {
                                                                                                                              "application": {
                                                                                                                                "function": {
                                                                                                                                  "typeApplication": {
                                                                                                                                    "body": {
                                                                                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"variable": "hydra.core.model.Term"}}},
                                                                                                                                    "type": {"variable": "hydra.core.model.Term"}}},
                                                                                                                                "argument": {"variable": "p"}}}}}}},
                                                                                                                    "argument": {
                                                                                                                      "lambda": {
                                                                                                                        "parameter": "tResult",
                                                                                                                        "domain": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                                                        "body": {
                                                                                                                          "let": {
                                                                                                                            "bindings": [
                                                                                                                              {
                                                                                                                                "name": "t",
                                                                                                                                "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": "tResult"}}},
                                                                                                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
                                                                                                                            "body": {
                                                                                                                              "let": {
                                                                                                                                "bindings": [
                                                                                                                                  {
                                                                                                                                    "name": "cxB",
                                                                                                                                    "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": "tResult"}}},
                                                                                                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "constraints": []}}],
                                                                                                                                "body": {
                                                                                                                                  "typeApplication": {
                                                                                                                                    "body": {
                                                                                                                                      "typeApplication": {
                                                                                                                                        "body": {
                                                                                                                                          "either": {
                                                                                                                                            "right": {
                                                                                                                                              "typeApplication": {
                                                                                                                                                "body": {
                                                                                                                                                  "typeApplication": {
                                                                                                                                                    "body": {
                                                                                                                                                      "pair": {
                                                                                                                                                        "first": {
                                                                                                                                                          "application": {
                                                                                                                                                            "function": {
                                                                                                                                                              "application": {
                                                                                                                                                                "function": {
                                                                                                                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.lists.concat2"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                                                                                                                "argument": {"variable": "types"}}},
                                                                                                                                                            "argument": {
                                                                                                                                                              "application": {
                                                                                                                                                                "function": {
                                                                                                                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.lists.singleton"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                                                                                                                "argument": {"variable": "t"}}}}},
                                                                                                                                                        "second": {"variable": "cxB"}}},
                                                                                                                                                    "type": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                                                                                                                "type": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                                                                        "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                                                                    "type": {
                                                                                                                                      "pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}}}}}}}}}}}}}}}}}}}}}},
                                                                                    "argument": {
                                                                                      "typeApplication": {
                                                                                        "body": {
                                                                                          "typeApplication": {
                                                                                            "body": {
                                                                                              "either": {
                                                                                                "right": {
                                                                                                  "typeApplication": {
                                                                                                    "body": {
                                                                                                      "typeApplication": {
                                                                                                        "body": {
                                                                                                          "pair": {
                                                                                                            "first": {"typeApplication": {"body": {"list": []}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                                                            "second": {"variable": "cx2"}}},
                                                                                                        "type": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                                                                    "type": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                            "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                        "type": {
                                                                                          "pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}},
                                                                                "argument": {"variable": "pairs"}}},
                                                                            "typeScheme": {
                                                                              "variables": [],
                                                                              "body": {
                                                                                "either": {
                                                                                  "left": {"variable": "hydra.core.errors.Error"},
                                                                                  "right": {
                                                                                    "pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"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": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                    "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                "argument": {"variable": "valFoldResult"}}},
                                                                            "argument": {
                                                                              "lambda": {
                                                                                "parameter": "valFoldR",
                                                                                "domain": {
                                                                                  "pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                "body": {
                                                                                  "let": {
                                                                                    "bindings": [
                                                                                      {
                                                                                        "name": "valTypes",
                                                                                        "term": {
                                                                                          "application": {
                                                                                            "function": {
                                                                                              "typeApplication": {
                                                                                                "body": {
                                                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                                                                "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                            "argument": {"variable": "valFoldR"}}},
                                                                                        "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Type"}}, "constraints": []}}],
                                                                                    "body": {
                                                                                      "let": {
                                                                                        "bindings": [
                                                                                          {
                                                                                            "name": "cx3",
                                                                                            "term": {
                                                                                              "application": {
                                                                                                "function": {
                                                                                                  "typeApplication": {
                                                                                                    "body": {
                                                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                                                                    "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                                "argument": {"variable": "valFoldR"}}},
                                                                                            "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.model.Type"}}},
                                                                                                    "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                                "argument": {
                                                                                                  "application": {
                                                                                                    "function": {
                                                                                                      "application": {
                                                                                                        "function": {
                                                                                                          "application": {
                                                                                                            "function": {
                                                                                                              "application": {
                                                                                                                "function": {
                                                                                                                  "typeApplication": {"body": {"variable": "hydra.core.checking.checkSameType"}, "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                                                "argument": {"variable": "cx3"}}},
                                                                                                            "argument": {"variable": "tx"}}},
                                                                                                        "argument": {"literal": {"string": "map values"}}}},
                                                                                                    "argument": {"variable": "valTypes"}}}}},
                                                                                            "argument": {
                                                                                              "lambda": {
                                                                                                "parameter": "vt",
                                                                                                "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": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                                        "argument": {
                                                                                                          "application": {
                                                                                                            "function": {
                                                                                                              "application": {
                                                                                                                "function": {
                                                                                                                  "application": {
                                                                                                                    "function": {
                                                                                                                      "application": {"function": {"variable": "hydra.core.checking.applyTypeArgumentsToType"}, "argument": {"variable": "cx3"}}},
                                                                                                                    "argument": {"variable": "tx"}}},
                                                                                                                "argument": {"variable": "typeArgs"}}},
                                                                                                            "argument": {
                                                                                                              "inject": {
                                                                                                                "typeName": "hydra.core.model.Type",
                                                                                                                "field": {
                                                                                                                  "name": "map",
                                                                                                                  "term": {
                                                                                                                    "record": {
                                                                                                                      "typeName": "hydra.core.model.MapType",
                                                                                                                      "fields": [{"name": "keys", "term": {"variable": "kt"}}, {"name": "values", "term": {"variable": "vt"}}]}}}}}}}}},
                                                                                                    "argument": {
                                                                                                      "lambda": {
                                                                                                        "parameter": "applied",
                                                                                                        "domain": {"variable": "hydra.core.model.Type"},
                                                                                                        "body": {
                                                                                                          "typeApplication": {
                                                                                                            "body": {
                                                                                                              "typeApplication": {
                                                                                                                "body": {
                                                                                                                  "either": {
                                                                                                                    "right": {
                                                                                                                      "typeApplication": {
                                                                                                                        "body": {
                                                                                                                          "typeApplication": {
                                                                                                                            "body": {"pair": {"first": {"variable": "applied"}, "second": {"variable": "cx3"}}},
                                                                                                                            "type": {"variable": "hydra.core.model.Type"}}},
                                                                                                                        "type": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                                                "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                                            "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {
                    "literal": {
                      "string": "Reconstruct the type of a map (Either/InferenceContext version). Paper: inference.tex, rules Map_0 and Map_+ (checking side)."}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.checking.typeOfMaybe",
        "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.Type"}}, "isLazy": false},
            {"name": "arg3", "type": {"optional": {"variable": "hydra.core.model.Term"}}, "isLazy": false}],
          "result": {
            "type": {
              "either": {
                "left": {"variable": "hydra.core.errors.Error"},
                "right": {"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": {
                  "lambda": {
                    "parameter": "tx",
                    "domain": {"variable": "hydra.core.graph.Graph"},
                    "body": {
                      "lambda": {
                        "parameter": "typeArgs",
                        "domain": {"list": {"variable": "hydra.core.model.Type"}},
                        "body": {
                          "lambda": {
                            "parameter": "mt",
                            "domain": {"optional": {"variable": "hydra.core.model.Term"}},
                            "body": {
                              "let": {
                                "bindings": [
                                  {
                                    "name": "forNothing",
                                    "term": {
                                      "let": {
                                        "bindings": [
                                          {
                                            "name": "n",
                                            "term": {
                                              "application": {
                                                "function": {
                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.lists.length"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                "argument": {"variable": "typeArgs"}}},
                                            "typeScheme": {"variables": [], "body": {"literal": {"integer": "int32"}}, "constraints": []}}],
                                        "body": {
                                          "let": {
                                            "bindings": [
                                              {
                                                "name": "maybeArityErr",
                                                "term": {
                                                  "typeLambda": {
                                                    "parameter": "t0",
                                                    "body": {
                                                      "typeApplication": {
                                                        "body": {
                                                          "typeApplication": {
                                                            "body": {
                                                              "either": {
                                                                "left": {
                                                                  "inject": {
                                                                    "typeName": "hydra.core.errors.Error",
                                                                    "field": {
                                                                      "name": "checking",
                                                                      "term": {
                                                                        "inject": {
                                                                          "typeName": "hydra.core.error.checking.CheckingError",
                                                                          "field": {
                                                                            "name": "typeArityMismatch",
                                                                            "term": {
                                                                              "record": {
                                                                                "typeName": "hydra.core.error.checking.TypeArityMismatchError",
                                                                                "fields": [
                                                                                  {
                                                                                    "name": "type",
                                                                                    "term": {
                                                                                      "inject": {
                                                                                        "typeName": "hydra.core.model.Type",
                                                                                        "field": {
                                                                                          "name": "optional",
                                                                                          "term": {"inject": {"typeName": "hydra.core.model.Type", "field": {"name": "unit", "term": "unit"}}}}}}},
                                                                                  {"name": "expectedArity", "term": {"literal": {"integer": {"int32": 1}}}},
                                                                                  {"name": "actualArity", "term": {"variable": "n"}},
                                                                                  {"name": "typeArguments", "term": {"variable": "typeArgs"}}]}}}}}}}}}},
                                                            "type": {"variable": "hydra.core.errors.Error"}}},
                                                        "type": {"variable": "t0"}}}}},
                                                "typeScheme": {
                                                  "variables": ["t0"],
                                                  "body": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "t0"}}},
                                                  "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": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}},
                                                        "argument": {
                                                          "application": {
                                                            "function": {
                                                              "application": {
                                                                "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.equality.equal"}, "type": {"literal": {"integer": "int32"}}}},
                                                                "argument": {"variable": "n"}}},
                                                            "argument": {"literal": {"integer": {"int32": 1}}}}}}},
                                                    "argument": {
                                                      "application": {
                                                        "function": {
                                                          "application": {
                                                            "function": {
                                                              "application": {
                                                                "function": {
                                                                  "typeApplication": {
                                                                    "body": {
                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.optionals.match"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                    "type": {
                                                                      "either": {
                                                                        "left": {"variable": "hydra.core.errors.Error"},
                                                                        "right": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}},
                                                                "argument": {
                                                                  "application": {
                                                                    "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.head"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                    "argument": {"variable": "typeArgs"}}}}},
                                                            "argument": {
                                                              "typeApplication": {
                                                                "body": {"variable": "maybeArityErr"},
                                                                "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}},
                                                        "argument": {
                                                          "lambda": {
                                                            "parameter": "ta0",
                                                            "domain": {"variable": "hydra.core.model.Type"},
                                                            "body": {
                                                              "typeApplication": {
                                                                "body": {
                                                                  "typeApplication": {
                                                                    "body": {
                                                                      "either": {
                                                                        "right": {
                                                                          "typeApplication": {
                                                                            "body": {
                                                                              "typeApplication": {
                                                                                "body": {
                                                                                  "pair": {
                                                                                    "first": {"inject": {"typeName": "hydra.core.model.Type", "field": {"name": "optional", "term": {"variable": "ta0"}}}},
                                                                                    "second": {"variable": "cx"}}},
                                                                                "type": {"variable": "hydra.core.model.Type"}}},
                                                                            "type": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                    "type": {"variable": "hydra.core.errors.Error"}}},
                                                                "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}}}}}},
                                                "argument": {
                                                  "typeApplication": {
                                                    "body": {"variable": "maybeArityErr"},
                                                    "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}}}}}},
                                    "typeScheme": {
                                      "variables": [],
                                      "body": {
                                        "either": {
                                          "left": {"variable": "hydra.core.errors.Error"},
                                          "right": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                      "constraints": []}}],
                                "body": {
                                  "let": {
                                    "bindings": [
                                      {
                                        "name": "forJust",
                                        "term": {
                                          "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": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                        "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                    "argument": {
                                                      "application": {
                                                        "function": {
                                                          "application": {
                                                            "function": {
                                                              "application": {
                                                                "function": {"application": {"function": {"variable": "hydra.core.checking.typeOf"}, "argument": {"variable": "cx"}}},
                                                                "argument": {"variable": "tx"}}},
                                                            "argument": {"typeApplication": {"body": {"list": []}, "type": {"variable": "hydra.core.model.Type"}}}}},
                                                        "argument": {"variable": "term"}}}}},
                                                "argument": {
                                                  "lambda": {
                                                    "parameter": "tResult",
                                                    "domain": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                    "body": {
                                                      "let": {
                                                        "bindings": [
                                                          {
                                                            "name": "termType",
                                                            "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": "tResult"}}},
                                                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
                                                        "body": {
                                                          "let": {
                                                            "bindings": [
                                                              {
                                                                "name": "cx2",
                                                                "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": "tResult"}}},
                                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "constraints": []}}],
                                                            "body": {
                                                              "let": {
                                                                "bindings": [
                                                                  {
                                                                    "name": "t",
                                                                    "term": {"inject": {"typeName": "hydra.core.model.Type", "field": {"name": "optional", "term": {"variable": "termType"}}}},
                                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
                                                                "body": {
                                                                  "application": {
                                                                    "function": {
                                                                      "application": {
                                                                        "function": {
                                                                          "typeApplication": {
                                                                            "body": {
                                                                              "typeApplication": {
                                                                                "body": {
                                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.eithers.bind"}, "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                "type": {"variable": "hydra.core.model.Type"}}},
                                                                            "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                        "argument": {
                                                                          "application": {
                                                                            "function": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "application": {
                                                                                    "function": {
                                                                                      "application": {"function": {"variable": "hydra.core.checking.applyTypeArgumentsToType"}, "argument": {"variable": "cx2"}}},
                                                                                    "argument": {"variable": "tx"}}},
                                                                                "argument": {"variable": "typeArgs"}}},
                                                                            "argument": {"variable": "t"}}}}},
                                                                    "argument": {
                                                                      "lambda": {
                                                                        "parameter": "applied",
                                                                        "domain": {"variable": "hydra.core.model.Type"},
                                                                        "body": {
                                                                          "typeApplication": {
                                                                            "body": {
                                                                              "typeApplication": {
                                                                                "body": {
                                                                                  "either": {
                                                                                    "right": {
                                                                                      "typeApplication": {
                                                                                        "body": {
                                                                                          "typeApplication": {
                                                                                            "body": {"pair": {"first": {"variable": "applied"}, "second": {"variable": "cx2"}}},
                                                                                            "type": {"variable": "hydra.core.model.Type"}}},
                                                                                        "type": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                "type": {"variable": "hydra.core.errors.Error"}}},
                                                                            "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}}}}}}}}}}}}}}}},
                                        "typeScheme": {
                                          "variables": [],
                                          "body": {
                                            "function": {
                                              "domain": {"variable": "hydra.core.model.Term"},
                                              "codomain": {
                                                "either": {
                                                  "left": {"variable": "hydra.core.errors.Error"},
                                                  "right": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "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": {"variable": "hydra.core.model.Term"}}},
                                                    "type": {
                                                      "either": {
                                                        "left": {"variable": "hydra.core.errors.Error"},
                                                        "right": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}},
                                                "argument": {"variable": "mt"}}},
                                            "argument": {"variable": "forNothing"}}},
                                        "argument": {"variable": "forJust"}}}}}}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {
                    "literal": {
                      "string": "Reconstruct the type of an optional value (Either/InferenceContext version). Paper: inference.tex, rules Opt_0 and Opt_1 (checking side)."}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.checking.typeOfPair",
        "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.Type"}}, "isLazy": false},
            {
              "name": "arg3",
              "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": {"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": {
                  "lambda": {
                    "parameter": "tx",
                    "domain": {"variable": "hydra.core.graph.Graph"},
                    "body": {
                      "lambda": {
                        "parameter": "typeArgs",
                        "domain": {"list": {"variable": "hydra.core.model.Type"}},
                        "body": {
                          "lambda": {
                            "parameter": "p",
                            "domain": {"pair": {"first": {"variable": "hydra.core.model.Term"}, "second": {"variable": "hydra.core.model.Term"}}},
                            "body": {
                              "let": {
                                "bindings": [
                                  {
                                    "name": "n",
                                    "term": {
                                      "application": {
                                        "function": {
                                          "typeApplication": {"body": {"variable": "hydra.core.lib.lists.length"}, "type": {"variable": "hydra.core.model.Type"}}},
                                        "argument": {"variable": "typeArgs"}}},
                                    "typeScheme": {"variables": [], "body": {"literal": {"integer": "int32"}}, "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": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}},
                                            "argument": {
                                              "application": {
                                                "function": {
                                                  "application": {
                                                    "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.equality.equal"}, "type": {"literal": {"integer": "int32"}}}},
                                                    "argument": {"variable": "n"}}},
                                                "argument": {"literal": {"integer": {"int32": 2}}}}}}},
                                        "argument": {
                                          "let": {
                                            "bindings": [
                                              {
                                                "name": "pairFst",
                                                "term": {
                                                  "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"}}},
                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                            "body": {
                                              "let": {
                                                "bindings": [
                                                  {
                                                    "name": "pairSnd",
                                                    "term": {
                                                      "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"}}},
                                                    "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.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                            "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                        "argument": {
                                                          "application": {
                                                            "function": {
                                                              "application": {
                                                                "function": {
                                                                  "application": {
                                                                    "function": {"application": {"function": {"variable": "hydra.core.checking.typeOf"}, "argument": {"variable": "cx"}}},
                                                                    "argument": {"variable": "tx"}}},
                                                                "argument": {"typeApplication": {"body": {"list": []}, "type": {"variable": "hydra.core.model.Type"}}}}},
                                                            "argument": {"variable": "pairFst"}}}}},
                                                    "argument": {
                                                      "lambda": {
                                                        "parameter": "result1",
                                                        "domain": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                        "body": {
                                                          "let": {
                                                            "bindings": [
                                                              {
                                                                "name": "firstType",
                                                                "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": "result1"}}},
                                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
                                                            "body": {
                                                              "let": {
                                                                "bindings": [
                                                                  {
                                                                    "name": "cx2",
                                                                    "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": "result1"}}},
                                                                    "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.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                            "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                        "argument": {
                                                                          "application": {
                                                                            "function": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "application": {
                                                                                    "function": {"application": {"function": {"variable": "hydra.core.checking.typeOf"}, "argument": {"variable": "cx2"}}},
                                                                                    "argument": {"variable": "tx"}}},
                                                                                "argument": {"typeApplication": {"body": {"list": []}, "type": {"variable": "hydra.core.model.Type"}}}}},
                                                                            "argument": {"variable": "pairSnd"}}}}},
                                                                    "argument": {
                                                                      "lambda": {
                                                                        "parameter": "result2",
                                                                        "domain": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                        "body": {
                                                                          "let": {
                                                                            "bindings": [
                                                                              {
                                                                                "name": "secondType",
                                                                                "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": "result2"}}},
                                                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
                                                                            "body": {
                                                                              "let": {
                                                                                "bindings": [
                                                                                  {
                                                                                    "name": "cx3",
                                                                                    "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": "result2"}}},
                                                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "constraints": []}}],
                                                                                "body": {
                                                                                  "typeApplication": {
                                                                                    "body": {
                                                                                      "typeApplication": {
                                                                                        "body": {
                                                                                          "either": {
                                                                                            "right": {
                                                                                              "typeApplication": {
                                                                                                "body": {
                                                                                                  "typeApplication": {
                                                                                                    "body": {
                                                                                                      "pair": {
                                                                                                        "first": {
                                                                                                          "inject": {
                                                                                                            "typeName": "hydra.core.model.Type",
                                                                                                            "field": {
                                                                                                              "name": "pair",
                                                                                                              "term": {
                                                                                                                "record": {
                                                                                                                  "typeName": "hydra.core.model.PairType",
                                                                                                                  "fields": [{"name": "first", "term": {"variable": "firstType"}}, {"name": "second", "term": {"variable": "secondType"}}]}}}}},
                                                                                                        "second": {"variable": "cx3"}}},
                                                                                                    "type": {"variable": "hydra.core.model.Type"}}},
                                                                                                "type": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                        "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                    "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}}}}}}}}}}}}}}}}}}}}}},
                                    "argument": {
                                      "typeApplication": {
                                        "body": {
                                          "typeApplication": {
                                            "body": {
                                              "either": {
                                                "left": {
                                                  "inject": {
                                                    "typeName": "hydra.core.errors.Error",
                                                    "field": {
                                                      "name": "checking",
                                                      "term": {
                                                        "inject": {
                                                          "typeName": "hydra.core.error.checking.CheckingError",
                                                          "field": {
                                                            "name": "typeArityMismatch",
                                                            "term": {
                                                              "record": {
                                                                "typeName": "hydra.core.error.checking.TypeArityMismatchError",
                                                                "fields": [
                                                                  {
                                                                    "name": "type",
                                                                    "term": {
                                                                      "inject": {
                                                                        "typeName": "hydra.core.model.Type",
                                                                        "field": {
                                                                          "name": "pair",
                                                                          "term": {
                                                                            "record": {
                                                                              "typeName": "hydra.core.model.PairType",
                                                                              "fields": [
                                                                                {"name": "first", "term": {"inject": {"typeName": "hydra.core.model.Type", "field": {"name": "unit", "term": "unit"}}}},
                                                                                {"name": "second", "term": {"inject": {"typeName": "hydra.core.model.Type", "field": {"name": "unit", "term": "unit"}}}}]}}}}}},
                                                                  {"name": "expectedArity", "term": {"literal": {"integer": {"int32": 2}}}},
                                                                  {"name": "actualArity", "term": {"variable": "n"}},
                                                                  {"name": "typeArguments", "term": {"variable": "typeArgs"}}]}}}}}}}}}},
                                            "type": {"variable": "hydra.core.errors.Error"}}},
                                        "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}}}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {
                    "literal": {
                      "string": "Reconstruct the type of a pair (Either/InferenceContext version). Paper: inference.tex, rule Pair (checking side)."}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.checking.typeOfPrimitive",
        "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.Type"}}, "isLazy": false},
            {"name": "arg3", "type": {"variable": "hydra.core.model.Name"}, "isLazy": false}],
          "result": {
            "type": {
              "either": {
                "left": {"variable": "hydra.core.errors.Error"},
                "right": {"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": {
                  "lambda": {
                    "parameter": "tx",
                    "domain": {"variable": "hydra.core.graph.Graph"},
                    "body": {
                      "lambda": {
                        "parameter": "typeArgs",
                        "domain": {"list": {"variable": "hydra.core.model.Type"}},
                        "body": {
                          "lambda": {
                            "parameter": "name",
                            "domain": {"variable": "hydra.core.model.Name"},
                            "body": {
                              "let": {
                                "bindings": [
                                  {
                                    "name": "rawTs",
                                    "term": {
                                      "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": "tx"}}}}}}},
                                    "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": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}},
                                            "argument": {"variable": "rawTs"}}},
                                        "argument": {
                                          "typeApplication": {
                                            "body": {
                                              "typeApplication": {
                                                "body": {
                                                  "either": {
                                                    "left": {
                                                      "inject": {
                                                        "typeName": "hydra.core.errors.Error",
                                                        "field": {
                                                          "name": "undefinedTermVariable",
                                                          "term": {
                                                            "record": {
                                                              "typeName": "hydra.core.error.model.UndefinedTermVariableError",
                                                              "fields": [
                                                                {
                                                                  "name": "location",
                                                                  "term": {
                                                                    "wrap": {
                                                                      "typeName": "hydra.core.paths.SubtermPath",
                                                                      "body": {"typeApplication": {"body": {"list": []}, "type": {"variable": "hydra.core.paths.SubtermStep"}}}}}},
                                                                {"name": "name", "term": {"variable": "name"}}]}}}}}}},
                                                "type": {"variable": "hydra.core.errors.Error"}}},
                                            "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}},
                                    "argument": {
                                      "lambda": {
                                        "parameter": "tsRaw",
                                        "domain": {"variable": "hydra.core.model.TypeScheme"},
                                        "body": {
                                          "let": {
                                            "bindings": [
                                              {
                                                "name": "instResult",
                                                "term": {
                                                  "application": {
                                                    "function": {
                                                      "application": {"function": {"variable": "hydra.core.resolution.instantiateTypeScheme"}, "argument": {"variable": "cx"}}},
                                                    "argument": {"variable": "tsRaw"}}},
                                                "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": "instResult"}}},
                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.TypeScheme"}, "constraints": []}}],
                                                "body": {
                                                  "let": {
                                                    "bindings": [
                                                      {
                                                        "name": "cx2",
                                                        "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": "instResult"}}},
                                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "constraints": []}}],
                                                    "body": {
                                                      "let": {
                                                        "bindings": [
                                                          {
                                                            "name": "t",
                                                            "term": {"application": {"function": {"variable": "hydra.core.scoping.typeSchemeToFType"}, "argument": {"variable": "ts"}}},
                                                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
                                                        "body": {
                                                          "application": {
                                                            "function": {
                                                              "application": {
                                                                "function": {
                                                                  "typeApplication": {
                                                                    "body": {
                                                                      "typeApplication": {
                                                                        "body": {
                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.eithers.bind"}, "type": {"variable": "hydra.core.errors.Error"}}},
                                                                        "type": {"variable": "hydra.core.model.Type"}}},
                                                                    "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                "argument": {
                                                                  "application": {
                                                                    "function": {
                                                                      "application": {
                                                                        "function": {
                                                                          "application": {
                                                                            "function": {
                                                                              "application": {"function": {"variable": "hydra.core.checking.applyTypeArgumentsToType"}, "argument": {"variable": "cx2"}}},
                                                                            "argument": {"variable": "tx"}}},
                                                                        "argument": {"variable": "typeArgs"}}},
                                                                    "argument": {"variable": "t"}}}}},
                                                            "argument": {
                                                              "lambda": {
                                                                "parameter": "applied",
                                                                "domain": {"variable": "hydra.core.model.Type"},
                                                                "body": {
                                                                  "typeApplication": {
                                                                    "body": {
                                                                      "typeApplication": {
                                                                        "body": {
                                                                          "either": {
                                                                            "right": {
                                                                              "typeApplication": {
                                                                                "body": {
                                                                                  "typeApplication": {
                                                                                    "body": {"pair": {"first": {"variable": "applied"}, "second": {"variable": "cx2"}}},
                                                                                    "type": {"variable": "hydra.core.model.Type"}}},
                                                                                "type": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                        "type": {"variable": "hydra.core.errors.Error"}}},
                                                                    "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {
                    "literal": {
                      "string": "Reconstruct the type of a primitive function (Either/InferenceContext version). Paper: inference.tex, rule Prim (checking side)."}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.checking.typeOfProjection",
        "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.Type"}}, "isLazy": false},
            {"name": "arg3", "type": {"variable": "hydra.core.model.Projection"}, "isLazy": false}],
          "result": {
            "type": {
              "either": {
                "left": {"variable": "hydra.core.errors.Error"},
                "right": {"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": {
                  "lambda": {
                    "parameter": "tx",
                    "domain": {"variable": "hydra.core.graph.Graph"},
                    "body": {
                      "lambda": {
                        "parameter": "typeArgs",
                        "domain": {"list": {"variable": "hydra.core.model.Type"}},
                        "body": {
                          "lambda": {
                            "parameter": "p",
                            "domain": {"variable": "hydra.core.model.Projection"},
                            "body": {
                              "let": {
                                "bindings": [
                                  {
                                    "name": "tname",
                                    "term": {
                                      "application": {
                                        "function": {"project": {"typeName": "hydra.core.model.Projection", "fieldName": "typeName"}},
                                        "argument": {"variable": "p"}}},
                                    "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": "p"}}},
                                        "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": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                            "argument": {
                                              "application": {
                                                "function": {
                                                  "application": {
                                                    "function": {"application": {"function": {"variable": "hydra.core.resolution.requireSchemaType"}, "argument": {"variable": "cx"}}},
                                                    "argument": {
                                                      "application": {
                                                        "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "schemaTypes"}},
                                                        "argument": {"variable": "tx"}}}}},
                                                "argument": {"variable": "tname"}}}}},
                                        "argument": {
                                          "lambda": {
                                            "parameter": "schemaResult",
                                            "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": "schemaResult"}}},
                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.TypeScheme"}, "constraints": []}}],
                                                "body": {
                                                  "let": {
                                                    "bindings": [
                                                      {
                                                        "name": "cx2",
                                                        "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": "schemaResult"}}},
                                                        "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": "sbody",
                                                                "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": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                    "argument": {
                                                                      "application": {
                                                                        "function": {
                                                                          "application": {
                                                                            "function": {
                                                                              "typeApplication": {"body": {"variable": "hydra.core.extract.model.recordType"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                            "argument": {"variable": "tname"}}},
                                                                        "argument": {"variable": "sbody"}}}}},
                                                                "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": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                            "argument": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "application": {
                                                                                    "function": {
                                                                                      "application": {
                                                                                        "function": {
                                                                                          "typeApplication": {
                                                                                            "body": {"variable": "hydra.core.resolution.findFieldType"},
                                                                                            "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                        "argument": {"variable": "cx2"}}},
                                                                                    "argument": {"variable": "fname"}}},
                                                                                "argument": {"variable": "sfields"}}}}},
                                                                        "argument": {
                                                                          "lambda": {
                                                                            "parameter": "ftyp",
                                                                            "domain": {"variable": "hydra.core.model.Type"},
                                                                            "body": {
                                                                              "let": {
                                                                                "bindings": [
                                                                                  {
                                                                                    "name": "subst",
                                                                                    "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.zip"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                        "type": {"variable": "hydra.core.model.Type"}}},
                                                                                                    "argument": {"variable": "svars"}}},
                                                                                                "argument": {"variable": "typeArgs"}}}}}}},
                                                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.TypeSubst"}, "constraints": []}}],
                                                                                "body": {
                                                                                  "let": {
                                                                                    "bindings": [
                                                                                      {
                                                                                        "name": "sftyp",
                                                                                        "term": {
                                                                                          "application": {
                                                                                            "function": {"application": {"function": {"variable": "hydra.core.substitution.substInType"}, "argument": {"variable": "subst"}}},
                                                                                            "argument": {"variable": "ftyp"}}},
                                                                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
                                                                                    "body": {
                                                                                      "typeApplication": {
                                                                                        "body": {
                                                                                          "typeApplication": {
                                                                                            "body": {
                                                                                              "either": {
                                                                                                "right": {
                                                                                                  "typeApplication": {
                                                                                                    "body": {
                                                                                                      "typeApplication": {
                                                                                                        "body": {
                                                                                                          "pair": {
                                                                                                            "first": {
                                                                                                              "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": {"variable": "typeArgs"}}}},
                                                                                                                        {"name": "codomain", "term": {"variable": "sftyp"}}]}}}}},
                                                                                                            "second": {"variable": "cx2"}}},
                                                                                                        "type": {"variable": "hydra.core.model.Type"}}},
                                                                                                    "type": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                            "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                        "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {
                    "literal": {
                      "string": "Reconstruct the type of a record projection (Either/InferenceContext version). Paper: inference.tex, rule Proj (checking side)."}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.checking.typeOfRecord",
        "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.Type"}}, "isLazy": false},
            {"name": "arg3", "type": {"variable": "hydra.core.model.Record"}, "isLazy": false}],
          "result": {
            "type": {
              "either": {
                "left": {"variable": "hydra.core.errors.Error"},
                "right": {"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": {
                  "lambda": {
                    "parameter": "tx",
                    "domain": {"variable": "hydra.core.graph.Graph"},
                    "body": {
                      "lambda": {
                        "parameter": "typeArgs",
                        "domain": {"list": {"variable": "hydra.core.model.Type"}},
                        "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": "foldResult",
                                            "term": {
                                              "application": {
                                                "function": {
                                                  "application": {
                                                    "function": {
                                                      "application": {
                                                        "function": {
                                                          "typeApplication": {
                                                            "body": {
                                                              "typeApplication": {
                                                                "body": {"variable": "hydra.core.lib.lists.foldl"},
                                                                "type": {
                                                                  "either": {
                                                                    "left": {"variable": "hydra.core.errors.Error"},
                                                                    "right": {
                                                                      "pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}},
                                                            "type": {"variable": "hydra.core.model.Term"}}},
                                                        "argument": {
                                                          "lambda": {
                                                            "parameter": "acc",
                                                            "domain": {
                                                              "either": {
                                                                "left": {"variable": "hydra.core.errors.Error"},
                                                                "right": {
                                                                  "pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                            "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": {
                                                                                  "pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                            "type": {
                                                                              "pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                        "argument": {"variable": "acc"}}},
                                                                    "argument": {
                                                                      "lambda": {
                                                                        "parameter": "accR",
                                                                        "domain": {
                                                                          "pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                        "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": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                    "argument": {"variable": "accR"}}},
                                                                                "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Type"}}, "constraints": []}}],
                                                                            "body": {
                                                                              "let": {
                                                                                "bindings": [
                                                                                  {
                                                                                    "name": "cxA",
                                                                                    "term": {
                                                                                      "application": {
                                                                                        "function": {
                                                                                          "typeApplication": {
                                                                                            "body": {
                                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                                                            "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                        "argument": {"variable": "accR"}}},
                                                                                    "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.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                            "type": {
                                                                                              "pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                        "argument": {
                                                                                          "application": {
                                                                                            "function": {
                                                                                              "application": {
                                                                                                "function": {
                                                                                                  "application": {
                                                                                                    "function": {"application": {"function": {"variable": "hydra.core.checking.typeOf"}, "argument": {"variable": "cxA"}}},
                                                                                                    "argument": {"variable": "tx"}}},
                                                                                                "argument": {"typeApplication": {"body": {"list": []}, "type": {"variable": "hydra.core.model.Type"}}}}},
                                                                                            "argument": {"variable": "term"}}}}},
                                                                                    "argument": {
                                                                                      "lambda": {
                                                                                        "parameter": "tResult",
                                                                                        "domain": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                        "body": {
                                                                                          "let": {
                                                                                            "bindings": [
                                                                                              {
                                                                                                "name": "t",
                                                                                                "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": "tResult"}}},
                                                                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
                                                                                            "body": {
                                                                                              "let": {
                                                                                                "bindings": [
                                                                                                  {
                                                                                                    "name": "cxB",
                                                                                                    "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": "tResult"}}},
                                                                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "constraints": []}}],
                                                                                                "body": {
                                                                                                  "typeApplication": {
                                                                                                    "body": {
                                                                                                      "typeApplication": {
                                                                                                        "body": {
                                                                                                          "either": {
                                                                                                            "right": {
                                                                                                              "typeApplication": {
                                                                                                                "body": {
                                                                                                                  "typeApplication": {
                                                                                                                    "body": {
                                                                                                                      "pair": {
                                                                                                                        "first": {
                                                                                                                          "application": {
                                                                                                                            "function": {
                                                                                                                              "application": {
                                                                                                                                "function": {
                                                                                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.lists.concat2"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                                                                                "argument": {"variable": "types"}}},
                                                                                                                            "argument": {
                                                                                                                              "application": {
                                                                                                                                "function": {
                                                                                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.lists.singleton"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                                                                                "argument": {"variable": "t"}}}}},
                                                                                                                        "second": {"variable": "cxB"}}},
                                                                                                                    "type": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                                                                                "type": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                                        "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                                    "type": {
                                                                                                      "pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}}}}}}}}}}}}}}}}}}}}}},
                                                    "argument": {
                                                      "typeApplication": {
                                                        "body": {
                                                          "typeApplication": {
                                                            "body": {
                                                              "either": {
                                                                "right": {
                                                                  "typeApplication": {
                                                                    "body": {
                                                                      "typeApplication": {
                                                                        "body": {
                                                                          "pair": {
                                                                            "first": {"typeApplication": {"body": {"list": []}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                            "second": {"variable": "cx"}}},
                                                                        "type": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                                    "type": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                            "type": {"variable": "hydra.core.errors.Error"}}},
                                                        "type": {
                                                          "pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}},
                                                "argument": {
                                                  "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.Term"}}},
                                                        "argument": {"project": {"typeName": "hydra.core.model.Field", "fieldName": "term"}}}},
                                                    "argument": {"variable": "fields"}}}}},
                                            "typeScheme": {
                                              "variables": [],
                                              "body": {
                                                "either": {
                                                  "left": {"variable": "hydra.core.errors.Error"},
                                                  "right": {
                                                    "pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"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": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                    "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                "argument": {"variable": "foldResult"}}},
                                            "argument": {
                                              "lambda": {
                                                "parameter": "foldR",
                                                "domain": {
                                                  "pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                "body": {
                                                  "let": {
                                                    "bindings": [
                                                      {
                                                        "name": "cx2",
                                                        "term": {
                                                          "application": {
                                                            "function": {
                                                              "typeApplication": {
                                                                "body": {
                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                                "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                            "argument": {"variable": "foldR"}}},
                                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "constraints": []}}],
                                                    "body": {
                                                      "typeApplication": {
                                                        "body": {
                                                          "typeApplication": {
                                                            "body": {
                                                              "either": {
                                                                "right": {
                                                                  "typeApplication": {
                                                                    "body": {
                                                                      "typeApplication": {
                                                                        "body": {
                                                                          "pair": {
                                                                            "first": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "application": {"function": {"variable": "hydra.core.resolution.nominalApplication"}, "argument": {"variable": "tname"}}},
                                                                                "argument": {"variable": "typeArgs"}}},
                                                                            "second": {"variable": "cx2"}}},
                                                                        "type": {"variable": "hydra.core.model.Type"}}},
                                                                    "type": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                            "type": {"variable": "hydra.core.errors.Error"}}},
                                                        "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}}}}}}}}}}}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {
                    "literal": {
                      "string": "Reconstruct the type of a record (Either/InferenceContext version). Paper: inference.tex, rule Rec (checking side)."}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.checking.typeOfSet",
        "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.Type"}}, "isLazy": false},
            {"name": "arg3", "type": {"set": {"variable": "hydra.core.model.Term"}}, "isLazy": false}],
          "result": {
            "type": {
              "either": {
                "left": {"variable": "hydra.core.errors.Error"},
                "right": {"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": {
                  "lambda": {
                    "parameter": "tx",
                    "domain": {"variable": "hydra.core.graph.Graph"},
                    "body": {
                      "lambda": {
                        "parameter": "typeArgs",
                        "domain": {"list": {"variable": "hydra.core.model.Type"}},
                        "body": {
                          "lambda": {
                            "parameter": "els",
                            "domain": {"set": {"variable": "hydra.core.model.Term"}},
                            "body": {
                              "let": {
                                "bindings": [
                                  {
                                    "name": "setArityErr",
                                    "term": {
                                      "typeLambda": {
                                        "parameter": "t0",
                                        "body": {
                                          "typeApplication": {
                                            "body": {
                                              "typeApplication": {
                                                "body": {
                                                  "either": {
                                                    "left": {
                                                      "inject": {
                                                        "typeName": "hydra.core.errors.Error",
                                                        "field": {
                                                          "name": "checking",
                                                          "term": {
                                                            "inject": {
                                                              "typeName": "hydra.core.error.checking.CheckingError",
                                                              "field": {
                                                                "name": "typeArityMismatch",
                                                                "term": {
                                                                  "record": {
                                                                    "typeName": "hydra.core.error.checking.TypeArityMismatchError",
                                                                    "fields": [
                                                                      {
                                                                        "name": "type",
                                                                        "term": {
                                                                          "inject": {
                                                                            "typeName": "hydra.core.model.Type",
                                                                            "field": {"name": "set", "term": {"inject": {"typeName": "hydra.core.model.Type", "field": {"name": "unit", "term": "unit"}}}}}}},
                                                                      {"name": "expectedArity", "term": {"literal": {"integer": {"int32": 1}}}},
                                                                      {
                                                                        "name": "actualArity",
                                                                        "term": {
                                                                          "application": {
                                                                            "function": {
                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.lists.length"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                            "argument": {"variable": "typeArgs"}}}},
                                                                      {"name": "typeArguments", "term": {"variable": "typeArgs"}}]}}}}}}}}}},
                                                "type": {"variable": "hydra.core.errors.Error"}}},
                                            "type": {"variable": "t0"}}}}},
                                    "typeScheme": {
                                      "variables": ["t0"],
                                      "body": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "t0"}}},
                                      "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": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}},
                                            "argument": {
                                              "application": {
                                                "function": {
                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.sets.isEmpty"}, "type": {"variable": "hydra.core.model.Term"}}},
                                                "argument": {"variable": "els"}}}}},
                                        "argument": {
                                          "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": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}},
                                                    "argument": {
                                                      "application": {
                                                        "function": {
                                                          "application": {
                                                            "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.equality.equal"}, "type": {"literal": {"integer": "int32"}}}},
                                                            "argument": {
                                                              "application": {
                                                                "function": {
                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.lists.length"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                "argument": {"variable": "typeArgs"}}}}},
                                                        "argument": {"literal": {"integer": {"int32": 1}}}}}}},
                                                "argument": {
                                                  "application": {
                                                    "function": {
                                                      "application": {
                                                        "function": {
                                                          "application": {
                                                            "function": {
                                                              "typeApplication": {
                                                                "body": {
                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.optionals.match"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                "type": {
                                                                  "either": {
                                                                    "left": {"variable": "hydra.core.errors.Error"},
                                                                    "right": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}},
                                                            "argument": {
                                                              "application": {
                                                                "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.head"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                "argument": {"variable": "typeArgs"}}}}},
                                                        "argument": {
                                                          "typeApplication": {
                                                            "body": {"variable": "setArityErr"},
                                                            "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}},
                                                    "argument": {
                                                      "lambda": {
                                                        "parameter": "ta0",
                                                        "domain": {"variable": "hydra.core.model.Type"},
                                                        "body": {
                                                          "typeApplication": {
                                                            "body": {
                                                              "typeApplication": {
                                                                "body": {
                                                                  "either": {
                                                                    "right": {
                                                                      "typeApplication": {
                                                                        "body": {
                                                                          "typeApplication": {
                                                                            "body": {
                                                                              "pair": {
                                                                                "first": {"inject": {"typeName": "hydra.core.model.Type", "field": {"name": "set", "term": {"variable": "ta0"}}}},
                                                                                "second": {"variable": "cx"}}},
                                                                            "type": {"variable": "hydra.core.model.Type"}}},
                                                                        "type": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                "type": {"variable": "hydra.core.errors.Error"}}},
                                                            "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}}}}}},
                                            "argument": {
                                              "typeApplication": {
                                                "body": {"variable": "setArityErr"},
                                                "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}}}},
                                    "argument": {
                                      "let": {
                                        "bindings": [
                                          {
                                            "name": "foldResult",
                                            "term": {
                                              "application": {
                                                "function": {
                                                  "application": {
                                                    "function": {
                                                      "application": {
                                                        "function": {
                                                          "typeApplication": {
                                                            "body": {
                                                              "typeApplication": {
                                                                "body": {"variable": "hydra.core.lib.lists.foldl"},
                                                                "type": {
                                                                  "either": {
                                                                    "left": {"variable": "hydra.core.errors.Error"},
                                                                    "right": {
                                                                      "pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}},
                                                            "type": {"variable": "hydra.core.model.Term"}}},
                                                        "argument": {
                                                          "lambda": {
                                                            "parameter": "acc",
                                                            "domain": {
                                                              "either": {
                                                                "left": {"variable": "hydra.core.errors.Error"},
                                                                "right": {
                                                                  "pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                            "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": {
                                                                                  "pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                            "type": {
                                                                              "pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                        "argument": {"variable": "acc"}}},
                                                                    "argument": {
                                                                      "lambda": {
                                                                        "parameter": "accR",
                                                                        "domain": {
                                                                          "pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                        "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": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                    "argument": {"variable": "accR"}}},
                                                                                "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Type"}}, "constraints": []}}],
                                                                            "body": {
                                                                              "let": {
                                                                                "bindings": [
                                                                                  {
                                                                                    "name": "cxA",
                                                                                    "term": {
                                                                                      "application": {
                                                                                        "function": {
                                                                                          "typeApplication": {
                                                                                            "body": {
                                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                                                            "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                        "argument": {"variable": "accR"}}},
                                                                                    "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.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                            "type": {
                                                                                              "pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                        "argument": {
                                                                                          "application": {
                                                                                            "function": {
                                                                                              "application": {
                                                                                                "function": {
                                                                                                  "application": {
                                                                                                    "function": {"application": {"function": {"variable": "hydra.core.checking.typeOf"}, "argument": {"variable": "cxA"}}},
                                                                                                    "argument": {"variable": "tx"}}},
                                                                                                "argument": {"typeApplication": {"body": {"list": []}, "type": {"variable": "hydra.core.model.Type"}}}}},
                                                                                            "argument": {"variable": "term"}}}}},
                                                                                    "argument": {
                                                                                      "lambda": {
                                                                                        "parameter": "tResult",
                                                                                        "domain": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                        "body": {
                                                                                          "let": {
                                                                                            "bindings": [
                                                                                              {
                                                                                                "name": "t",
                                                                                                "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": "tResult"}}},
                                                                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
                                                                                            "body": {
                                                                                              "let": {
                                                                                                "bindings": [
                                                                                                  {
                                                                                                    "name": "cxB",
                                                                                                    "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": "tResult"}}},
                                                                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "constraints": []}}],
                                                                                                "body": {
                                                                                                  "typeApplication": {
                                                                                                    "body": {
                                                                                                      "typeApplication": {
                                                                                                        "body": {
                                                                                                          "either": {
                                                                                                            "right": {
                                                                                                              "typeApplication": {
                                                                                                                "body": {
                                                                                                                  "typeApplication": {
                                                                                                                    "body": {
                                                                                                                      "pair": {
                                                                                                                        "first": {
                                                                                                                          "application": {
                                                                                                                            "function": {
                                                                                                                              "application": {
                                                                                                                                "function": {
                                                                                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.lists.concat2"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                                                                                "argument": {"variable": "types"}}},
                                                                                                                            "argument": {
                                                                                                                              "application": {
                                                                                                                                "function": {
                                                                                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.lists.singleton"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                                                                                "argument": {"variable": "t"}}}}},
                                                                                                                        "second": {"variable": "cxB"}}},
                                                                                                                    "type": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                                                                                "type": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                                                        "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                                    "type": {
                                                                                                      "pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}}}}}}}}}}}}}}}}}}}}}},
                                                    "argument": {
                                                      "typeApplication": {
                                                        "body": {
                                                          "typeApplication": {
                                                            "body": {
                                                              "either": {
                                                                "right": {
                                                                  "typeApplication": {
                                                                    "body": {
                                                                      "typeApplication": {
                                                                        "body": {
                                                                          "pair": {
                                                                            "first": {"typeApplication": {"body": {"list": []}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                            "second": {"variable": "cx"}}},
                                                                        "type": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                                    "type": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                            "type": {"variable": "hydra.core.errors.Error"}}},
                                                        "type": {
                                                          "pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}},
                                                "argument": {
                                                  "application": {
                                                    "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.toList"}, "type": {"variable": "hydra.core.model.Term"}}},
                                                    "argument": {"variable": "els"}}}}},
                                            "typeScheme": {
                                              "variables": [],
                                              "body": {
                                                "either": {
                                                  "left": {"variable": "hydra.core.errors.Error"},
                                                  "right": {
                                                    "pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"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": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                    "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                "argument": {"variable": "foldResult"}}},
                                            "argument": {
                                              "lambda": {
                                                "parameter": "foldR",
                                                "domain": {
                                                  "pair": {"first": {"list": {"variable": "hydra.core.model.Type"}}, "second": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                "body": {
                                                  "let": {
                                                    "bindings": [
                                                      {
                                                        "name": "eltypes",
                                                        "term": {
                                                          "application": {
                                                            "function": {
                                                              "typeApplication": {
                                                                "body": {
                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                                "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                            "argument": {"variable": "foldR"}}},
                                                        "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Type"}}, "constraints": []}}],
                                                    "body": {
                                                      "let": {
                                                        "bindings": [
                                                          {
                                                            "name": "cx2",
                                                            "term": {
                                                              "application": {
                                                                "function": {
                                                                  "typeApplication": {
                                                                    "body": {
                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"list": {"variable": "hydra.core.model.Type"}}}},
                                                                    "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                "argument": {"variable": "foldR"}}},
                                                            "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.model.Type"}}},
                                                                    "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                "argument": {
                                                                  "application": {
                                                                    "function": {
                                                                      "application": {
                                                                        "function": {
                                                                          "application": {
                                                                            "function": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "typeApplication": {"body": {"variable": "hydra.core.checking.checkSameType"}, "type": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                                                "argument": {"variable": "cx2"}}},
                                                                            "argument": {"variable": "tx"}}},
                                                                        "argument": {"literal": {"string": "set elements"}}}},
                                                                    "argument": {"variable": "eltypes"}}}}},
                                                            "argument": {
                                                              "lambda": {
                                                                "parameter": "unifiedType",
                                                                "domain": {"variable": "hydra.core.model.Type"},
                                                                "body": {
                                                                  "typeApplication": {
                                                                    "body": {
                                                                      "typeApplication": {
                                                                        "body": {
                                                                          "either": {
                                                                            "right": {
                                                                              "typeApplication": {
                                                                                "body": {
                                                                                  "typeApplication": {
                                                                                    "body": {
                                                                                      "pair": {
                                                                                        "first": {"inject": {"typeName": "hydra.core.model.Type", "field": {"name": "set", "term": {"variable": "unifiedType"}}}},
                                                                                        "second": {"variable": "cx2"}}},
                                                                                    "type": {"variable": "hydra.core.model.Type"}}},
                                                                                "type": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                        "type": {"variable": "hydra.core.errors.Error"}}},
                                                                    "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {
                    "literal": {
                      "string": "Reconstruct the type of a set (Either/InferenceContext version). Paper: inference.tex, rules Set_0 and Set_+ (checking side)."}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.checking.typeOfTerm",
        "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.model.Type"}}}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "cx",
                "domain": {"variable": "hydra.core.typing.InferenceContext"},
                "body": {
                  "lambda": {
                    "parameter": "g",
                    "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.map"},
                                            "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                        "type": {"variable": "hydra.core.model.Type"}}},
                                    "type": {"variable": "hydra.core.errors.Error"}}},
                                "argument": {
                                  "typeApplication": {
                                    "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"variable": "hydra.core.model.Type"}}},
                                    "type": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                            "argument": {
                              "application": {
                                "function": {
                                  "application": {
                                    "function": {
                                      "application": {
                                        "function": {"application": {"function": {"variable": "hydra.core.checking.typeOf"}, "argument": {"variable": "cx"}}},
                                        "argument": {"variable": "g"}}},
                                    "argument": {"typeApplication": {"body": {"list": []}, "type": {"variable": "hydra.core.model.Type"}}}}},
                                "argument": {"variable": "term"}}}}}}}}}}},
            "annotation": {"map": [{"key": {"variable": "description"}, "value": {"literal": {"string": "Check the type of a term"}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.checking.typeOfTypeApplication",
        "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.Type"}}, "isLazy": false},
            {"name": "arg3", "type": {"variable": "hydra.core.model.TypeApplicationTerm"}, "isLazy": false}],
          "result": {
            "type": {
              "either": {
                "left": {"variable": "hydra.core.errors.Error"},
                "right": {"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": {
                  "lambda": {
                    "parameter": "tx",
                    "domain": {"variable": "hydra.core.graph.Graph"},
                    "body": {
                      "lambda": {
                        "parameter": "typeArgs",
                        "domain": {"list": {"variable": "hydra.core.model.Type"}},
                        "body": {
                          "lambda": {
                            "parameter": "tyapp",
                            "domain": {"variable": "hydra.core.model.TypeApplicationTerm"},
                            "body": {
                              "let": {
                                "bindings": [
                                  {
                                    "name": "body",
                                    "term": {
                                      "application": {
                                        "function": {"project": {"typeName": "hydra.core.model.TypeApplicationTerm", "fieldName": "body"}},
                                        "argument": {"variable": "tyapp"}}},
                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                "body": {
                                  "let": {
                                    "bindings": [
                                      {
                                        "name": "t",
                                        "term": {
                                          "application": {
                                            "function": {"project": {"typeName": "hydra.core.model.TypeApplicationTerm", "fieldName": "type"}},
                                            "argument": {"variable": "tyapp"}}},
                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
                                    "body": {
                                      "application": {
                                        "function": {
                                          "application": {
                                            "function": {
                                              "application": {
                                                "function": {"application": {"function": {"variable": "hydra.core.checking.typeOf"}, "argument": {"variable": "cx"}}},
                                                "argument": {"variable": "tx"}}},
                                            "argument": {
                                              "application": {
                                                "function": {
                                                  "application": {
                                                    "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.cons"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                    "argument": {"variable": "t"}}},
                                                "argument": {"variable": "typeArgs"}}}}},
                                        "argument": {"variable": "body"}}}}}}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {
                    "literal": {
                      "string": "Reconstruct the type of a type application term (Either/InferenceContext version). Paper: inference.tex, 'Checking the witness' (pushes onto the pending-type-argument stack)."}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.checking.typeOfTypeLambda",
        "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.Type"}}, "isLazy": false},
            {"name": "arg3", "type": {"variable": "hydra.core.model.TypeLambda"}, "isLazy": false}],
          "result": {
            "type": {
              "either": {
                "left": {"variable": "hydra.core.errors.Error"},
                "right": {"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": {
                  "lambda": {
                    "parameter": "tx",
                    "domain": {"variable": "hydra.core.graph.Graph"},
                    "body": {
                      "lambda": {
                        "parameter": "typeArgs",
                        "domain": {"list": {"variable": "hydra.core.model.Type"}},
                        "body": {
                          "lambda": {
                            "parameter": "tl",
                            "domain": {"variable": "hydra.core.model.TypeLambda"},
                            "body": {
                              "let": {
                                "bindings": [
                                  {
                                    "name": "v",
                                    "term": {
                                      "application": {
                                        "function": {"project": {"typeName": "hydra.core.model.TypeLambda", "fieldName": "parameter"}},
                                        "argument": {"variable": "tl"}}},
                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Name"}, "constraints": []}}],
                                "body": {
                                  "let": {
                                    "bindings": [
                                      {
                                        "name": "body",
                                        "term": {
                                          "application": {
                                            "function": {"project": {"typeName": "hydra.core.model.TypeLambda", "fieldName": "body"}},
                                            "argument": {"variable": "tl"}}},
                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                    "body": {
                                      "let": {
                                        "bindings": [
                                          {
                                            "name": "vars",
                                            "term": {
                                              "application": {
                                                "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "typeVariables"}},
                                                "argument": {"variable": "tx"}}},
                                            "typeScheme": {"variables": [], "body": {"set": {"variable": "hydra.core.model.Name"}}, "constraints": []}}],
                                        "body": {
                                          "let": {
                                            "bindings": [
                                              {
                                                "name": "tx2",
                                                "term": {
                                                  "record": {
                                                    "typeName": "hydra.core.graph.Graph",
                                                    "fields": [
                                                      {
                                                        "name": "boundTerms",
                                                        "term": {
                                                          "application": {
                                                            "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "boundTerms"}},
                                                            "argument": {"variable": "tx"}}}},
                                                      {
                                                        "name": "boundTypes",
                                                        "term": {
                                                          "application": {
                                                            "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "boundTypes"}},
                                                            "argument": {"variable": "tx"}}}},
                                                      {
                                                        "name": "classConstraints",
                                                        "term": {
                                                          "application": {
                                                            "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "classConstraints"}},
                                                            "argument": {"variable": "tx"}}}},
                                                      {
                                                        "name": "lambdaVariables",
                                                        "term": {
                                                          "application": {
                                                            "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "lambdaVariables"}},
                                                            "argument": {"variable": "tx"}}}},
                                                      {
                                                        "name": "metadata",
                                                        "term": {
                                                          "application": {
                                                            "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "metadata"}},
                                                            "argument": {"variable": "tx"}}}},
                                                      {
                                                        "name": "primitives",
                                                        "term": {
                                                          "application": {
                                                            "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "primitives"}},
                                                            "argument": {"variable": "tx"}}}},
                                                      {
                                                        "name": "schemaTypes",
                                                        "term": {
                                                          "application": {
                                                            "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "schemaTypes"}},
                                                            "argument": {"variable": "tx"}}}},
                                                      {
                                                        "name": "typeVariables",
                                                        "term": {
                                                          "application": {
                                                            "function": {
                                                              "application": {
                                                                "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.insert"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                "argument": {"variable": "v"}}},
                                                            "argument": {"variable": "vars"}}}}]}},
                                                "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": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                        "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                    "argument": {
                                                      "application": {
                                                        "function": {
                                                          "application": {
                                                            "function": {
                                                              "application": {
                                                                "function": {"application": {"function": {"variable": "hydra.core.checking.typeOf"}, "argument": {"variable": "cx"}}},
                                                                "argument": {"variable": "tx2"}}},
                                                            "argument": {"typeApplication": {"body": {"list": []}, "type": {"variable": "hydra.core.model.Type"}}}}},
                                                        "argument": {"variable": "body"}}}}},
                                                "argument": {
                                                  "lambda": {
                                                    "parameter": "result1",
                                                    "domain": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                    "body": {
                                                      "let": {
                                                        "bindings": [
                                                          {
                                                            "name": "t1",
                                                            "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": "result1"}}},
                                                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
                                                        "body": {
                                                          "let": {
                                                            "bindings": [
                                                              {
                                                                "name": "cx2",
                                                                "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": "result1"}}},
                                                                "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.model.Type"}}},
                                                                        "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                    "argument": {
                                                                      "application": {
                                                                        "function": {
                                                                          "application": {
                                                                            "function": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "application": {"function": {"variable": "hydra.core.checking.applyTypeArgumentsToType"}, "argument": {"variable": "cx2"}}},
                                                                                "argument": {"variable": "tx"}}},
                                                                            "argument": {"variable": "typeArgs"}}},
                                                                        "argument": {
                                                                          "inject": {
                                                                            "typeName": "hydra.core.model.Type",
                                                                            "field": {
                                                                              "name": "forall",
                                                                              "term": {
                                                                                "record": {
                                                                                  "typeName": "hydra.core.model.ForallType",
                                                                                  "fields": [{"name": "parameter", "term": {"variable": "v"}}, {"name": "body", "term": {"variable": "t1"}}]}}}}}}}}},
                                                                "argument": {
                                                                  "lambda": {
                                                                    "parameter": "applied",
                                                                    "domain": {"variable": "hydra.core.model.Type"},
                                                                    "body": {
                                                                      "typeApplication": {
                                                                        "body": {
                                                                          "typeApplication": {
                                                                            "body": {
                                                                              "either": {
                                                                                "right": {
                                                                                  "typeApplication": {
                                                                                    "body": {
                                                                                      "typeApplication": {
                                                                                        "body": {"pair": {"first": {"variable": "applied"}, "second": {"variable": "cx2"}}},
                                                                                        "type": {"variable": "hydra.core.model.Type"}}},
                                                                                    "type": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                            "type": {"variable": "hydra.core.errors.Error"}}},
                                                                        "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {
                    "literal": {
                      "string": "Reconstruct the type of a type lambda (type abstraction) term (Either/InferenceContext version). Paper: inference.tex, type abstraction terms in the elaborated Term grammar."}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.checking.typeOfUnit",
        "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.Type"}}, "isLazy": false}],
          "result": {
            "type": {
              "either": {
                "left": {"variable": "hydra.core.errors.Error"},
                "right": {"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": {
                  "lambda": {
                    "parameter": "tx",
                    "domain": {"variable": "hydra.core.graph.Graph"},
                    "body": {
                      "lambda": {
                        "parameter": "typeArgs",
                        "domain": {"list": {"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": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                "argument": {
                                  "application": {
                                    "function": {
                                      "application": {
                                        "function": {
                                          "application": {
                                            "function": {
                                              "application": {"function": {"variable": "hydra.core.checking.applyTypeArgumentsToType"}, "argument": {"variable": "cx"}}},
                                            "argument": {"variable": "tx"}}},
                                        "argument": {"variable": "typeArgs"}}},
                                    "argument": {"inject": {"typeName": "hydra.core.model.Type", "field": {"name": "unit", "term": "unit"}}}}}}},
                            "argument": {
                              "lambda": {
                                "parameter": "applied",
                                "domain": {"variable": "hydra.core.model.Type"},
                                "body": {
                                  "typeApplication": {
                                    "body": {
                                      "typeApplication": {
                                        "body": {
                                          "either": {
                                            "right": {
                                              "typeApplication": {
                                                "body": {
                                                  "typeApplication": {
                                                    "body": {"pair": {"first": {"variable": "applied"}, "second": {"variable": "cx"}}},
                                                    "type": {"variable": "hydra.core.model.Type"}}},
                                                "type": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                        "type": {"variable": "hydra.core.errors.Error"}}},
                                    "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {
                    "literal": {
                      "string": "Reconstruct the type of the unit term (Either/InferenceContext version). Paper: inference.tex, rule Unit (checking side)."}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.checking.typeOfUnwrap",
        "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.Type"}}, "isLazy": false},
            {"name": "arg3", "type": {"variable": "hydra.core.model.Name"}, "isLazy": false}],
          "result": {
            "type": {
              "either": {
                "left": {"variable": "hydra.core.errors.Error"},
                "right": {"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": {
                  "lambda": {
                    "parameter": "tx",
                    "domain": {"variable": "hydra.core.graph.Graph"},
                    "body": {
                      "lambda": {
                        "parameter": "typeArgs",
                        "domain": {"list": {"variable": "hydra.core.model.Type"}},
                        "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": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                    "argument": {
                                      "application": {
                                        "function": {
                                          "application": {
                                            "function": {"application": {"function": {"variable": "hydra.core.resolution.requireSchemaType"}, "argument": {"variable": "cx"}}},
                                            "argument": {
                                              "application": {
                                                "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "schemaTypes"}},
                                                "argument": {"variable": "tx"}}}}},
                                        "argument": {"variable": "tname"}}}}},
                                "argument": {
                                  "lambda": {
                                    "parameter": "schemaResult",
                                    "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": "schemaResult"}}},
                                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.TypeScheme"}, "constraints": []}}],
                                        "body": {
                                          "let": {
                                            "bindings": [
                                              {
                                                "name": "cx2",
                                                "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": "schemaResult"}}},
                                                "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": "sbody",
                                                        "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": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                            "argument": {
                                                              "application": {
                                                                "function": {
                                                                  "application": {
                                                                    "function": {
                                                                      "typeApplication": {"body": {"variable": "hydra.core.extract.model.wrappedType"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                    "argument": {"variable": "tname"}}},
                                                                "argument": {"variable": "sbody"}}}}},
                                                        "argument": {
                                                          "lambda": {
                                                            "parameter": "wrapped",
                                                            "domain": {"variable": "hydra.core.model.Type"},
                                                            "body": {
                                                              "let": {
                                                                "bindings": [
                                                                  {
                                                                    "name": "subst",
                                                                    "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.zip"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                        "type": {"variable": "hydra.core.model.Type"}}},
                                                                                    "argument": {"variable": "svars"}}},
                                                                                "argument": {"variable": "typeArgs"}}}}}}},
                                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.TypeSubst"}, "constraints": []}}],
                                                                "body": {
                                                                  "let": {
                                                                    "bindings": [
                                                                      {
                                                                        "name": "swrapped",
                                                                        "term": {
                                                                          "application": {
                                                                            "function": {"application": {"function": {"variable": "hydra.core.substitution.substInType"}, "argument": {"variable": "subst"}}},
                                                                            "argument": {"variable": "wrapped"}}},
                                                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
                                                                    "body": {
                                                                      "typeApplication": {
                                                                        "body": {
                                                                          "typeApplication": {
                                                                            "body": {
                                                                              "either": {
                                                                                "right": {
                                                                                  "typeApplication": {
                                                                                    "body": {
                                                                                      "typeApplication": {
                                                                                        "body": {
                                                                                          "pair": {
                                                                                            "first": {
                                                                                              "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": {"variable": "typeArgs"}}}},
                                                                                                        {"name": "codomain", "term": {"variable": "swrapped"}}]}}}}},
                                                                                            "second": {"variable": "cx2"}}},
                                                                                        "type": {"variable": "hydra.core.model.Type"}}},
                                                                                    "type": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                            "type": {"variable": "hydra.core.errors.Error"}}},
                                                                        "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {
                    "literal": {
                      "string": "Reconstruct the type of an unwrap operation (Either/InferenceContext version). Paper: inference.tex, rule Unwr (checking side)."}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.checking.typeOfVariable",
        "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.Type"}}, "isLazy": false},
            {"name": "arg3", "type": {"variable": "hydra.core.model.Name"}, "isLazy": false}],
          "result": {
            "type": {
              "either": {
                "left": {"variable": "hydra.core.errors.Error"},
                "right": {"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": {
                  "lambda": {
                    "parameter": "tx",
                    "domain": {"variable": "hydra.core.graph.Graph"},
                    "body": {
                      "lambda": {
                        "parameter": "typeArgs",
                        "domain": {"list": {"variable": "hydra.core.model.Type"}},
                        "body": {
                          "lambda": {
                            "parameter": "name",
                            "domain": {"variable": "hydra.core.model.Name"},
                            "body": {
                              "let": {
                                "bindings": [
                                  {
                                    "name": "forScheme",
                                    "term": {
                                      "lambda": {
                                        "parameter": "ts",
                                        "domain": {"variable": "hydra.core.model.TypeScheme"},
                                        "body": {
                                          "let": {
                                            "bindings": [
                                              {
                                                "name": "tResult",
                                                "term": {
                                                  "application": {
                                                    "function": {
                                                      "application": {
                                                        "function": {
                                                          "application": {
                                                            "function": {
                                                              "typeApplication": {
                                                                "body": {"variable": "hydra.core.lib.logic.ifElse"},
                                                                "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                            "argument": {
                                                              "application": {
                                                                "function": {
                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.lists.isEmpty"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                "argument": {"variable": "typeArgs"}}}}},
                                                        "argument": {
                                                          "application": {
                                                            "function": {"application": {"function": {"variable": "hydra.core.resolution.instantiateType"}, "argument": {"variable": "cx"}}},
                                                            "argument": {"application": {"function": {"variable": "hydra.core.scoping.typeSchemeToFType"}, "argument": {"variable": "ts"}}}}}}},
                                                    "argument": {
                                                      "typeApplication": {
                                                        "body": {
                                                          "typeApplication": {
                                                            "body": {
                                                              "pair": {
                                                                "first": {"application": {"function": {"variable": "hydra.core.scoping.typeSchemeToFType"}, "argument": {"variable": "ts"}}},
                                                                "second": {"variable": "cx"}}},
                                                            "type": {"variable": "hydra.core.model.Type"}}},
                                                        "type": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                "typeScheme": {
                                                  "variables": [],
                                                  "body": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}},
                                                  "constraints": []}}],
                                            "body": {
                                              "let": {
                                                "bindings": [
                                                  {
                                                    "name": "t",
                                                    "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": "tResult"}}},
                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
                                                "body": {
                                                  "let": {
                                                    "bindings": [
                                                      {
                                                        "name": "cx2",
                                                        "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": "tResult"}}},
                                                        "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.model.Type"}}},
                                                                "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                            "argument": {
                                                              "application": {
                                                                "function": {
                                                                  "application": {
                                                                    "function": {
                                                                      "application": {
                                                                        "function": {
                                                                          "application": {"function": {"variable": "hydra.core.checking.applyTypeArgumentsToType"}, "argument": {"variable": "cx2"}}},
                                                                        "argument": {"variable": "tx"}}},
                                                                    "argument": {"variable": "typeArgs"}}},
                                                                "argument": {"variable": "t"}}}}},
                                                        "argument": {
                                                          "lambda": {
                                                            "parameter": "applied",
                                                            "domain": {"variable": "hydra.core.model.Type"},
                                                            "body": {
                                                              "typeApplication": {
                                                                "body": {
                                                                  "typeApplication": {
                                                                    "body": {
                                                                      "either": {
                                                                        "right": {
                                                                          "typeApplication": {
                                                                            "body": {
                                                                              "typeApplication": {
                                                                                "body": {"pair": {"first": {"variable": "applied"}, "second": {"variable": "cx2"}}},
                                                                                "type": {"variable": "hydra.core.model.Type"}}},
                                                                            "type": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                                    "type": {"variable": "hydra.core.errors.Error"}}},
                                                                "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}}}}}}}}}}}},
                                    "typeScheme": {
                                      "variables": [],
                                      "body": {
                                        "function": {
                                          "domain": {"variable": "hydra.core.model.TypeScheme"},
                                          "codomain": {
                                            "either": {
                                              "left": {"variable": "hydra.core.errors.Error"},
                                              "right": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}},
                                      "constraints": []}}],
                                "body": {
                                  "let": {
                                    "bindings": [
                                      {
                                        "name": "primScheme",
                                        "term": {
                                          "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": "tx"}}}}}}},
                                        "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": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}},
                                                "argument": {"variable": "primScheme"}}},
                                            "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": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}},
                                                        "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": "tx"}}}}}}},
                                                    "argument": {
                                                      "typeApplication": {
                                                        "body": {
                                                          "typeApplication": {
                                                            "body": {
                                                              "either": {
                                                                "left": {
                                                                  "inject": {
                                                                    "typeName": "hydra.core.errors.Error",
                                                                    "field": {
                                                                      "name": "untypedTermVariable",
                                                                      "term": {
                                                                        "record": {
                                                                          "typeName": "hydra.core.error.model.UntypedTermVariableError",
                                                                          "fields": [
                                                                            {
                                                                              "name": "location",
                                                                              "term": {
                                                                                "wrap": {
                                                                                  "typeName": "hydra.core.paths.SubtermPath",
                                                                                  "body": {"typeApplication": {"body": {"list": []}, "type": {"variable": "hydra.core.paths.SubtermStep"}}}}}},
                                                                            {"name": "name", "term": {"variable": "name"}}]}}}}}}},
                                                            "type": {"variable": "hydra.core.errors.Error"}}},
                                                        "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}},
                                                "argument": {"variable": "forScheme"}}}}},
                                        "argument": {"variable": "forScheme"}}}}}}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {
                    "literal": {
                      "string": "Reconstruct the type of a variable (Either/InferenceContext version). Paper: inference.tex, rules Var and Prim (checking side); note the primitives-first lookup order, the reverse of inference."}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.checking.typeOfWrappedTerm",
        "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.Type"}}, "isLazy": false},
            {"name": "arg3", "type": {"variable": "hydra.core.model.WrappedTerm"}, "isLazy": false}],
          "result": {
            "type": {
              "either": {
                "left": {"variable": "hydra.core.errors.Error"},
                "right": {"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": {
                  "lambda": {
                    "parameter": "tx",
                    "domain": {"variable": "hydra.core.graph.Graph"},
                    "body": {
                      "lambda": {
                        "parameter": "typeArgs",
                        "domain": {"list": {"variable": "hydra.core.model.Type"}},
                        "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": "body",
                                        "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.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                            "argument": {
                                              "application": {
                                                "function": {
                                                  "application": {
                                                    "function": {
                                                      "application": {
                                                        "function": {"application": {"function": {"variable": "hydra.core.checking.typeOf"}, "argument": {"variable": "cx"}}},
                                                        "argument": {"variable": "tx"}}},
                                                    "argument": {"typeApplication": {"body": {"list": []}, "type": {"variable": "hydra.core.model.Type"}}}}},
                                                "argument": {"variable": "body"}}}}},
                                        "argument": {
                                          "lambda": {
                                            "parameter": "result",
                                            "domain": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}},
                                            "body": {
                                              "let": {
                                                "bindings": [
                                                  {
                                                    "name": "cx2",
                                                    "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": "result"}}},
                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.typing.InferenceContext"}, "constraints": []}}],
                                                "body": {
                                                  "typeApplication": {
                                                    "body": {
                                                      "typeApplication": {
                                                        "body": {
                                                          "either": {
                                                            "right": {
                                                              "typeApplication": {
                                                                "body": {
                                                                  "typeApplication": {
                                                                    "body": {
                                                                      "pair": {
                                                                        "first": {
                                                                          "application": {
                                                                            "function": {
                                                                              "application": {"function": {"variable": "hydra.core.resolution.nominalApplication"}, "argument": {"variable": "tname"}}},
                                                                            "argument": {"variable": "typeArgs"}}},
                                                                        "second": {"variable": "cx2"}}},
                                                                    "type": {"variable": "hydra.core.model.Type"}}},
                                                                "type": {"variable": "hydra.core.typing.InferenceContext"}}}}},
                                                        "type": {"variable": "hydra.core.errors.Error"}}},
                                                    "type": {"pair": {"first": {"variable": "hydra.core.model.Type"}, "second": {"variable": "hydra.core.typing.InferenceContext"}}}}}}}}}}}}}}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {
                    "literal": {
                      "string": "Reconstruct the type of a wrapped term (Either/InferenceContext version). Paper: inference.tex, rule Wrp (checking side)."}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.checking.typesAllEffectivelyEqual",
        "signature": {
          "typeParameters": [],
          "parameters": [
            {"name": "arg0", "type": {"variable": "hydra.core.graph.Graph"}, "isLazy": false},
            {"name": "arg1", "type": {"list": {"variable": "hydra.core.model.Type"}}, "isLazy": false}],
          "result": {"type": {"literal": "boolean"}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "tx",
                "domain": {"variable": "hydra.core.graph.Graph"},
                "body": {
                  "lambda": {
                    "parameter": "tlist",
                    "domain": {"list": {"variable": "hydra.core.model.Type"}},
                    "body": {
                      "let": {
                        "bindings": [
                          {
                            "name": "types",
                            "term": {
                              "application": {
                                "function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "schemaTypes"}},
                                "argument": {"variable": "tx"}}},
                            "typeScheme": {
                              "variables": [],
                              "body": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.TypeScheme"}}},
                              "constraints": []}}],
                        "body": {
                          "let": {
                            "bindings": [
                              {
                                "name": "containsFreeVar",
                                "term": {
                                  "lambda": {
                                    "parameter": "t",
                                    "domain": {"variable": "hydra.core.model.Type"},
                                    "body": {
                                      "let": {
                                        "bindings": [
                                          {
                                            "name": "allVars",
                                            "term": {
                                              "application": {"function": {"variable": "hydra.core.variables.freeVariablesInTypeSimple"}, "argument": {"variable": "t"}}},
                                            "typeScheme": {"variables": [], "body": {"set": {"variable": "hydra.core.model.Name"}}, "constraints": []}}],
                                        "body": {
                                          "let": {
                                            "bindings": [
                                              {
                                                "name": "schemaNames",
                                                "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": {"variable": "types"}}}}},
                                                "typeScheme": {"variables": [], "body": {"set": {"variable": "hydra.core.model.Name"}}, "constraints": []}}],
                                            "body": {
                                              "application": {
                                                "function": {"variable": "hydra.core.lib.logic.not"},
                                                "argument": {
                                                  "application": {
                                                    "function": {
                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.sets.isEmpty"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                    "argument": {
                                                      "application": {
                                                        "function": {
                                                          "application": {
                                                            "function": {
                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.sets.difference"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                            "argument": {"variable": "allVars"}}},
                                                        "argument": {"variable": "schemaNames"}}}}}}}}}}}}},
                                "typeScheme": {
                                  "variables": [],
                                  "body": {"function": {"domain": {"variable": "hydra.core.model.Type"}, "codomain": {"literal": "boolean"}}},
                                  "constraints": []}}],
                            "body": {
                              "let": {
                                "bindings": [
                                  {
                                    "name": "anyContainsFreeVar",
                                    "term": {
                                      "application": {
                                        "function": {
                                          "application": {
                                            "function": {
                                              "application": {
                                                "function": {
                                                  "typeApplication": {
                                                    "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.foldl"}, "type": {"literal": "boolean"}}},
                                                    "type": {"variable": "hydra.core.model.Type"}}},
                                                "argument": {
                                                  "lambda": {
                                                    "parameter": "acc",
                                                    "domain": {"literal": "boolean"},
                                                    "body": {
                                                      "lambda": {
                                                        "parameter": "t",
                                                        "domain": {"variable": "hydra.core.model.Type"},
                                                        "body": {
                                                          "application": {
                                                            "function": {"application": {"function": {"variable": "hydra.core.lib.logic.or"}, "argument": {"variable": "acc"}}},
                                                            "argument": {"application": {"function": {"variable": "containsFreeVar"}, "argument": {"variable": "t"}}}}}}}}}}},
                                            "argument": {"literal": {"boolean": false}}}},
                                        "argument": {"variable": "tlist"}}},
                                    "typeScheme": {"variables": [], "body": {"literal": "boolean"}, "constraints": []}}],
                                "body": {
                                  "application": {
                                    "function": {
                                      "application": {
                                        "function": {
                                          "application": {
                                            "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.logic.ifElse"}, "type": {"literal": "boolean"}}},
                                            "argument": {"variable": "anyContainsFreeVar"}}},
                                        "argument": {"literal": {"boolean": true}}}},
                                    "argument": {
                                      "application": {
                                        "function": {
                                          "application": {
                                            "function": {
                                              "application": {
                                                "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.logic.ifElse"}, "type": {"literal": "boolean"}}},
                                                "argument": {
                                                  "application": {
                                                    "function": {
                                                      "typeApplication": {"body": {"variable": "hydra.core.checking.allEqual"}, "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.Type"}}},
                                                                "type": {"variable": "hydra.core.model.Type"}}},
                                                            "argument": {
                                                              "lambda": {
                                                                "parameter": "t",
                                                                "domain": {"variable": "hydra.core.model.Type"},
                                                                "body": {"application": {"function": {"variable": "hydra.core.checking.normalizeTypeFreeVars"}, "argument": {"variable": "t"}}}}}}},
                                                        "argument": {"variable": "tlist"}}}}}}},
                                            "argument": {"literal": {"boolean": true}}}},
                                        "argument": {
                                          "application": {
                                            "function": {
                                              "typeApplication": {"body": {"variable": "hydra.core.checking.allEqual"}, "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.Type"}}},
                                                        "type": {"variable": "hydra.core.model.Type"}}},
                                                    "argument": {
                                                      "lambda": {
                                                        "parameter": "t",
                                                        "domain": {"variable": "hydra.core.model.Type"},
                                                        "body": {
                                                          "application": {
                                                            "function": {"variable": "hydra.core.checking.normalizeTypeFreeVars"},
                                                            "argument": {
                                                              "application": {
                                                                "function": {"variable": "hydra.core.strip.deannotateTypeRecursive"},
                                                                "argument": {
                                                                  "application": {
                                                                    "function": {
                                                                      "application": {"function": {"variable": "hydra.core.dependencies.replaceTypedefs"}, "argument": {"variable": "types"}}},
                                                                    "argument": {"variable": "t"}}}}}}}}}}},
                                                "argument": {"variable": "tlist"}}}}}}}}}}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {
                    "literal": {
                      "string": "Check whether a list of types are effectively equal, disregarding type aliases and free type variable naming. Also treats free type variables (not in schema) as wildcards, since inference has already verified consistency."}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.checking.typesEffectivelyEqual",
        "signature": {
          "typeParameters": [],
          "parameters": [
            {"name": "arg0", "type": {"variable": "hydra.core.graph.Graph"}, "isLazy": false},
            {"name": "arg1", "type": {"variable": "hydra.core.model.Type"}, "isLazy": false},
            {"name": "arg2", "type": {"variable": "hydra.core.model.Type"}, "isLazy": false}],
          "result": {"type": {"literal": "boolean"}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "tx",
                "domain": {"variable": "hydra.core.graph.Graph"},
                "body": {
                  "lambda": {
                    "parameter": "t1",
                    "domain": {"variable": "hydra.core.model.Type"},
                    "body": {
                      "lambda": {
                        "parameter": "t2",
                        "domain": {"variable": "hydra.core.model.Type"},
                        "body": {
                          "application": {
                            "function": {
                              "application": {
                                "function": {"variable": "hydra.core.lib.logic.or"},
                                "argument": {
                                  "application": {
                                    "function": {
                                      "application": {"function": {"variable": "hydra.core.checking.containsInScopeTypeVars"}, "argument": {"variable": "tx"}}},
                                    "argument": {"variable": "t1"}}}}},
                            "argument": {
                              "application": {
                                "function": {
                                  "application": {
                                    "function": {"variable": "hydra.core.lib.logic.or"},
                                    "argument": {
                                      "application": {
                                        "function": {
                                          "application": {"function": {"variable": "hydra.core.checking.containsInScopeTypeVars"}, "argument": {"variable": "tx"}}},
                                        "argument": {"variable": "t2"}}}}},
                                "argument": {
                                  "application": {
                                    "function": {
                                      "application": {"function": {"variable": "hydra.core.checking.typesAllEffectivelyEqual"}, "argument": {"variable": "tx"}}},
                                    "argument": {
                                      "list": [
                                        {
                                          "application": {"function": {"variable": "hydra.core.resolution.fullyStripAndNormalizeType"}, "argument": {"variable": "t1"}}},
                                        {
                                          "application": {"function": {"variable": "hydra.core.resolution.fullyStripAndNormalizeType"}, "argument": {"variable": "t2"}}}]}}}}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {
                    "literal": {
                      "string": "Check whether two types are effectively equal, disregarding type aliases, forall quantifiers, and treating in-scope type variables as wildcards. Paper: inference.tex, 'Checking the witness' (effective equality, the type-level analogue of the referential-transparency equality of terms)."}}}]}}}}}]}