packages feed

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

{
  "name": "hydra.core.analysis",
  "metadata": {"description": "Module dependency module name analysis", "comments": [], "seeAlso": [], "provisions": []},
  "dependencies": [
    {"module": "hydra.core.annotations"},
    {"module": "hydra.core.checking"},
    {"module": "hydra.core.coders"},
    {"module": "hydra.core.constants"},
    {"module": "hydra.core.decode.model"},
    {"module": "hydra.core.dependencies"},
    {"module": "hydra.core.encode.model"},
    {"module": "hydra.core.errors"},
    {"module": "hydra.core.lib.eithers"},
    {"module": "hydra.core.lib.equality"},
    {"module": "hydra.core.lib.lists"},
    {"module": "hydra.core.lib.logic"},
    {"module": "hydra.core.lib.maps"},
    {"module": "hydra.core.lib.math"},
    {"module": "hydra.core.lib.optionals"},
    {"module": "hydra.core.lib.pairs"},
    {"module": "hydra.core.lib.sets"},
    {"module": "hydra.core.model"},
    {"module": "hydra.core.names"},
    {"module": "hydra.core.packaging"},
    {"module": "hydra.core.predicates"},
    {"module": "hydra.core.rewriting"},
    {"module": "hydra.core.scoping"},
    {"module": "hydra.core.strip"},
    {"module": "hydra.core.typing"},
    {"module": "hydra.core.util"},
    {"module": "hydra.core.variables"}],
  "definitions": [
    {
      "term": {
        "name": "hydra.core.analysis.addNamesToModuleNames",
        "signature": {
          "typeParameters": [{"name": "t0", "constraints": []}],
          "parameters": [
            {
              "name": "arg0",
              "type": {"function": {"domain": {"variable": "hydra.core.packaging.ModuleName"}, "codomain": {"variable": "t0"}}},
              "isLazy": false},
            {"name": "arg1", "type": {"set": {"variable": "hydra.core.model.Name"}}, "isLazy": false},
            {
              "name": "arg2",
              "type": {"application": {"function": {"variable": "hydra.core.util.ModuleNames"}, "argument": {"variable": "t0"}}},
              "isLazy": false}],
          "result": {"type": {"application": {"function": {"variable": "hydra.core.util.ModuleNames"}, "argument": {"variable": "t0"}}}}},
        "body": {
          "typeLambda": {
            "parameter": "t0",
            "body": {
              "annotated": {
                "body": {
                  "lambda": {
                    "parameter": "encodeModuleName",
                    "domain": {"function": {"domain": {"variable": "hydra.core.packaging.ModuleName"}, "codomain": {"variable": "t0"}}},
                    "body": {
                      "lambda": {
                        "parameter": "names",
                        "domain": {"set": {"variable": "hydra.core.model.Name"}},
                        "body": {
                          "lambda": {
                            "parameter": "ns0",
                            "domain": {"application": {"function": {"variable": "hydra.core.util.ModuleNames"}, "argument": {"variable": "t0"}}},
                            "body": {
                              "let": {
                                "bindings": [
                                  {
                                    "name": "nss",
                                    "term": {
                                      "application": {
                                        "function": {
                                          "typeApplication": {"body": {"variable": "hydra.core.lib.sets.fromList"}, "type": {"variable": "hydra.core.packaging.ModuleName"}}},
                                        "argument": {
                                          "application": {
                                            "function": {
                                              "typeApplication": {"body": {"variable": "hydra.core.lib.optionals.givens"}, "type": {"variable": "hydra.core.packaging.ModuleName"}}},
                                            "argument": {
                                              "application": {
                                                "function": {
                                                  "application": {
                                                    "function": {
                                                      "typeApplication": {
                                                        "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                        "type": {"optional": {"variable": "hydra.core.packaging.ModuleName"}}}},
                                                    "argument": {"variable": "hydra.core.names.moduleNameOf"}}},
                                                "argument": {
                                                  "application": {
                                                    "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.toList"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                    "argument": {"variable": "names"}}}}}}}}},
                                    "typeScheme": {"variables": [], "body": {"set": {"variable": "hydra.core.packaging.ModuleName"}}, "constraints": []}}],
                                "body": {
                                  "let": {
                                    "bindings": [
                                      {
                                        "name": "toPair",
                                        "term": {
                                          "lambda": {
                                            "parameter": "ns",
                                            "domain": {"variable": "hydra.core.packaging.ModuleName"},
                                            "body": {
                                              "typeApplication": {
                                                "body": {
                                                  "typeApplication": {
                                                    "body": {
                                                      "pair": {
                                                        "first": {"variable": "ns"},
                                                        "second": {"application": {"function": {"variable": "encodeModuleName"}, "argument": {"variable": "ns"}}}}},
                                                    "type": {"variable": "hydra.core.packaging.ModuleName"}}},
                                                "type": {"variable": "t0"}}}}},
                                        "typeScheme": {
                                          "variables": [],
                                          "body": {
                                            "function": {
                                              "domain": {"variable": "hydra.core.packaging.ModuleName"},
                                              "codomain": {"pair": {"first": {"variable": "hydra.core.packaging.ModuleName"}, "second": {"variable": "t0"}}}}},
                                          "constraints": []}}],
                                    "body": {
                                      "typeApplication": {
                                        "body": {
                                          "record": {
                                            "typeName": "hydra.core.util.ModuleNames",
                                            "fields": [
                                              {
                                                "name": "focus",
                                                "term": {
                                                  "application": {
                                                    "function": {
                                                      "typeApplication": {"body": {"project": {"typeName": "hydra.core.util.ModuleNames", "fieldName": "focus"}}, "type": {"variable": "t0"}}},
                                                    "argument": {"variable": "ns0"}}}},
                                              {
                                                "name": "mapping",
                                                "term": {
                                                  "application": {
                                                    "function": {
                                                      "application": {
                                                        "function": {
                                                          "typeApplication": {
                                                            "body": {
                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.maps.union"}, "type": {"variable": "hydra.core.packaging.ModuleName"}}},
                                                            "type": {"variable": "t0"}}},
                                                        "argument": {
                                                          "application": {
                                                            "function": {
                                                              "typeApplication": {"body": {"project": {"typeName": "hydra.core.util.ModuleNames", "fieldName": "mapping"}}, "type": {"variable": "t0"}}},
                                                            "argument": {"variable": "ns0"}}}}},
                                                    "argument": {
                                                      "application": {
                                                        "function": {
                                                          "typeApplication": {
                                                            "body": {
                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.maps.fromList"}, "type": {"variable": "hydra.core.packaging.ModuleName"}}},
                                                            "type": {"variable": "t0"}}},
                                                        "argument": {
                                                          "application": {
                                                            "function": {
                                                              "application": {
                                                                "function": {
                                                                  "typeApplication": {
                                                                    "body": {
                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.packaging.ModuleName"}}},
                                                                    "type": {"pair": {"first": {"variable": "hydra.core.packaging.ModuleName"}, "second": {"variable": "t0"}}}}},
                                                                "argument": {"variable": "toPair"}}},
                                                            "argument": {
                                                              "application": {
                                                                "function": {
                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.sets.toList"}, "type": {"variable": "hydra.core.packaging.ModuleName"}}},
                                                                "argument": {"variable": "nss"}}}}}}}}}}]}},
                                        "type": {"variable": "t0"}}}}}}}}}}}}},
                "annotation": {
                  "map": [{"key": {"variable": "description"}, "value": {"literal": {"string": "Add names to existing module names mapping"}}}]}}}}}}},
    {
      "term": {
        "name": "hydra.core.analysis.allBinderNamesInDefinitions",
        "signature": {
          "typeParameters": [],
          "parameters": [{"name": "arg0", "type": {"list": {"variable": "hydra.core.packaging.Definition"}}, "isLazy": false}],
          "result": {"type": {"set": {"variable": "hydra.core.model.Name"}}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "defs",
                "domain": {"list": {"variable": "hydra.core.packaging.Definition"}},
                "body": {
                  "let": {
                    "bindings": [
                      {
                        "name": "binderSetOf",
                        "term": {
                          "lambda": {
                            "parameter": "def",
                            "domain": {"variable": "hydra.core.packaging.Definition"},
                            "body": {
                              "application": {
                                "function": {
                                  "cases": {
                                    "typeName": "hydra.core.packaging.Definition",
                                    "cases": [
                                      {
                                        "name": "type",
                                        "handler": {
                                          "lambda": {
                                            "parameter": "td",
                                            "domain": {"variable": "hydra.core.packaging.TypeDefinition"},
                                            "body": {
                                              "application": {
                                                "function": {
                                                  "application": {
                                                    "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.union"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                    "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": {
                                                              "application": {
                                                                "function": {"project": {"typeName": "hydra.core.packaging.TypeDefinition", "fieldName": "body"}},
                                                                "argument": {"variable": "td"}}}}}}}}},
                                                "argument": {
                                                  "application": {
                                                    "function": {"variable": "hydra.core.analysis.allBinderNamesInType"},
                                                    "argument": {
                                                      "application": {
                                                        "function": {"project": {"typeName": "hydra.core.model.TypeScheme", "fieldName": "body"}},
                                                        "argument": {
                                                          "application": {
                                                            "function": {"project": {"typeName": "hydra.core.packaging.TypeDefinition", "fieldName": "body"}},
                                                            "argument": {"variable": "td"}}}}}}}}}}}},
                                      {
                                        "name": "term",
                                        "handler": {
                                          "lambda": {
                                            "parameter": "termDef",
                                            "domain": {"variable": "hydra.core.packaging.TermDefinition"},
                                            "body": {
                                              "application": {
                                                "function": {"variable": "hydra.core.analysis.allBinderNamesInTerm"},
                                                "argument": {
                                                  "application": {
                                                    "function": {"project": {"typeName": "hydra.core.packaging.TermDefinition", "fieldName": "body"}},
                                                    "argument": {"variable": "termDef"}}}}}}}},
                                      {
                                        "name": "primitive",
                                        "handler": {
                                          "lambda": {
                                            "parameter": "primDef",
                                            "domain": {"variable": "hydra.core.packaging.PrimitiveDefinition"},
                                            "body": {
                                              "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": {
                                                      "application": {
                                                        "function": {"variable": "hydra.core.scoping.termSignatureToTypeScheme"},
                                                        "argument": {
                                                          "application": {
                                                            "function": {"project": {"typeName": "hydra.core.packaging.PrimitiveDefinition", "fieldName": "signature"}},
                                                            "argument": {"variable": "primDef"}}}}}}}}}}}}]}},
                                "argument": {"variable": "def"}}}}},
                        "typeScheme": {
                          "variables": [],
                          "body": {
                            "function": {"domain": {"variable": "hydra.core.packaging.Definition"}, "codomain": {"set": {"variable": "hydra.core.model.Name"}}}},
                          "constraints": []}}],
                    "body": {
                      "application": {
                        "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.unions"}, "type": {"variable": "hydra.core.model.Name"}}},
                        "argument": {
                          "application": {
                            "function": {
                              "application": {
                                "function": {
                                  "typeApplication": {
                                    "body": {
                                      "typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.packaging.Definition"}}},
                                    "type": {"set": {"variable": "hydra.core.model.Name"}}}},
                                "argument": {"variable": "binderSetOf"}}},
                            "argument": {"variable": "defs"}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {"literal": {"string": "Find every lambda/let/forall-bound name anywhere within a list of definitions"}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.analysis.allBinderNamesInTerm",
        "signature": {
          "typeParameters": [],
          "parameters": [{"name": "arg0", "type": {"variable": "hydra.core.model.Term"}, "isLazy": false}],
          "result": {"type": {"set": {"variable": "hydra.core.model.Name"}}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "term",
                "domain": {"variable": "hydra.core.model.Term"},
                "body": {
                  "let": {
                    "bindings": [
                      {
                        "name": "ownBinders",
                        "term": {
                          "application": {
                            "function": {
                              "cases": {
                                "typeName": "hydra.core.model.Term",
                                "default": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.empty"}, "type": {"variable": "hydra.core.model.Name"}}},
                                "cases": [
                                  {
                                    "name": "lambda",
                                    "handler": {
                                      "lambda": {
                                        "parameter": "l",
                                        "domain": {"variable": "hydra.core.model.Lambda"},
                                        "body": {
                                          "application": {
                                            "function": {
                                              "typeApplication": {"body": {"variable": "hydra.core.lib.sets.singleton"}, "type": {"variable": "hydra.core.model.Name"}}},
                                            "argument": {
                                              "application": {
                                                "function": {"project": {"typeName": "hydra.core.model.Lambda", "fieldName": "parameter"}},
                                                "argument": {"variable": "l"}}}}}}}},
                                  {
                                    "name": "let",
                                    "handler": {
                                      "lambda": {
                                        "parameter": "l",
                                        "domain": {"variable": "hydra.core.model.Let"},
                                        "body": {
                                          "application": {
                                            "function": {
                                              "typeApplication": {"body": {"variable": "hydra.core.lib.sets.fromList"}, "type": {"variable": "hydra.core.model.Name"}}},
                                            "argument": {
                                              "application": {
                                                "function": {
                                                  "application": {
                                                    "function": {
                                                      "typeApplication": {
                                                        "body": {
                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.model.Binding"}}},
                                                        "type": {"variable": "hydra.core.model.Name"}}},
                                                    "argument": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "name"}}}},
                                                "argument": {
                                                  "application": {"function": {"project": {"typeName": "hydra.core.model.Let", "fieldName": "bindings"}}, "argument": {"variable": "l"}}}}}}}}}}]}},
                            "argument": {"variable": "term"}}},
                        "typeScheme": {"variables": [], "body": {"set": {"variable": "hydra.core.model.Name"}}, "constraints": []}}],
                    "body": {
                      "application": {
                        "function": {
                          "application": {
                            "function": {
                              "application": {
                                "function": {
                                  "typeApplication": {
                                    "body": {
                                      "typeApplication": {"body": {"variable": "hydra.core.lib.lists.foldl"}, "type": {"set": {"variable": "hydra.core.model.Name"}}}},
                                    "type": {"variable": "hydra.core.model.Term"}}},
                                "argument": {
                                  "lambda": {
                                    "parameter": "s",
                                    "domain": {"set": {"variable": "hydra.core.model.Name"}},
                                    "body": {
                                      "lambda": {
                                        "parameter": "t",
                                        "domain": {"variable": "hydra.core.model.Term"},
                                        "body": {
                                          "application": {
                                            "function": {
                                              "application": {
                                                "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.union"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                "argument": {"variable": "s"}}},
                                            "argument": {"application": {"function": {"variable": "hydra.core.analysis.allBinderNamesInTerm"}, "argument": {"variable": "t"}}}}}}}}}}},
                            "argument": {"variable": "ownBinders"}}},
                        "argument": {"application": {"function": {"variable": "hydra.core.rewriting.subterms"}, "argument": {"variable": "term"}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {
                    "literal": {"string": "Find every name bound by a lambda or let-binding anywhere within a term, including nested binders"}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.analysis.allBinderNamesInType",
        "signature": {
          "typeParameters": [],
          "parameters": [{"name": "arg0", "type": {"variable": "hydra.core.model.Type"}, "isLazy": false}],
          "result": {"type": {"set": {"variable": "hydra.core.model.Name"}}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "typ",
                "domain": {"variable": "hydra.core.model.Type"},
                "body": {
                  "let": {
                    "bindings": [
                      {
                        "name": "ownBinders",
                        "term": {
                          "application": {
                            "function": {
                              "cases": {
                                "typeName": "hydra.core.model.Type",
                                "default": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.empty"}, "type": {"variable": "hydra.core.model.Name"}}},
                                "cases": [
                                  {
                                    "name": "forall",
                                    "handler": {
                                      "lambda": {
                                        "parameter": "ft",
                                        "domain": {"variable": "hydra.core.model.ForallType"},
                                        "body": {
                                          "application": {
                                            "function": {
                                              "typeApplication": {"body": {"variable": "hydra.core.lib.sets.singleton"}, "type": {"variable": "hydra.core.model.Name"}}},
                                            "argument": {
                                              "application": {
                                                "function": {"project": {"typeName": "hydra.core.model.ForallType", "fieldName": "parameter"}},
                                                "argument": {"variable": "ft"}}}}}}}}]}},
                            "argument": {"variable": "typ"}}},
                        "typeScheme": {"variables": [], "body": {"set": {"variable": "hydra.core.model.Name"}}, "constraints": []}}],
                    "body": {
                      "application": {
                        "function": {
                          "application": {
                            "function": {
                              "application": {
                                "function": {
                                  "typeApplication": {
                                    "body": {
                                      "typeApplication": {"body": {"variable": "hydra.core.lib.lists.foldl"}, "type": {"set": {"variable": "hydra.core.model.Name"}}}},
                                    "type": {"variable": "hydra.core.model.Type"}}},
                                "argument": {
                                  "lambda": {
                                    "parameter": "s",
                                    "domain": {"set": {"variable": "hydra.core.model.Name"}},
                                    "body": {
                                      "lambda": {
                                        "parameter": "t",
                                        "domain": {"variable": "hydra.core.model.Type"},
                                        "body": {
                                          "application": {
                                            "function": {
                                              "application": {
                                                "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.union"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                "argument": {"variable": "s"}}},
                                            "argument": {"application": {"function": {"variable": "hydra.core.analysis.allBinderNamesInType"}, "argument": {"variable": "t"}}}}}}}}}}},
                            "argument": {"variable": "ownBinders"}}},
                        "argument": {"application": {"function": {"variable": "hydra.core.rewriting.subtypes"}, "argument": {"variable": "typ"}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {"literal": {"string": "Find every name bound by a forall anywhere within a type, including nested binders"}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.analysis.analyzeFunctionTerm",
        "signature": {
          "typeParameters": [{"name": "t0", "constraints": []}, {"name": "t1", "constraints": []}],
          "parameters": [
            {"name": "arg0", "type": {"variable": "hydra.core.typing.InferenceContext"}, "isLazy": false},
            {
              "name": "arg1",
              "type": {"function": {"domain": {"variable": "t0"}, "codomain": {"variable": "hydra.core.graph.Graph"}}},
              "isLazy": false},
            {
              "name": "arg2",
              "type": {
                "function": {
                  "domain": {"variable": "hydra.core.graph.Graph"},
                  "codomain": {"function": {"domain": {"variable": "t0"}, "codomain": {"variable": "t0"}}}}},
              "isLazy": false},
            {"name": "arg3", "type": {"variable": "t0"}, "isLazy": false},
            {"name": "arg4", "type": {"variable": "hydra.core.model.Term"}, "isLazy": false}],
          "result": {
            "type": {
              "either": {
                "left": {"variable": "t1"},
                "right": {"application": {"function": {"variable": "hydra.core.typing.FunctionStructure"}, "argument": {"variable": "t0"}}}}}}},
        "body": {
          "typeLambda": {
            "parameter": "t0",
            "body": {
              "typeLambda": {
                "parameter": "t1",
                "body": {
                  "annotated": {
                    "body": {
                      "lambda": {
                        "parameter": "cx",
                        "domain": {"variable": "hydra.core.typing.InferenceContext"},
                        "body": {
                          "lambda": {
                            "parameter": "getTC",
                            "domain": {"function": {"domain": {"variable": "t0"}, "codomain": {"variable": "hydra.core.graph.Graph"}}},
                            "body": {
                              "lambda": {
                                "parameter": "setTC",
                                "domain": {
                                  "function": {
                                    "domain": {"variable": "hydra.core.graph.Graph"},
                                    "codomain": {"function": {"domain": {"variable": "t0"}, "codomain": {"variable": "t0"}}}}},
                                "body": {
                                  "lambda": {
                                    "parameter": "env",
                                    "domain": {"variable": "t0"},
                                    "body": {
                                      "lambda": {
                                        "parameter": "term",
                                        "domain": {"variable": "hydra.core.model.Term"},
                                        "body": {
                                          "application": {
                                            "function": {
                                              "application": {
                                                "function": {
                                                  "application": {
                                                    "function": {
                                                      "application": {
                                                        "function": {
                                                          "application": {
                                                            "function": {
                                                              "application": {
                                                                "function": {
                                                                  "typeApplication": {
                                                                    "body": {"typeApplication": {"body": {"variable": "hydra.core.analysis.analyzeFunctionTermWith"}, "type": {"variable": "t0"}}},
                                                                    "type": {"variable": "t1"}}},
                                                                "argument": {"variable": "cx"}}},
                                                            "argument": {
                                                              "lambda": {
                                                                "parameter": "g",
                                                                "domain": {"variable": "hydra.core.graph.Graph"},
                                                                "body": {
                                                                  "lambda": {
                                                                    "parameter": "b",
                                                                    "domain": {"variable": "hydra.core.model.Binding"},
                                                                    "body": {
                                                                      "application": {
                                                                        "function": {
                                                                          "application": {
                                                                            "function": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.logic.ifElse"}, "type": {"optional": {"variable": "hydra.core.model.Term"}}}},
                                                                                "argument": {
                                                                                  "application": {
                                                                                    "function": {"application": {"function": {"variable": "hydra.core.predicates.isComplexBinding"}, "argument": {"variable": "g"}}},
                                                                                    "argument": {"variable": "b"}}}}},
                                                                            "argument": {
                                                                              "optional": {
                                                                                "inject": {
                                                                                  "typeName": "hydra.core.model.Term",
                                                                                  "field": {
                                                                                    "name": "literal",
                                                                                    "term": {
                                                                                      "inject": {"typeName": "hydra.core.model.Literal", "field": {"name": "boolean", "term": {"literal": {"boolean": true}}}}}}}}}}},
                                                                        "argument": {"typeApplication": {"body": {"optional": null}, "type": {"variable": "hydra.core.model.Term"}}}}}}}}}}},
                                                        "argument": {"variable": "getTC"}}},
                                                    "argument": {"variable": "setTC"}}},
                                                "argument": {"variable": "env"}}},
                                            "argument": {"variable": "term"}}}}}}}}}}}}},
                    "annotation": {
                      "map": [
                        {
                          "key": {"variable": "description"},
                          "value": {"literal": {"string": "Analyze a function term, collecting lambdas, type lambdas, lets, and type applications"}}}]}}}}}}}}},
    {
      "term": {
        "name": "hydra.core.analysis.analyzeFunctionTermWith",
        "signature": {
          "typeParameters": [{"name": "t0", "constraints": []}, {"name": "t1", "constraints": []}],
          "parameters": [
            {"name": "arg0", "type": {"variable": "hydra.core.typing.InferenceContext"}, "isLazy": false},
            {
              "name": "arg1",
              "type": {
                "function": {
                  "domain": {"variable": "hydra.core.graph.Graph"},
                  "codomain": {
                    "function": {"domain": {"variable": "hydra.core.model.Binding"}, "codomain": {"optional": {"variable": "hydra.core.model.Term"}}}}}},
              "isLazy": false},
            {
              "name": "arg2",
              "type": {"function": {"domain": {"variable": "t0"}, "codomain": {"variable": "hydra.core.graph.Graph"}}},
              "isLazy": false},
            {
              "name": "arg3",
              "type": {
                "function": {
                  "domain": {"variable": "hydra.core.graph.Graph"},
                  "codomain": {"function": {"domain": {"variable": "t0"}, "codomain": {"variable": "t0"}}}}},
              "isLazy": false},
            {"name": "arg4", "type": {"variable": "t0"}, "isLazy": false},
            {"name": "arg5", "type": {"variable": "hydra.core.model.Term"}, "isLazy": false}],
          "result": {
            "type": {
              "either": {
                "left": {"variable": "t1"},
                "right": {"application": {"function": {"variable": "hydra.core.typing.FunctionStructure"}, "argument": {"variable": "t0"}}}}}}},
        "body": {
          "typeLambda": {
            "parameter": "t0",
            "body": {
              "typeLambda": {
                "parameter": "t1",
                "body": {
                  "annotated": {
                    "body": {
                      "lambda": {
                        "parameter": "cx",
                        "domain": {"variable": "hydra.core.typing.InferenceContext"},
                        "body": {
                          "lambda": {
                            "parameter": "forBinding",
                            "domain": {
                              "function": {
                                "domain": {"variable": "hydra.core.graph.Graph"},
                                "codomain": {
                                  "function": {"domain": {"variable": "hydra.core.model.Binding"}, "codomain": {"optional": {"variable": "hydra.core.model.Term"}}}}}},
                            "body": {
                              "lambda": {
                                "parameter": "getTC",
                                "domain": {"function": {"domain": {"variable": "t0"}, "codomain": {"variable": "hydra.core.graph.Graph"}}},
                                "body": {
                                  "lambda": {
                                    "parameter": "setTC",
                                    "domain": {
                                      "function": {
                                        "domain": {"variable": "hydra.core.graph.Graph"},
                                        "codomain": {"function": {"domain": {"variable": "t0"}, "codomain": {"variable": "t0"}}}}},
                                    "body": {
                                      "lambda": {
                                        "parameter": "env",
                                        "domain": {"variable": "t0"},
                                        "body": {
                                          "lambda": {
                                            "parameter": "term",
                                            "domain": {"variable": "hydra.core.model.Term"},
                                            "body": {
                                              "application": {
                                                "function": {
                                                  "application": {
                                                    "function": {
                                                      "application": {
                                                        "function": {
                                                          "application": {
                                                            "function": {
                                                              "application": {
                                                                "function": {
                                                                  "application": {
                                                                    "function": {
                                                                      "application": {
                                                                        "function": {
                                                                          "application": {
                                                                            "function": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "application": {
                                                                                    "function": {
                                                                                      "application": {
                                                                                        "function": {
                                                                                          "application": {
                                                                                            "function": {
                                                                                              "typeApplication": {
                                                                                                "body": {
                                                                                                  "typeApplication": {"body": {"variable": "hydra.core.analysis.analyzeFunctionTermWithGather"}, "type": {"variable": "t0"}}},
                                                                                                "type": {"variable": "t1"}}},
                                                                                            "argument": {"variable": "cx"}}},
                                                                                        "argument": {"variable": "forBinding"}}},
                                                                                    "argument": {"variable": "getTC"}}},
                                                                                "argument": {"variable": "setTC"}}},
                                                                            "argument": {"literal": {"boolean": true}}}},
                                                                        "argument": {"variable": "env"}}},
                                                                    "argument": {"typeApplication": {"body": {"list": []}, "type": {"variable": "hydra.core.model.Name"}}}}},
                                                                "argument": {"typeApplication": {"body": {"list": []}, "type": {"variable": "hydra.core.model.Name"}}}}},
                                                            "argument": {"typeApplication": {"body": {"list": []}, "type": {"variable": "hydra.core.model.Binding"}}}}},
                                                        "argument": {"typeApplication": {"body": {"list": []}, "type": {"variable": "hydra.core.model.Type"}}}}},
                                                    "argument": {"typeApplication": {"body": {"list": []}, "type": {"variable": "hydra.core.model.Type"}}}}},
                                                "argument": {"variable": "term"}}}}}}}}}}}}}}},
                    "annotation": {
                      "map": [
                        {
                          "key": {"variable": "description"},
                          "value": {"literal": {"string": "Analyze a function term with configurable binding metadata"}}}]}}}}}}}}},
    {
      "term": {
        "name": "hydra.core.analysis.analyzeFunctionTermWithFinish",
        "signature": {
          "typeParameters": [{"name": "t0", "constraints": []}, {"name": "t1", "constraints": []}],
          "parameters": [
            {"name": "arg0", "type": {"variable": "hydra.core.typing.InferenceContext"}, "isLazy": false},
            {
              "name": "arg1",
              "type": {"function": {"domain": {"variable": "t0"}, "codomain": {"variable": "hydra.core.graph.Graph"}}},
              "isLazy": false},
            {"name": "arg2", "type": {"variable": "t0"}, "isLazy": false},
            {"name": "arg3", "type": {"list": {"variable": "hydra.core.model.Name"}}, "isLazy": false},
            {"name": "arg4", "type": {"list": {"variable": "hydra.core.model.Name"}}, "isLazy": false},
            {"name": "arg5", "type": {"list": {"variable": "hydra.core.model.Binding"}}, "isLazy": false},
            {"name": "arg6", "type": {"list": {"variable": "hydra.core.model.Type"}}, "isLazy": false},
            {"name": "arg7", "type": {"list": {"variable": "hydra.core.model.Type"}}, "isLazy": false},
            {"name": "arg8", "type": {"variable": "hydra.core.model.Term"}, "isLazy": false}],
          "result": {
            "type": {
              "either": {
                "left": {"variable": "t1"},
                "right": {"application": {"function": {"variable": "hydra.core.typing.FunctionStructure"}, "argument": {"variable": "t0"}}}}}}},
        "body": {
          "typeLambda": {
            "parameter": "t0",
            "body": {
              "typeLambda": {
                "parameter": "t1",
                "body": {
                  "annotated": {
                    "body": {
                      "lambda": {
                        "parameter": "cx",
                        "domain": {"variable": "hydra.core.typing.InferenceContext"},
                        "body": {
                          "lambda": {
                            "parameter": "getTC",
                            "domain": {"function": {"domain": {"variable": "t0"}, "codomain": {"variable": "hydra.core.graph.Graph"}}},
                            "body": {
                              "lambda": {
                                "parameter": "fEnv",
                                "domain": {"variable": "t0"},
                                "body": {
                                  "lambda": {
                                    "parameter": "tparams",
                                    "domain": {"list": {"variable": "hydra.core.model.Name"}},
                                    "body": {
                                      "lambda": {
                                        "parameter": "args",
                                        "domain": {"list": {"variable": "hydra.core.model.Name"}},
                                        "body": {
                                          "lambda": {
                                            "parameter": "bindings",
                                            "domain": {"list": {"variable": "hydra.core.model.Binding"}},
                                            "body": {
                                              "lambda": {
                                                "parameter": "doms",
                                                "domain": {"list": {"variable": "hydra.core.model.Type"}},
                                                "body": {
                                                  "lambda": {
                                                    "parameter": "tapps",
                                                    "domain": {"list": {"variable": "hydra.core.model.Type"}},
                                                    "body": {
                                                      "lambda": {
                                                        "parameter": "body",
                                                        "domain": {"variable": "hydra.core.model.Term"},
                                                        "body": {
                                                          "let": {
                                                            "bindings": [
                                                              {
                                                                "name": "bodyWithTapps",
                                                                "term": {
                                                                  "application": {
                                                                    "function": {
                                                                      "application": {
                                                                        "function": {
                                                                          "application": {
                                                                            "function": {
                                                                              "typeApplication": {
                                                                                "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.foldl"}, "type": {"variable": "hydra.core.model.Term"}}},
                                                                                "type": {"variable": "hydra.core.model.Type"}}},
                                                                            "argument": {
                                                                              "lambda": {
                                                                                "parameter": "trm",
                                                                                "domain": {"variable": "hydra.core.model.Term"},
                                                                                "body": {
                                                                                  "lambda": {
                                                                                    "parameter": "typ",
                                                                                    "domain": {"variable": "hydra.core.model.Type"},
                                                                                    "body": {
                                                                                      "inject": {
                                                                                        "typeName": "hydra.core.model.Term",
                                                                                        "field": {
                                                                                          "name": "typeApplication",
                                                                                          "term": {
                                                                                            "record": {
                                                                                              "typeName": "hydra.core.model.TypeApplicationTerm",
                                                                                              "fields": [{"name": "body", "term": {"variable": "trm"}}, {"name": "type", "term": {"variable": "typ"}}]}}}}}}}}}}},
                                                                        "argument": {"variable": "body"}}},
                                                                    "argument": {"variable": "tapps"}}},
                                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                                            "body": {
                                                              "let": {
                                                                "bindings": [
                                                                  {
                                                                    "name": "mcod",
                                                                    "term": {
                                                                      "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": {"variable": "hydra.core.model.Type"}}},
                                                                                    "type": {"optional": {"variable": "hydra.core.model.Type"}}}},
                                                                                "argument": {
                                                                                  "lambda": {
                                                                                    "parameter": "_",
                                                                                    "domain": {"variable": "hydra.core.errors.Error"},
                                                                                    "body": {"typeApplication": {"body": {"optional": null}, "type": {"variable": "hydra.core.model.Type"}}}}}}},
                                                                            "argument": {"lambda": {"parameter": "c", "domain": {"variable": "hydra.core.model.Type"}, "body": {"optional": {"variable": "c"}}}}}},
                                                                        "argument": {
                                                                          "application": {
                                                                            "function": {
                                                                              "application": {
                                                                                "function": {"application": {"function": {"variable": "hydra.core.checking.typeOfTerm"}, "argument": {"variable": "cx"}}},
                                                                                "argument": {"application": {"function": {"variable": "getTC"}, "argument": {"variable": "fEnv"}}}}},
                                                                            "argument": {"variable": "bodyWithTapps"}}}}},
                                                                    "typeScheme": {"variables": [], "body": {"optional": {"variable": "hydra.core.model.Type"}}, "constraints": []}}],
                                                                "body": {
                                                                  "typeApplication": {
                                                                    "body": {
                                                                      "typeApplication": {
                                                                        "body": {
                                                                          "either": {
                                                                            "right": {
                                                                              "typeApplication": {
                                                                                "body": {
                                                                                  "record": {
                                                                                    "typeName": "hydra.core.typing.FunctionStructure",
                                                                                    "fields": [
                                                                                      {
                                                                                        "name": "typeParams",
                                                                                        "term": {
                                                                                          "application": {
                                                                                            "function": {
                                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.lists.reverse"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                            "argument": {"variable": "tparams"}}}},
                                                                                      {
                                                                                        "name": "params",
                                                                                        "term": {
                                                                                          "application": {
                                                                                            "function": {
                                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.lists.reverse"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                            "argument": {"variable": "args"}}}},
                                                                                      {"name": "bindings", "term": {"variable": "bindings"}},
                                                                                      {"name": "body", "term": {"variable": "bodyWithTapps"}},
                                                                                      {
                                                                                        "name": "domains",
                                                                                        "term": {
                                                                                          "application": {
                                                                                            "function": {
                                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.lists.reverse"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                                            "argument": {"variable": "doms"}}}},
                                                                                      {"name": "codomain", "term": {"variable": "mcod"}},
                                                                                      {"name": "environment", "term": {"variable": "fEnv"}}]}},
                                                                                "type": {"variable": "t0"}}}}},
                                                                        "type": {"variable": "t1"}}},
                                                                    "type": {"application": {"function": {"variable": "hydra.core.typing.FunctionStructure"}, "argument": {"variable": "t0"}}}}}}}}}}}}}}}}}}}}}}}}}}},
                    "annotation": {
                      "map": [
                        {
                          "key": {"variable": "description"},
                          "value": {"literal": {"string": "Final step of the function-term walk: type-apply the body and assemble the FunctionStructure"}}}]}}}}}}}}},
    {
      "term": {
        "name": "hydra.core.analysis.analyzeFunctionTermWithGather",
        "signature": {
          "typeParameters": [{"name": "t0", "constraints": []}, {"name": "t1", "constraints": []}],
          "parameters": [
            {"name": "arg0", "type": {"variable": "hydra.core.typing.InferenceContext"}, "isLazy": false},
            {
              "name": "arg1",
              "type": {
                "function": {
                  "domain": {"variable": "hydra.core.graph.Graph"},
                  "codomain": {
                    "function": {"domain": {"variable": "hydra.core.model.Binding"}, "codomain": {"optional": {"variable": "hydra.core.model.Term"}}}}}},
              "isLazy": false},
            {
              "name": "arg2",
              "type": {"function": {"domain": {"variable": "t0"}, "codomain": {"variable": "hydra.core.graph.Graph"}}},
              "isLazy": false},
            {
              "name": "arg3",
              "type": {
                "function": {
                  "domain": {"variable": "hydra.core.graph.Graph"},
                  "codomain": {"function": {"domain": {"variable": "t0"}, "codomain": {"variable": "t0"}}}}},
              "isLazy": false},
            {"name": "arg4", "type": {"literal": "boolean"}, "isLazy": false},
            {"name": "arg5", "type": {"variable": "t0"}, "isLazy": false},
            {"name": "arg6", "type": {"list": {"variable": "hydra.core.model.Name"}}, "isLazy": false},
            {"name": "arg7", "type": {"list": {"variable": "hydra.core.model.Name"}}, "isLazy": false},
            {"name": "arg8", "type": {"list": {"variable": "hydra.core.model.Binding"}}, "isLazy": false},
            {"name": "arg9", "type": {"list": {"variable": "hydra.core.model.Type"}}, "isLazy": false},
            {"name": "arg10", "type": {"list": {"variable": "hydra.core.model.Type"}}, "isLazy": false},
            {"name": "arg11", "type": {"variable": "hydra.core.model.Term"}, "isLazy": false}],
          "result": {
            "type": {
              "either": {
                "left": {"variable": "t1"},
                "right": {"application": {"function": {"variable": "hydra.core.typing.FunctionStructure"}, "argument": {"variable": "t0"}}}}}}},
        "body": {
          "typeLambda": {
            "parameter": "t0",
            "body": {
              "typeLambda": {
                "parameter": "t1",
                "body": {
                  "annotated": {
                    "body": {
                      "lambda": {
                        "parameter": "cx",
                        "domain": {"variable": "hydra.core.typing.InferenceContext"},
                        "body": {
                          "lambda": {
                            "parameter": "forBinding",
                            "domain": {
                              "function": {
                                "domain": {"variable": "hydra.core.graph.Graph"},
                                "codomain": {
                                  "function": {"domain": {"variable": "hydra.core.model.Binding"}, "codomain": {"optional": {"variable": "hydra.core.model.Term"}}}}}},
                            "body": {
                              "lambda": {
                                "parameter": "getTC",
                                "domain": {"function": {"domain": {"variable": "t0"}, "codomain": {"variable": "hydra.core.graph.Graph"}}},
                                "body": {
                                  "lambda": {
                                    "parameter": "setTC",
                                    "domain": {
                                      "function": {
                                        "domain": {"variable": "hydra.core.graph.Graph"},
                                        "codomain": {"function": {"domain": {"variable": "t0"}, "codomain": {"variable": "t0"}}}}},
                                    "body": {
                                      "lambda": {
                                        "parameter": "argMode",
                                        "domain": {"literal": "boolean"},
                                        "body": {
                                          "lambda": {
                                            "parameter": "gEnv",
                                            "domain": {"variable": "t0"},
                                            "body": {
                                              "lambda": {
                                                "parameter": "tparams",
                                                "domain": {"list": {"variable": "hydra.core.model.Name"}},
                                                "body": {
                                                  "lambda": {
                                                    "parameter": "args",
                                                    "domain": {"list": {"variable": "hydra.core.model.Name"}},
                                                    "body": {
                                                      "lambda": {
                                                        "parameter": "bindings",
                                                        "domain": {"list": {"variable": "hydra.core.model.Binding"}},
                                                        "body": {
                                                          "lambda": {
                                                            "parameter": "doms",
                                                            "domain": {"list": {"variable": "hydra.core.model.Type"}},
                                                            "body": {
                                                              "lambda": {
                                                                "parameter": "tapps",
                                                                "domain": {"list": {"variable": "hydra.core.model.Type"}},
                                                                "body": {
                                                                  "lambda": {
                                                                    "parameter": "t",
                                                                    "domain": {"variable": "hydra.core.model.Term"},
                                                                    "body": {
                                                                      "application": {
                                                                        "function": {
                                                                          "cases": {
                                                                            "typeName": "hydra.core.model.Term",
                                                                            "default": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "application": {
                                                                                    "function": {
                                                                                      "application": {
                                                                                        "function": {
                                                                                          "application": {
                                                                                            "function": {
                                                                                              "application": {
                                                                                                "function": {
                                                                                                  "application": {
                                                                                                    "function": {
                                                                                                      "application": {
                                                                                                        "function": {
                                                                                                          "application": {
                                                                                                            "function": {
                                                                                                              "application": {
                                                                                                                "function": {
                                                                                                                  "typeApplication": {
                                                                                                                    "body": {
                                                                                                                      "typeApplication": {"body": {"variable": "hydra.core.analysis.analyzeFunctionTermWithFinish"}, "type": {"variable": "t0"}}},
                                                                                                                    "type": {"variable": "t1"}}},
                                                                                                                "argument": {"variable": "cx"}}},
                                                                                                            "argument": {"variable": "getTC"}}},
                                                                                                        "argument": {"variable": "gEnv"}}},
                                                                                                    "argument": {"variable": "tparams"}}},
                                                                                                "argument": {"variable": "args"}}},
                                                                                            "argument": {"variable": "bindings"}}},
                                                                                        "argument": {"variable": "doms"}}},
                                                                                    "argument": {"variable": "tapps"}}},
                                                                                "argument": {"variable": "t"}}},
                                                                            "cases": [
                                                                              {
                                                                                "name": "lambda",
                                                                                "handler": {
                                                                                  "lambda": {
                                                                                    "parameter": "lam",
                                                                                    "domain": {"variable": "hydra.core.model.Lambda"},
                                                                                    "body": {
                                                                                      "application": {
                                                                                        "function": {
                                                                                          "application": {
                                                                                            "function": {
                                                                                              "application": {
                                                                                                "function": {
                                                                                                  "typeApplication": {
                                                                                                    "body": {"variable": "hydra.core.lib.logic.ifElse"},
                                                                                                    "type": {
                                                                                                      "either": {
                                                                                                        "left": {"variable": "t1"},
                                                                                                        "right": {"application": {"function": {"variable": "hydra.core.typing.FunctionStructure"}, "argument": {"variable": "t0"}}}}}}},
                                                                                                "argument": {"variable": "argMode"}}},
                                                                                            "argument": {
                                                                                              "let": {
                                                                                                "bindings": [
                                                                                                  {
                                                                                                    "name": "v",
                                                                                                    "term": {
                                                                                                      "application": {
                                                                                                        "function": {"project": {"typeName": "hydra.core.model.Lambda", "fieldName": "parameter"}},
                                                                                                        "argument": {"variable": "lam"}}},
                                                                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Name"}, "constraints": []}}],
                                                                                                "body": {
                                                                                                  "let": {
                                                                                                    "bindings": [
                                                                                                      {
                                                                                                        "name": "dom",
                                                                                                        "term": {
                                                                                                          "application": {
                                                                                                            "function": {
                                                                                                              "application": {
                                                                                                                "function": {
                                                                                                                  "application": {
                                                                                                                    "function": {
                                                                                                                      "typeApplication": {
                                                                                                                        "body": {
                                                                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.optionals.match"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                                                                        "type": {"variable": "hydra.core.model.Type"}}},
                                                                                                                    "argument": {
                                                                                                                      "application": {
                                                                                                                        "function": {"project": {"typeName": "hydra.core.model.Lambda", "fieldName": "domain"}},
                                                                                                                        "argument": {"variable": "lam"}}}}},
                                                                                                                "argument": {
                                                                                                                  "inject": {
                                                                                                                    "typeName": "hydra.core.model.Type",
                                                                                                                    "field": {"name": "variable", "term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "_"}}}}}}}}},
                                                                                                            "argument": {"lambda": {"parameter": "x_", "domain": {"variable": "hydra.core.model.Type"}, "body": {"variable": "x_"}}}}},
                                                                                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
                                                                                                    "body": {
                                                                                                      "let": {
                                                                                                        "bindings": [
                                                                                                          {
                                                                                                            "name": "body",
                                                                                                            "term": {
                                                                                                              "application": {"function": {"project": {"typeName": "hydra.core.model.Lambda", "fieldName": "body"}}, "argument": {"variable": "lam"}}},
                                                                                                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                                                                                        "body": {
                                                                                                          "let": {
                                                                                                            "bindings": [
                                                                                                              {
                                                                                                                "name": "newEnv",
                                                                                                                "term": {
                                                                                                                  "application": {
                                                                                                                    "function": {
                                                                                                                      "application": {
                                                                                                                        "function": {"variable": "setTC"},
                                                                                                                        "argument": {
                                                                                                                          "application": {
                                                                                                                            "function": {
                                                                                                                              "application": {
                                                                                                                                "function": {"variable": "hydra.core.scoping.extendGraphForLambda"},
                                                                                                                                "argument": {"application": {"function": {"variable": "getTC"}, "argument": {"variable": "gEnv"}}}}},
                                                                                                                            "argument": {"variable": "lam"}}}}},
                                                                                                                    "argument": {"variable": "gEnv"}}},
                                                                                                                "typeScheme": {"variables": [], "body": {"variable": "t0"}, "constraints": []}}],
                                                                                                            "body": {
                                                                                                              "application": {
                                                                                                                "function": {
                                                                                                                  "application": {
                                                                                                                    "function": {
                                                                                                                      "application": {
                                                                                                                        "function": {
                                                                                                                          "application": {
                                                                                                                            "function": {
                                                                                                                              "application": {
                                                                                                                                "function": {
                                                                                                                                  "application": {
                                                                                                                                    "function": {
                                                                                                                                      "application": {
                                                                                                                                        "function": {
                                                                                                                                          "application": {
                                                                                                                                            "function": {
                                                                                                                                              "application": {
                                                                                                                                                "function": {
                                                                                                                                                  "application": {
                                                                                                                                                    "function": {
                                                                                                                                                      "application": {
                                                                                                                                                        "function": {
                                                                                                                                                          "application": {
                                                                                                                                                            "function": {
                                                                                                                                                              "typeApplication": {
                                                                                                                                                                "body": {
                                                                                                                                                                  "typeApplication": {"body": {"variable": "hydra.core.analysis.analyzeFunctionTermWithGather"}, "type": {"variable": "t0"}}},
                                                                                                                                                                "type": {"variable": "t1"}}},
                                                                                                                                                            "argument": {"variable": "cx"}}},
                                                                                                                                                        "argument": {"variable": "forBinding"}}},
                                                                                                                                                    "argument": {"variable": "getTC"}}},
                                                                                                                                                "argument": {"variable": "setTC"}}},
                                                                                                                                            "argument": {"variable": "argMode"}}},
                                                                                                                                        "argument": {"variable": "newEnv"}}},
                                                                                                                                    "argument": {"variable": "tparams"}}},
                                                                                                                                "argument": {
                                                                                                                                  "application": {
                                                                                                                                    "function": {
                                                                                                                                      "application": {
                                                                                                                                        "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.cons"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                                                        "argument": {"variable": "v"}}},
                                                                                                                                    "argument": {"variable": "args"}}}}},
                                                                                                                            "argument": {"variable": "bindings"}}},
                                                                                                                        "argument": {
                                                                                                                          "application": {
                                                                                                                            "function": {
                                                                                                                              "application": {
                                                                                                                                "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.cons"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                                                                                "argument": {"variable": "dom"}}},
                                                                                                                            "argument": {"variable": "doms"}}}}},
                                                                                                                    "argument": {"variable": "tapps"}}},
                                                                                                                "argument": {"variable": "body"}}}}}}}}}}}}},
                                                                                        "argument": {
                                                                                          "application": {
                                                                                            "function": {
                                                                                              "application": {
                                                                                                "function": {
                                                                                                  "application": {
                                                                                                    "function": {
                                                                                                      "application": {
                                                                                                        "function": {
                                                                                                          "application": {
                                                                                                            "function": {
                                                                                                              "application": {
                                                                                                                "function": {
                                                                                                                  "application": {
                                                                                                                    "function": {
                                                                                                                      "application": {
                                                                                                                        "function": {
                                                                                                                          "application": {
                                                                                                                            "function": {
                                                                                                                              "typeApplication": {
                                                                                                                                "body": {
                                                                                                                                  "typeApplication": {"body": {"variable": "hydra.core.analysis.analyzeFunctionTermWithFinish"}, "type": {"variable": "t0"}}},
                                                                                                                                "type": {"variable": "t1"}}},
                                                                                                                            "argument": {"variable": "cx"}}},
                                                                                                                        "argument": {"variable": "getTC"}}},
                                                                                                                    "argument": {"variable": "gEnv"}}},
                                                                                                                "argument": {"variable": "tparams"}}},
                                                                                                            "argument": {"variable": "args"}}},
                                                                                                        "argument": {"variable": "bindings"}}},
                                                                                                    "argument": {"variable": "doms"}}},
                                                                                                "argument": {"variable": "tapps"}}},
                                                                                            "argument": {"variable": "t"}}}}}}}},
                                                                              {
                                                                                "name": "let",
                                                                                "handler": {
                                                                                  "lambda": {
                                                                                    "parameter": "lt",
                                                                                    "domain": {"variable": "hydra.core.model.Let"},
                                                                                    "body": {
                                                                                      "let": {
                                                                                        "bindings": [
                                                                                          {
                                                                                            "name": "inScope0",
                                                                                            "term": {
                                                                                              "application": {
                                                                                                "function": {
                                                                                                  "application": {
                                                                                                    "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.union"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                    "argument": {
                                                                                                      "application": {
                                                                                                        "function": {
                                                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.sets.fromList"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                        "argument": {"variable": "args"}}}}},
                                                                                                "argument": {
                                                                                                  "application": {
                                                                                                    "function": {
                                                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.sets.fromList"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                    "argument": {
                                                                                                      "application": {
                                                                                                        "function": {
                                                                                                          "application": {
                                                                                                            "function": {
                                                                                                              "typeApplication": {
                                                                                                                "body": {
                                                                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.model.Binding"}}},
                                                                                                                "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                            "argument": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "name"}}}},
                                                                                                        "argument": {"variable": "bindings"}}}}}}},
                                                                                            "typeScheme": {"variables": [], "body": {"set": {"variable": "hydra.core.model.Name"}}, "constraints": []}}],
                                                                                        "body": {
                                                                                          "let": {
                                                                                            "bindings": [
                                                                                              {
                                                                                                "name": "resolveBinding",
                                                                                                "term": {
                                                                                                  "lambda": {
                                                                                                    "parameter": "acc",
                                                                                                    "domain": {
                                                                                                      "pair": {
                                                                                                        "first": {"list": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.model.Name"}}}},
                                                                                                        "second": {"set": {"variable": "hydra.core.model.Name"}}}},
                                                                                                    "body": {
                                                                                                      "lambda": {
                                                                                                        "parameter": "b",
                                                                                                        "domain": {"variable": "hydra.core.model.Binding"},
                                                                                                        "body": {
                                                                                                          "let": {
                                                                                                            "bindings": [
                                                                                                              {
                                                                                                                "name": "bname",
                                                                                                                "term": {
                                                                                                                  "application": {"function": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "name"}}, "argument": {"variable": "b"}}},
                                                                                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Name"}, "constraints": []}}],
                                                                                                            "body": {
                                                                                                              "let": {
                                                                                                                "bindings": [
                                                                                                                  {
                                                                                                                    "name": "resolvedSoFar",
                                                                                                                    "term": {
                                                                                                                      "application": {
                                                                                                                        "function": {
                                                                                                                          "typeApplication": {
                                                                                                                            "body": {
                                                                                                                              "typeApplication": {
                                                                                                                                "body": {"variable": "hydra.core.lib.pairs.first"},
                                                                                                                                "type": {"list": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.model.Name"}}}}}},
                                                                                                                            "type": {"set": {"variable": "hydra.core.model.Name"}}}},
                                                                                                                        "argument": {"variable": "acc"}}},
                                                                                                                    "typeScheme": {
                                                                                                                      "variables": [],
                                                                                                                      "body": {"list": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.model.Name"}}}},
                                                                                                                      "constraints": []}}],
                                                                                                                "body": {
                                                                                                                  "let": {
                                                                                                                    "bindings": [
                                                                                                                      {
                                                                                                                        "name": "scopeSoFar",
                                                                                                                        "term": {
                                                                                                                          "application": {
                                                                                                                            "function": {
                                                                                                                              "typeApplication": {
                                                                                                                                "body": {
                                                                                                                                  "typeApplication": {
                                                                                                                                    "body": {"variable": "hydra.core.lib.pairs.second"},
                                                                                                                                    "type": {"list": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.model.Name"}}}}}},
                                                                                                                                "type": {"set": {"variable": "hydra.core.model.Name"}}}},
                                                                                                                            "argument": {"variable": "acc"}}},
                                                                                                                        "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": {
                                                                                                                                      "pair": {
                                                                                                                                        "first": {"list": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.model.Name"}}}},
                                                                                                                                        "second": {"set": {"variable": "hydra.core.model.Name"}}}}}},
                                                                                                                                "argument": {
                                                                                                                                  "application": {
                                                                                                                                    "function": {
                                                                                                                                      "application": {
                                                                                                                                        "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.member"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                                                        "argument": {"variable": "bname"}}},
                                                                                                                                    "argument": {"variable": "scopeSoFar"}}}}},
                                                                                                                            "argument": {
                                                                                                                              "let": {
                                                                                                                                "bindings": [
                                                                                                                                  {
                                                                                                                                    "name": "bname2",
                                                                                                                                    "term": {
                                                                                                                                      "application": {
                                                                                                                                        "function": {"application": {"function": {"variable": "hydra.core.variables.freshNameAvoiding"}, "argument": {"variable": "bname"}}},
                                                                                                                                        "argument": {"variable": "scopeSoFar"}}},
                                                                                                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Name"}, "constraints": []}}],
                                                                                                                                "body": {
                                                                                                                                  "typeApplication": {
                                                                                                                                    "body": {
                                                                                                                                      "typeApplication": {
                                                                                                                                        "body": {
                                                                                                                                          "pair": {
                                                                                                                                            "first": {
                                                                                                                                              "application": {
                                                                                                                                                "function": {
                                                                                                                                                  "application": {
                                                                                                                                                    "function": {
                                                                                                                                                      "typeApplication": {
                                                                                                                                                        "body": {"variable": "hydra.core.lib.lists.cons"},
                                                                                                                                                        "type": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.model.Name"}}}}},
                                                                                                                                                    "argument": {
                                                                                                                                                      "typeApplication": {
                                                                                                                                                        "body": {
                                                                                                                                                          "typeApplication": {
                                                                                                                                                            "body": {"pair": {"first": {"variable": "bname"}, "second": {"variable": "bname2"}}},
                                                                                                                                                            "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                                                                        "type": {"variable": "hydra.core.model.Name"}}}}},
                                                                                                                                                "argument": {"variable": "resolvedSoFar"}}},
                                                                                                                                            "second": {
                                                                                                                                              "application": {
                                                                                                                                                "function": {
                                                                                                                                                  "application": {
                                                                                                                                                    "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.insert"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                                                                    "argument": {"variable": "bname2"}}},
                                                                                                                                                "argument": {"variable": "scopeSoFar"}}}}},
                                                                                                                                        "type": {"list": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.model.Name"}}}}}},
                                                                                                                                    "type": {"set": {"variable": "hydra.core.model.Name"}}}}}}}},
                                                                                                                        "argument": {
                                                                                                                          "typeApplication": {
                                                                                                                            "body": {
                                                                                                                              "typeApplication": {
                                                                                                                                "body": {
                                                                                                                                  "pair": {
                                                                                                                                    "first": {"variable": "resolvedSoFar"},
                                                                                                                                    "second": {
                                                                                                                                      "application": {
                                                                                                                                        "function": {
                                                                                                                                          "application": {
                                                                                                                                            "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.insert"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                                                            "argument": {"variable": "bname"}}},
                                                                                                                                        "argument": {"variable": "scopeSoFar"}}}}},
                                                                                                                                "type": {"list": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.model.Name"}}}}}},
                                                                                                                            "type": {"set": {"variable": "hydra.core.model.Name"}}}}}}}}}}}}}}}},
                                                                                                "typeScheme": {
                                                                                                  "variables": [],
                                                                                                  "body": {
                                                                                                    "function": {
                                                                                                      "domain": {
                                                                                                        "pair": {
                                                                                                          "first": {"list": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.model.Name"}}}},
                                                                                                          "second": {"set": {"variable": "hydra.core.model.Name"}}}},
                                                                                                      "codomain": {
                                                                                                        "function": {
                                                                                                          "domain": {"variable": "hydra.core.model.Binding"},
                                                                                                          "codomain": {
                                                                                                            "pair": {
                                                                                                              "first": {"list": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.model.Name"}}}},
                                                                                                              "second": {"set": {"variable": "hydra.core.model.Name"}}}}}}}},
                                                                                                  "constraints": []}}],
                                                                                            "body": {
                                                                                              "let": {
                                                                                                "bindings": [
                                                                                                  {
                                                                                                    "name": "resolveState",
                                                                                                    "term": {
                                                                                                      "application": {
                                                                                                        "function": {
                                                                                                          "application": {
                                                                                                            "function": {
                                                                                                              "application": {
                                                                                                                "function": {
                                                                                                                  "typeApplication": {
                                                                                                                    "body": {
                                                                                                                      "typeApplication": {
                                                                                                                        "body": {"variable": "hydra.core.lib.lists.foldl"},
                                                                                                                        "type": {
                                                                                                                          "pair": {
                                                                                                                            "first": {"list": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.model.Name"}}}},
                                                                                                                            "second": {"set": {"variable": "hydra.core.model.Name"}}}}}},
                                                                                                                    "type": {"variable": "hydra.core.model.Binding"}}},
                                                                                                                "argument": {"variable": "resolveBinding"}}},
                                                                                                            "argument": {
                                                                                                              "typeApplication": {
                                                                                                                "body": {
                                                                                                                  "typeApplication": {
                                                                                                                    "body": {
                                                                                                                      "pair": {
                                                                                                                        "first": {
                                                                                                                          "typeApplication": {
                                                                                                                            "body": {"list": []},
                                                                                                                            "type": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.model.Name"}}}}},
                                                                                                                        "second": {"variable": "inScope0"}}},
                                                                                                                    "type": {"list": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.model.Name"}}}}}},
                                                                                                                "type": {"set": {"variable": "hydra.core.model.Name"}}}}}},
                                                                                                        "argument": {
                                                                                                          "application": {"function": {"project": {"typeName": "hydra.core.model.Let", "fieldName": "bindings"}}, "argument": {"variable": "lt"}}}}},
                                                                                                    "typeScheme": {
                                                                                                      "variables": [],
                                                                                                      "body": {
                                                                                                        "pair": {
                                                                                                          "first": {"list": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.model.Name"}}}},
                                                                                                          "second": {"set": {"variable": "hydra.core.model.Name"}}}},
                                                                                                      "constraints": []}}],
                                                                                                "body": {
                                                                                                  "let": {
                                                                                                    "bindings": [
                                                                                                      {
                                                                                                        "name": "renames",
                                                                                                        "term": {
                                                                                                          "application": {
                                                                                                            "function": {
                                                                                                              "typeApplication": {
                                                                                                                "body": {
                                                                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.maps.fromList"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                                "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                            "argument": {
                                                                                                              "application": {
                                                                                                                "function": {
                                                                                                                  "typeApplication": {
                                                                                                                    "body": {
                                                                                                                      "typeApplication": {
                                                                                                                        "body": {"variable": "hydra.core.lib.pairs.first"},
                                                                                                                        "type": {"list": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.model.Name"}}}}}},
                                                                                                                    "type": {"set": {"variable": "hydra.core.model.Name"}}}},
                                                                                                                "argument": {"variable": "resolveState"}}}}},
                                                                                                        "typeScheme": {
                                                                                                          "variables": [],
                                                                                                          "body": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.Name"}}},
                                                                                                          "constraints": []}}],
                                                                                                    "body": {
                                                                                                      "let": {
                                                                                                        "bindings": [
                                                                                                          {
                                                                                                            "name": "renameBindingName",
                                                                                                            "term": {
                                                                                                              "lambda": {
                                                                                                                "parameter": "b",
                                                                                                                "domain": {"variable": "hydra.core.model.Binding"},
                                                                                                                "body": {
                                                                                                                  "record": {
                                                                                                                    "typeName": "hydra.core.model.Binding",
                                                                                                                    "fields": [
                                                                                                                      {
                                                                                                                        "name": "name",
                                                                                                                        "term": {
                                                                                                                          "application": {
                                                                                                                            "function": {
                                                                                                                              "application": {
                                                                                                                                "function": {
                                                                                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.optionals.withDefault"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                                                "argument": {
                                                                                                                                  "application": {"function": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "name"}}, "argument": {"variable": "b"}}}}},
                                                                                                                            "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.Name"}}},
                                                                                                                                    "argument": {
                                                                                                                                      "application": {"function": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "name"}}, "argument": {"variable": "b"}}}}},
                                                                                                                                "argument": {"variable": "renames"}}}}}},
                                                                                                                      {
                                                                                                                        "name": "term",
                                                                                                                        "term": {
                                                                                                                          "application": {
                                                                                                                            "function": {
                                                                                                                              "application": {"function": {"variable": "hydra.core.variables.substituteVariables"}, "argument": {"variable": "renames"}}},
                                                                                                                            "argument": {
                                                                                                                              "application": {"function": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "term"}}, "argument": {"variable": "b"}}}}}},
                                                                                                                      {
                                                                                                                        "name": "typeScheme",
                                                                                                                        "term": {
                                                                                                                          "application": {
                                                                                                                            "function": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "typeScheme"}},
                                                                                                                            "argument": {"variable": "b"}}}}]}}}},
                                                                                                            "typeScheme": {
                                                                                                              "variables": [],
                                                                                                              "body": {"function": {"domain": {"variable": "hydra.core.model.Binding"}, "codomain": {"variable": "hydra.core.model.Binding"}}},
                                                                                                              "constraints": []}}],
                                                                                                        "body": {
                                                                                                          "let": {
                                                                                                            "bindings": [
                                                                                                              {
                                                                                                                "name": "newBindings",
                                                                                                                "term": {
                                                                                                                  "application": {
                                                                                                                    "function": {
                                                                                                                      "application": {
                                                                                                                        "function": {
                                                                                                                          "typeApplication": {
                                                                                                                            "body": {
                                                                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.model.Binding"}}},
                                                                                                                            "type": {"variable": "hydra.core.model.Binding"}}},
                                                                                                                        "argument": {"variable": "renameBindingName"}}},
                                                                                                                    "argument": {
                                                                                                                      "application": {"function": {"project": {"typeName": "hydra.core.model.Let", "fieldName": "bindings"}}, "argument": {"variable": "lt"}}}}},
                                                                                                                "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Binding"}}, "constraints": []}}],
                                                                                                            "body": {
                                                                                                              "let": {
                                                                                                                "bindings": [
                                                                                                                  {
                                                                                                                    "name": "body",
                                                                                                                    "term": {
                                                                                                                      "application": {
                                                                                                                        "function": {
                                                                                                                          "application": {
                                                                                                                            "function": {
                                                                                                                              "application": {
                                                                                                                                "function": {
                                                                                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.logic.ifElse"}, "type": {"variable": "hydra.core.model.Term"}}},
                                                                                                                                "argument": {
                                                                                                                                  "application": {
                                                                                                                                    "function": {
                                                                                                                                      "typeApplication": {
                                                                                                                                        "body": {
                                                                                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.maps.isEmpty"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                                                        "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                                                    "argument": {"variable": "renames"}}}}},
                                                                                                                            "argument": {
                                                                                                                              "application": {"function": {"project": {"typeName": "hydra.core.model.Let", "fieldName": "body"}}, "argument": {"variable": "lt"}}}}},
                                                                                                                        "argument": {
                                                                                                                          "application": {
                                                                                                                            "function": {
                                                                                                                              "application": {"function": {"variable": "hydra.core.variables.substituteVariables"}, "argument": {"variable": "renames"}}},
                                                                                                                            "argument": {
                                                                                                                              "application": {"function": {"project": {"typeName": "hydra.core.model.Let", "fieldName": "body"}}, "argument": {"variable": "lt"}}}}}}},
                                                                                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                                                                                                "body": {
                                                                                                                  "let": {
                                                                                                                    "bindings": [
                                                                                                                      {
                                                                                                                        "name": "newEnv",
                                                                                                                        "term": {
                                                                                                                          "application": {
                                                                                                                            "function": {
                                                                                                                              "application": {
                                                                                                                                "function": {"variable": "setTC"},
                                                                                                                                "argument": {
                                                                                                                                  "application": {
                                                                                                                                    "function": {
                                                                                                                                      "application": {
                                                                                                                                        "function": {
                                                                                                                                          "application": {"function": {"variable": "hydra.core.scoping.extendGraphForLet"}, "argument": {"variable": "forBinding"}}},
                                                                                                                                        "argument": {"application": {"function": {"variable": "getTC"}, "argument": {"variable": "gEnv"}}}}},
                                                                                                                                    "argument": {"variable": "lt"}}}}},
                                                                                                                            "argument": {"variable": "gEnv"}}},
                                                                                                                        "typeScheme": {"variables": [], "body": {"variable": "t0"}, "constraints": []}}],
                                                                                                                    "body": {
                                                                                                                      "application": {
                                                                                                                        "function": {
                                                                                                                          "application": {
                                                                                                                            "function": {
                                                                                                                              "application": {
                                                                                                                                "function": {
                                                                                                                                  "application": {
                                                                                                                                    "function": {
                                                                                                                                      "application": {
                                                                                                                                        "function": {
                                                                                                                                          "application": {
                                                                                                                                            "function": {
                                                                                                                                              "application": {
                                                                                                                                                "function": {
                                                                                                                                                  "application": {
                                                                                                                                                    "function": {
                                                                                                                                                      "application": {
                                                                                                                                                        "function": {
                                                                                                                                                          "application": {
                                                                                                                                                            "function": {
                                                                                                                                                              "application": {
                                                                                                                                                                "function": {
                                                                                                                                                                  "application": {
                                                                                                                                                                    "function": {
                                                                                                                                                                      "typeApplication": {
                                                                                                                                                                        "body": {
                                                                                                                                                                          "typeApplication": {"body": {"variable": "hydra.core.analysis.analyzeFunctionTermWithGather"}, "type": {"variable": "t0"}}},
                                                                                                                                                                        "type": {"variable": "t1"}}},
                                                                                                                                                                    "argument": {"variable": "cx"}}},
                                                                                                                                                                "argument": {"variable": "forBinding"}}},
                                                                                                                                                            "argument": {"variable": "getTC"}}},
                                                                                                                                                        "argument": {"variable": "setTC"}}},
                                                                                                                                                    "argument": {"literal": {"boolean": false}}}},
                                                                                                                                                "argument": {"variable": "newEnv"}}},
                                                                                                                                            "argument": {"variable": "tparams"}}},
                                                                                                                                        "argument": {"variable": "args"}}},
                                                                                                                                    "argument": {
                                                                                                                                      "application": {
                                                                                                                                        "function": {
                                                                                                                                          "application": {
                                                                                                                                            "function": {
                                                                                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.lists.concat2"}, "type": {"variable": "hydra.core.model.Binding"}}},
                                                                                                                                            "argument": {"variable": "bindings"}}},
                                                                                                                                        "argument": {"variable": "newBindings"}}}}},
                                                                                                                                "argument": {"variable": "doms"}}},
                                                                                                                            "argument": {"variable": "tapps"}}},
                                                                                                                        "argument": {"variable": "body"}}}}}}}}}}}}}}}}}}}}}},
                                                                              {
                                                                                "name": "typeApplication",
                                                                                "handler": {
                                                                                  "lambda": {
                                                                                    "parameter": "ta",
                                                                                    "domain": {"variable": "hydra.core.model.TypeApplicationTerm"},
                                                                                    "body": {
                                                                                      "let": {
                                                                                        "bindings": [
                                                                                          {
                                                                                            "name": "taBody",
                                                                                            "term": {
                                                                                              "application": {
                                                                                                "function": {"project": {"typeName": "hydra.core.model.TypeApplicationTerm", "fieldName": "body"}},
                                                                                                "argument": {"variable": "ta"}}},
                                                                                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                                                                        "body": {
                                                                                          "let": {
                                                                                            "bindings": [
                                                                                              {
                                                                                                "name": "typ",
                                                                                                "term": {
                                                                                                  "application": {
                                                                                                    "function": {"project": {"typeName": "hydra.core.model.TypeApplicationTerm", "fieldName": "type"}},
                                                                                                    "argument": {"variable": "ta"}}},
                                                                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
                                                                                            "body": {
                                                                                              "application": {
                                                                                                "function": {
                                                                                                  "application": {
                                                                                                    "function": {
                                                                                                      "application": {
                                                                                                        "function": {
                                                                                                          "application": {
                                                                                                            "function": {
                                                                                                              "application": {
                                                                                                                "function": {
                                                                                                                  "application": {
                                                                                                                    "function": {
                                                                                                                      "application": {
                                                                                                                        "function": {
                                                                                                                          "application": {
                                                                                                                            "function": {
                                                                                                                              "application": {
                                                                                                                                "function": {
                                                                                                                                  "application": {
                                                                                                                                    "function": {
                                                                                                                                      "application": {
                                                                                                                                        "function": {
                                                                                                                                          "application": {
                                                                                                                                            "function": {
                                                                                                                                              "typeApplication": {
                                                                                                                                                "body": {
                                                                                                                                                  "typeApplication": {"body": {"variable": "hydra.core.analysis.analyzeFunctionTermWithGather"}, "type": {"variable": "t0"}}},
                                                                                                                                                "type": {"variable": "t1"}}},
                                                                                                                                            "argument": {"variable": "cx"}}},
                                                                                                                                        "argument": {"variable": "forBinding"}}},
                                                                                                                                    "argument": {"variable": "getTC"}}},
                                                                                                                                "argument": {"variable": "setTC"}}},
                                                                                                                            "argument": {"variable": "argMode"}}},
                                                                                                                        "argument": {"variable": "gEnv"}}},
                                                                                                                    "argument": {"variable": "tparams"}}},
                                                                                                                "argument": {"variable": "args"}}},
                                                                                                            "argument": {"variable": "bindings"}}},
                                                                                                        "argument": {"variable": "doms"}}},
                                                                                                    "argument": {
                                                                                                      "application": {
                                                                                                        "function": {
                                                                                                          "application": {
                                                                                                            "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.cons"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                                                            "argument": {"variable": "typ"}}},
                                                                                                        "argument": {"variable": "tapps"}}}}},
                                                                                                "argument": {"variable": "taBody"}}}}}}}}}},
                                                                              {
                                                                                "name": "typeLambda",
                                                                                "handler": {
                                                                                  "lambda": {
                                                                                    "parameter": "tl",
                                                                                    "domain": {"variable": "hydra.core.model.TypeLambda"},
                                                                                    "body": {
                                                                                      "let": {
                                                                                        "bindings": [
                                                                                          {
                                                                                            "name": "tvar",
                                                                                            "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": "tlBody",
                                                                                                "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": "newEnv",
                                                                                                    "term": {
                                                                                                      "application": {
                                                                                                        "function": {
                                                                                                          "application": {
                                                                                                            "function": {"variable": "setTC"},
                                                                                                            "argument": {
                                                                                                              "application": {
                                                                                                                "function": {
                                                                                                                  "application": {
                                                                                                                    "function": {"variable": "hydra.core.scoping.extendGraphForTypeLambda"},
                                                                                                                    "argument": {"application": {"function": {"variable": "getTC"}, "argument": {"variable": "gEnv"}}}}},
                                                                                                                "argument": {"variable": "tl"}}}}},
                                                                                                        "argument": {"variable": "gEnv"}}},
                                                                                                    "typeScheme": {"variables": [], "body": {"variable": "t0"}, "constraints": []}}],
                                                                                                "body": {
                                                                                                  "application": {
                                                                                                    "function": {
                                                                                                      "application": {
                                                                                                        "function": {
                                                                                                          "application": {
                                                                                                            "function": {
                                                                                                              "application": {
                                                                                                                "function": {
                                                                                                                  "application": {
                                                                                                                    "function": {
                                                                                                                      "application": {
                                                                                                                        "function": {
                                                                                                                          "application": {
                                                                                                                            "function": {
                                                                                                                              "application": {
                                                                                                                                "function": {
                                                                                                                                  "application": {
                                                                                                                                    "function": {
                                                                                                                                      "application": {
                                                                                                                                        "function": {
                                                                                                                                          "application": {
                                                                                                                                            "function": {
                                                                                                                                              "application": {
                                                                                                                                                "function": {
                                                                                                                                                  "typeApplication": {
                                                                                                                                                    "body": {
                                                                                                                                                      "typeApplication": {"body": {"variable": "hydra.core.analysis.analyzeFunctionTermWithGather"}, "type": {"variable": "t0"}}},
                                                                                                                                                    "type": {"variable": "t1"}}},
                                                                                                                                                "argument": {"variable": "cx"}}},
                                                                                                                                            "argument": {"variable": "forBinding"}}},
                                                                                                                                        "argument": {"variable": "getTC"}}},
                                                                                                                                    "argument": {"variable": "setTC"}}},
                                                                                                                                "argument": {"variable": "argMode"}}},
                                                                                                                            "argument": {"variable": "newEnv"}}},
                                                                                                                        "argument": {
                                                                                                                          "application": {
                                                                                                                            "function": {
                                                                                                                              "application": {
                                                                                                                                "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.cons"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                                                "argument": {"variable": "tvar"}}},
                                                                                                                            "argument": {"variable": "tparams"}}}}},
                                                                                                                    "argument": {"variable": "args"}}},
                                                                                                                "argument": {"variable": "bindings"}}},
                                                                                                            "argument": {"variable": "doms"}}},
                                                                                                        "argument": {"variable": "tapps"}}},
                                                                                                    "argument": {"variable": "tlBody"}}}}}}}}}}}}]}},
                                                                        "argument": {"application": {"function": {"variable": "hydra.core.strip.deannotateTerm"}, "argument": {"variable": "t"}}}}}}}}}}}}}}}}}}}}}}}}}}}}},
                    "annotation": {
                      "map": [
                        {
                          "key": {"variable": "description"},
                          "value": {
                            "literal": {
                              "string": "Recursive step of the function-term walk: peel lambdas / type-lambdas / type-applications, accumulating params and bindings, then call analyzeFunctionTermWithFinish"}}}]}}}}}}}}},
    {
      "term": {
        "name": "hydra.core.analysis.definitionDependencyModuleNames",
        "signature": {
          "typeParameters": [],
          "parameters": [{"name": "arg0", "type": {"list": {"variable": "hydra.core.packaging.Definition"}}, "isLazy": false}],
          "result": {"type": {"set": {"variable": "hydra.core.packaging.ModuleName"}}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "defs",
                "domain": {"list": {"variable": "hydra.core.packaging.Definition"}},
                "body": {
                  "let": {
                    "bindings": [
                      {
                        "name": "allNames",
                        "term": {
                          "application": {
                            "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.unions"}, "type": {"variable": "hydra.core.model.Name"}}},
                            "argument": {
                              "application": {
                                "function": {
                                  "application": {
                                    "function": {
                                      "typeApplication": {
                                        "body": {
                                          "typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.packaging.Definition"}}},
                                        "type": {"set": {"variable": "hydra.core.model.Name"}}}},
                                    "argument": {"variable": "hydra.core.analysis.definitionReferencedNames"}}},
                                "argument": {"variable": "defs"}}}}},
                        "typeScheme": {"variables": [], "body": {"set": {"variable": "hydra.core.model.Name"}}, "constraints": []}}],
                    "body": {
                      "application": {
                        "function": {
                          "typeApplication": {"body": {"variable": "hydra.core.lib.sets.fromList"}, "type": {"variable": "hydra.core.packaging.ModuleName"}}},
                        "argument": {
                          "application": {
                            "function": {
                              "typeApplication": {"body": {"variable": "hydra.core.lib.optionals.givens"}, "type": {"variable": "hydra.core.packaging.ModuleName"}}},
                            "argument": {
                              "application": {
                                "function": {
                                  "application": {
                                    "function": {
                                      "typeApplication": {
                                        "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.model.Name"}}},
                                        "type": {"optional": {"variable": "hydra.core.packaging.ModuleName"}}}},
                                    "argument": {"variable": "hydra.core.names.moduleNameOf"}}},
                                "argument": {
                                  "application": {
                                    "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.toList"}, "type": {"variable": "hydra.core.model.Name"}}},
                                    "argument": {"variable": "allNames"}}}}}}}}}}}}},
            "annotation": {
              "map": [{"key": {"variable": "description"}, "value": {"literal": {"string": "Get dependency module names from definitions"}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.analysis.definitionDependencyNamesByModule",
        "signature": {
          "typeParameters": [],
          "parameters": [{"name": "arg0", "type": {"list": {"variable": "hydra.core.packaging.Definition"}}, "isLazy": false}],
          "result": {
            "type": {
              "map": {
                "keys": {"variable": "hydra.core.packaging.ModuleName"},
                "values": {"map": {"keys": {"literal": "string"}, "values": {"literal": {"integer": "int32"}}}}}}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "defs",
                "domain": {"list": {"variable": "hydra.core.packaging.Definition"}},
                "body": {
                  "let": {
                    "bindings": [
                      {
                        "name": "pairs",
                        "term": {
                          "application": {
                            "function": {
                              "typeApplication": {
                                "body": {"variable": "hydra.core.lib.lists.concat"},
                                "type": {"pair": {"first": {"variable": "hydra.core.packaging.ModuleName"}, "second": {"literal": "string"}}}}},
                            "argument": {
                              "application": {
                                "function": {
                                  "application": {
                                    "function": {
                                      "typeApplication": {
                                        "body": {
                                          "typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.packaging.Definition"}}},
                                        "type": {"list": {"pair": {"first": {"variable": "hydra.core.packaging.ModuleName"}, "second": {"literal": "string"}}}}}},
                                    "argument": {
                                      "lambda": {
                                        "parameter": "def",
                                        "domain": {"variable": "hydra.core.packaging.Definition"},
                                        "body": {
                                          "application": {
                                            "function": {
                                              "typeApplication": {
                                                "body": {"variable": "hydra.core.lib.optionals.givens"},
                                                "type": {"pair": {"first": {"variable": "hydra.core.packaging.ModuleName"}, "second": {"literal": "string"}}}}},
                                            "argument": {
                                              "application": {
                                                "function": {
                                                  "application": {
                                                    "function": {
                                                      "typeApplication": {
                                                        "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                        "type": {"optional": {"pair": {"first": {"variable": "hydra.core.packaging.ModuleName"}, "second": {"literal": "string"}}}}}},
                                                    "argument": {
                                                      "lambda": {
                                                        "parameter": "nm",
                                                        "domain": {"variable": "hydra.core.model.Name"},
                                                        "body": {
                                                          "application": {
                                                            "function": {
                                                              "application": {
                                                                "function": {
                                                                  "typeApplication": {
                                                                    "body": {
                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.optionals.map"}, "type": {"variable": "hydra.core.packaging.ModuleName"}}},
                                                                    "type": {"pair": {"first": {"variable": "hydra.core.packaging.ModuleName"}, "second": {"literal": "string"}}}}},
                                                                "argument": {
                                                                  "lambda": {
                                                                    "parameter": "mn",
                                                                    "domain": {"variable": "hydra.core.packaging.ModuleName"},
                                                                    "body": {
                                                                      "typeApplication": {
                                                                        "body": {
                                                                          "typeApplication": {
                                                                            "body": {
                                                                              "pair": {
                                                                                "first": {"variable": "mn"},
                                                                                "second": {"application": {"function": {"variable": "hydra.core.names.localNameOf"}, "argument": {"variable": "nm"}}}}},
                                                                            "type": {"variable": "hydra.core.packaging.ModuleName"}}},
                                                                        "type": {"literal": "string"}}}}}}},
                                                            "argument": {"application": {"function": {"variable": "hydra.core.names.moduleNameOf"}, "argument": {"variable": "nm"}}}}}}}}},
                                                "argument": {
                                                  "application": {
                                                    "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.toList"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                    "argument": {
                                                      "application": {"function": {"variable": "hydra.core.analysis.definitionReferencedNames"}, "argument": {"variable": "def"}}}}}}}}}}}}},
                                "argument": {"variable": "defs"}}}}},
                        "typeScheme": {
                          "variables": [],
                          "body": {"list": {"pair": {"first": {"variable": "hydra.core.packaging.ModuleName"}, "second": {"literal": "string"}}}},
                          "constraints": []}}],
                    "body": {
                      "application": {
                        "function": {
                          "application": {
                            "function": {
                              "application": {
                                "function": {
                                  "typeApplication": {
                                    "body": {
                                      "typeApplication": {
                                        "body": {"variable": "hydra.core.lib.lists.foldl"},
                                        "type": {
                                          "map": {
                                            "keys": {"variable": "hydra.core.packaging.ModuleName"},
                                            "values": {"map": {"keys": {"literal": "string"}, "values": {"literal": {"integer": "int32"}}}}}}}},
                                    "type": {"pair": {"first": {"variable": "hydra.core.packaging.ModuleName"}, "second": {"literal": "string"}}}}},
                                "argument": {
                                  "lambda": {
                                    "parameter": "acc",
                                    "domain": {
                                      "map": {
                                        "keys": {"variable": "hydra.core.packaging.ModuleName"},
                                        "values": {"map": {"keys": {"literal": "string"}, "values": {"literal": {"integer": "int32"}}}}}},
                                    "body": {
                                      "lambda": {
                                        "parameter": "p",
                                        "domain": {"pair": {"first": {"variable": "hydra.core.packaging.ModuleName"}, "second": {"literal": "string"}}},
                                        "body": {
                                          "let": {
                                            "bindings": [
                                              {
                                                "name": "mn",
                                                "term": {
                                                  "application": {
                                                    "function": {
                                                      "typeApplication": {
                                                        "body": {
                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"variable": "hydra.core.packaging.ModuleName"}}},
                                                        "type": {"literal": "string"}}},
                                                    "argument": {"variable": "p"}}},
                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.packaging.ModuleName"}, "constraints": []}}],
                                            "body": {
                                              "let": {
                                                "bindings": [
                                                  {
                                                    "name": "local",
                                                    "term": {
                                                      "application": {
                                                        "function": {
                                                          "typeApplication": {
                                                            "body": {
                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"variable": "hydra.core.packaging.ModuleName"}}},
                                                            "type": {"literal": "string"}}},
                                                        "argument": {"variable": "p"}}},
                                                    "typeScheme": {"variables": [], "body": {"literal": "string"}, "constraints": []}}],
                                                "body": {
                                                  "let": {
                                                    "bindings": [
                                                      {
                                                        "name": "inner",
                                                        "term": {
                                                          "application": {
                                                            "function": {
                                                              "application": {
                                                                "function": {
                                                                  "typeApplication": {
                                                                    "body": {"variable": "hydra.core.lib.optionals.withDefault"},
                                                                    "type": {"map": {"keys": {"literal": "string"}, "values": {"literal": {"integer": "int32"}}}}}},
                                                                "argument": {
                                                                  "typeApplication": {
                                                                    "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.empty"}, "type": {"literal": "string"}}},
                                                                    "type": {"literal": {"integer": "int32"}}}}}},
                                                            "argument": {
                                                              "application": {
                                                                "function": {
                                                                  "application": {
                                                                    "function": {
                                                                      "typeApplication": {
                                                                        "body": {
                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.maps.lookup"}, "type": {"variable": "hydra.core.packaging.ModuleName"}}},
                                                                        "type": {"map": {"keys": {"literal": "string"}, "values": {"literal": {"integer": "int32"}}}}}},
                                                                    "argument": {"variable": "mn"}}},
                                                                "argument": {"variable": "acc"}}}}},
                                                        "typeScheme": {
                                                          "variables": [],
                                                          "body": {"map": {"keys": {"literal": "string"}, "values": {"literal": {"integer": "int32"}}}},
                                                          "constraints": []}}],
                                                    "body": {
                                                      "let": {
                                                        "bindings": [
                                                          {
                                                            "name": "newCount",
                                                            "term": {
                                                              "application": {
                                                                "function": {
                                                                  "application": {
                                                                    "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.math.add"}, "type": {"literal": {"integer": "int32"}}}},
                                                                    "argument": {"literal": {"integer": {"int32": 1}}}}},
                                                                "argument": {
                                                                  "application": {
                                                                    "function": {
                                                                      "application": {
                                                                        "function": {
                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.optionals.withDefault"}, "type": {"literal": {"integer": "int32"}}}},
                                                                        "argument": {"literal": {"integer": {"int32": 0}}}}},
                                                                    "argument": {
                                                                      "application": {
                                                                        "function": {
                                                                          "application": {
                                                                            "function": {
                                                                              "typeApplication": {
                                                                                "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.lookup"}, "type": {"literal": "string"}}},
                                                                                "type": {"literal": {"integer": "int32"}}}},
                                                                            "argument": {"variable": "local"}}},
                                                                        "argument": {"variable": "inner"}}}}}}},
                                                            "typeScheme": {"variables": [], "body": {"literal": {"integer": "int32"}}, "constraints": []}}],
                                                        "body": {
                                                          "application": {
                                                            "function": {
                                                              "application": {
                                                                "function": {
                                                                  "application": {
                                                                    "function": {
                                                                      "typeApplication": {
                                                                        "body": {
                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.maps.insert"}, "type": {"variable": "hydra.core.packaging.ModuleName"}}},
                                                                        "type": {"map": {"keys": {"literal": "string"}, "values": {"literal": {"integer": "int32"}}}}}},
                                                                    "argument": {"variable": "mn"}}},
                                                                "argument": {
                                                                  "application": {
                                                                    "function": {
                                                                      "application": {
                                                                        "function": {
                                                                          "application": {
                                                                            "function": {
                                                                              "typeApplication": {
                                                                                "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.insert"}, "type": {"literal": "string"}}},
                                                                                "type": {"literal": {"integer": "int32"}}}},
                                                                            "argument": {"variable": "local"}}},
                                                                        "argument": {"variable": "newCount"}}},
                                                                    "argument": {"variable": "inner"}}}}},
                                                            "argument": {"variable": "acc"}}}}}}}}}}}}}}}}},
                            "argument": {
                              "typeApplication": {
                                "body": {
                                  "typeApplication": {"body": {"variable": "hydra.core.lib.maps.empty"}, "type": {"variable": "hydra.core.packaging.ModuleName"}}},
                                "type": {"map": {"keys": {"literal": "string"}, "values": {"literal": {"integer": "int32"}}}}}}}},
                        "argument": {"variable": "pairs"}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {
                    "literal": {"string": "Get, per dependency module, the counted multiset of its local names referenced by the definitions"}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.analysis.definitionReferencedNames",
        "signature": {
          "typeParameters": [],
          "parameters": [{"name": "arg0", "type": {"variable": "hydra.core.packaging.Definition"}, "isLazy": false}],
          "result": {"type": {"set": {"variable": "hydra.core.model.Name"}}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "def",
                "domain": {"variable": "hydra.core.packaging.Definition"},
                "body": {
                  "application": {
                    "function": {
                      "cases": {
                        "typeName": "hydra.core.packaging.Definition",
                        "cases": [
                          {
                            "name": "type",
                            "handler": {
                              "lambda": {
                                "parameter": "typeDef",
                                "domain": {"variable": "hydra.core.packaging.TypeDefinition"},
                                "body": {
                                  "application": {
                                    "function": {
                                      "application": {"function": {"variable": "hydra.core.dependencies.typeDependencyNames"}, "argument": {"literal": {"boolean": true}}}},
                                    "argument": {
                                      "application": {
                                        "function": {"project": {"typeName": "hydra.core.model.TypeScheme", "fieldName": "body"}},
                                        "argument": {
                                          "application": {
                                            "function": {"project": {"typeName": "hydra.core.packaging.TypeDefinition", "fieldName": "body"}},
                                            "argument": {"variable": "typeDef"}}}}}}}}}},
                          {
                            "name": "term",
                            "handler": {
                              "lambda": {
                                "parameter": "termDef",
                                "domain": {"variable": "hydra.core.packaging.TermDefinition"},
                                "body": {
                                  "application": {
                                    "function": {
                                      "application": {
                                        "function": {
                                          "application": {
                                            "function": {
                                              "application": {"function": {"variable": "hydra.core.dependencies.termDependencyNames"}, "argument": {"literal": {"boolean": true}}}},
                                            "argument": {"literal": {"boolean": true}}}},
                                        "argument": {"literal": {"boolean": true}}}},
                                    "argument": {
                                      "application": {
                                        "function": {"project": {"typeName": "hydra.core.packaging.TermDefinition", "fieldName": "body"}},
                                        "argument": {"variable": "termDef"}}}}}}}},
                          {
                            "name": "primitive",
                            "handler": {
                              "lambda": {
                                "parameter": "primDef",
                                "domain": {"variable": "hydra.core.packaging.PrimitiveDefinition"},
                                "body": {
                                  "application": {
                                    "function": {
                                      "application": {
                                        "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.union"}, "type": {"variable": "hydra.core.model.Name"}}},
                                        "argument": {
                                          "application": {
                                            "function": {
                                              "typeApplication": {"body": {"variable": "hydra.core.lib.sets.fromList"}, "type": {"variable": "hydra.core.model.Name"}}},
                                            "argument": {
                                              "list": [
                                                {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.model.Type"}}}},
                                                {
                                                  "wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.packaging.PrimitiveDefinition"}}}},
                                                {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.typing.TermSignature"}}}}]}}}}},
                                    "argument": {
                                      "application": {
                                        "function": {
                                          "application": {
                                            "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.union"}, "type": {"variable": "hydra.core.model.Name"}}},
                                            "argument": {
                                              "application": {
                                                "function": {
                                                  "application": {"function": {"variable": "hydra.core.dependencies.typeDependencyNames"}, "argument": {"literal": {"boolean": true}}}},
                                                "argument": {
                                                  "application": {
                                                    "function": {"project": {"typeName": "hydra.core.model.TypeScheme", "fieldName": "body"}},
                                                    "argument": {
                                                      "application": {
                                                        "function": {"variable": "hydra.core.scoping.termSignatureToTypeScheme"},
                                                        "argument": {
                                                          "application": {
                                                            "function": {"project": {"typeName": "hydra.core.packaging.PrimitiveDefinition", "fieldName": "signature"}},
                                                            "argument": {"variable": "primDef"}}}}}}}}}}},
                                        "argument": {
                                          "application": {
                                            "function": {
                                              "application": {
                                                "function": {
                                                  "application": {
                                                    "function": {
                                                      "typeApplication": {
                                                        "body": {
                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.optionals.match"}, "type": {"variable": "hydra.core.model.Term"}}},
                                                        "type": {"set": {"variable": "hydra.core.model.Name"}}}},
                                                    "argument": {
                                                      "application": {
                                                        "function": {"project": {"typeName": "hydra.core.packaging.PrimitiveDefinition", "fieldName": "defaultImplementation"}},
                                                        "argument": {"variable": "primDef"}}}}},
                                                "argument": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.empty"}, "type": {"variable": "hydra.core.model.Name"}}}}},
                                            "argument": {
                                              "lambda": {
                                                "parameter": "impl",
                                                "domain": {"variable": "hydra.core.model.Term"},
                                                "body": {
                                                  "application": {
                                                    "function": {
                                                      "application": {
                                                        "function": {
                                                          "application": {
                                                            "function": {
                                                              "application": {"function": {"variable": "hydra.core.dependencies.termDependencyNames"}, "argument": {"literal": {"boolean": true}}}},
                                                            "argument": {"literal": {"boolean": true}}}},
                                                        "argument": {"literal": {"boolean": true}}}},
                                                    "argument": {"variable": "impl"}}}}}}}}}}}}}}]}},
                    "argument": {"variable": "def"}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {"literal": {"string": "Get the names referenced by a definition, including the primitive-shape names for a primitive"}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.analysis.dependencyModuleNames",
        "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": "boolean"}, "isLazy": false},
            {"name": "arg3", "type": {"literal": "boolean"}, "isLazy": false},
            {"name": "arg4", "type": {"literal": "boolean"}, "isLazy": false},
            {"name": "arg5", "type": {"literal": "boolean"}, "isLazy": false},
            {"name": "arg6", "type": {"list": {"variable": "hydra.core.model.Binding"}}, "isLazy": false}],
          "result": {
            "type": {
              "either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"set": {"variable": "hydra.core.packaging.ModuleName"}}}}}},
        "body": {
          "typeLambda": {
            "parameter": "t0",
            "body": {
              "annotated": {
                "body": {
                  "lambda": {
                    "parameter": "cx",
                    "domain": {"variable": "t0"},
                    "body": {
                      "lambda": {
                        "parameter": "graph",
                        "domain": {"variable": "hydra.core.graph.Graph"},
                        "body": {
                          "lambda": {
                            "parameter": "binds",
                            "domain": {"literal": "boolean"},
                            "body": {
                              "lambda": {
                                "parameter": "withPrims",
                                "domain": {"literal": "boolean"},
                                "body": {
                                  "lambda": {
                                    "parameter": "withNoms",
                                    "domain": {"literal": "boolean"},
                                    "body": {
                                      "lambda": {
                                        "parameter": "withSchema",
                                        "domain": {"literal": "boolean"},
                                        "body": {
                                          "lambda": {
                                            "parameter": "els",
                                            "domain": {"list": {"variable": "hydra.core.model.Binding"}},
                                            "body": {
                                              "let": {
                                                "bindings": [
                                                  {
                                                    "name": "depNames",
                                                    "term": {
                                                      "lambda": {
                                                        "parameter": "el",
                                                        "domain": {"variable": "hydra.core.model.Binding"},
                                                        "body": {
                                                          "let": {
                                                            "bindings": [
                                                              {
                                                                "name": "term",
                                                                "term": {
                                                                  "application": {"function": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "term"}}, "argument": {"variable": "el"}}},
                                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                                            "body": {
                                                              "let": {
                                                                "bindings": [
                                                                  {
                                                                    "name": "deannotatedTerm",
                                                                    "term": {"application": {"function": {"variable": "hydra.core.strip.deannotateTerm"}, "argument": {"variable": "term"}}},
                                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                                                "body": {
                                                                  "let": {
                                                                    "bindings": [
                                                                      {
                                                                        "name": "dataNames",
                                                                        "term": {
                                                                          "application": {
                                                                            "function": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "application": {
                                                                                    "function": {
                                                                                      "application": {"function": {"variable": "hydra.core.dependencies.termDependencyNames"}, "argument": {"variable": "binds"}}},
                                                                                    "argument": {"variable": "withPrims"}}},
                                                                                "argument": {"variable": "withNoms"}}},
                                                                            "argument": {"variable": "term"}}},
                                                                        "typeScheme": {"variables": [], "body": {"set": {"variable": "hydra.core.model.Name"}}, "constraints": []}}],
                                                                    "body": {
                                                                      "let": {
                                                                        "bindings": [
                                                                          {
                                                                            "name": "schemaNames",
                                                                            "term": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "application": {
                                                                                    "function": {
                                                                                      "application": {
                                                                                        "function": {
                                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.logic.ifElse"}, "type": {"set": {"variable": "hydra.core.model.Name"}}}},
                                                                                        "argument": {"variable": "withSchema"}}},
                                                                                    "argument": {
                                                                                      "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": "el"}}}}},
                                                                                            "argument": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.empty"}, "type": {"variable": "hydra.core.model.Name"}}}}},
                                                                                        "argument": {
                                                                                          "lambda": {
                                                                                            "parameter": "ts",
                                                                                            "domain": {"variable": "hydra.core.model.TypeScheme"},
                                                                                            "body": {
                                                                                              "application": {
                                                                                                "function": {
                                                                                                  "application": {"function": {"variable": "hydra.core.dependencies.typeDependencyNames"}, "argument": {"literal": {"boolean": true}}}},
                                                                                                "argument": {
                                                                                                  "application": {
                                                                                                    "function": {"project": {"typeName": "hydra.core.model.TypeScheme", "fieldName": "body"}},
                                                                                                    "argument": {"variable": "ts"}}}}}}}}}}},
                                                                                "argument": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.empty"}, "type": {"variable": "hydra.core.model.Name"}}}}},
                                                                            "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": {"set": {"variable": "hydra.core.model.Name"}}}}}},
                                                                                    "argument": {
                                                                                      "application": {"function": {"variable": "hydra.core.predicates.isEncodedType"}, "argument": {"variable": "deannotatedTerm"}}}}},
                                                                                "argument": {
                                                                                  "application": {
                                                                                    "function": {
                                                                                      "application": {
                                                                                        "function": {
                                                                                          "typeApplication": {
                                                                                            "body": {
                                                                                              "typeApplication": {
                                                                                                "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.eithers.map"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                                                                "type": {"set": {"variable": "hydra.core.model.Name"}}}},
                                                                                            "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                        "argument": {
                                                                                          "lambda": {
                                                                                            "parameter": "typ",
                                                                                            "domain": {"variable": "hydra.core.model.Type"},
                                                                                            "body": {
                                                                                              "application": {
                                                                                                "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.unions"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                "argument": {
                                                                                                  "list": [
                                                                                                    {"variable": "dataNames"},
                                                                                                    {"variable": "schemaNames"},
                                                                                                    {
                                                                                                      "application": {
                                                                                                        "function": {
                                                                                                          "application": {"function": {"variable": "hydra.core.dependencies.typeDependencyNames"}, "argument": {"literal": {"boolean": true}}}},
                                                                                                        "argument": {"variable": "typ"}}}]}}}}}}},
                                                                                    "argument": {
                                                                                      "application": {
                                                                                        "function": {
                                                                                          "application": {
                                                                                            "function": {
                                                                                              "application": {
                                                                                                "function": {
                                                                                                  "typeApplication": {
                                                                                                    "body": {
                                                                                                      "typeApplication": {
                                                                                                        "body": {
                                                                                                          "typeApplication": {
                                                                                                            "body": {
                                                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.eithers.bimap"}, "type": {"variable": "hydra.core.errors.DecodingError"}}},
                                                                                                            "type": {"variable": "hydra.core.model.Type"}}},
                                                                                                        "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                                    "type": {"variable": "hydra.core.model.Type"}}},
                                                                                                "argument": {
                                                                                                  "lambda": {
                                                                                                    "parameter": "_e",
                                                                                                    "domain": {"variable": "hydra.core.errors.DecodingError"},
                                                                                                    "body": {"inject": {"typeName": "hydra.core.errors.Error", "field": {"name": "decoding", "term": {"variable": "_e"}}}}}}}},
                                                                                            "argument": {"lambda": {"parameter": "_a", "domain": {"variable": "hydra.core.model.Type"}, "body": {"variable": "_a"}}}}},
                                                                                        "argument": {
                                                                                          "application": {
                                                                                            "function": {"application": {"function": {"variable": "hydra.core.decode.model.type"}, "argument": {"variable": "graph"}}},
                                                                                            "argument": {"variable": "term"}}}}}}}}},
                                                                            "argument": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "application": {
                                                                                    "function": {
                                                                                      "application": {
                                                                                        "function": {
                                                                                          "typeApplication": {
                                                                                            "body": {"variable": "hydra.core.lib.logic.ifElse"},
                                                                                            "type": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"set": {"variable": "hydra.core.model.Name"}}}}}},
                                                                                        "argument": {
                                                                                          "application": {"function": {"variable": "hydra.core.predicates.isEncodedTerm"}, "argument": {"variable": "deannotatedTerm"}}}}},
                                                                                    "argument": {
                                                                                      "application": {
                                                                                        "function": {
                                                                                          "application": {
                                                                                            "function": {
                                                                                              "typeApplication": {
                                                                                                "body": {
                                                                                                  "typeApplication": {
                                                                                                    "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.eithers.map"}, "type": {"variable": "hydra.core.model.Term"}}},
                                                                                                    "type": {"set": {"variable": "hydra.core.model.Name"}}}},
                                                                                                "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                            "argument": {
                                                                                              "lambda": {
                                                                                                "parameter": "decodedTerm",
                                                                                                "domain": {"variable": "hydra.core.model.Term"},
                                                                                                "body": {
                                                                                                  "application": {
                                                                                                    "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.unions"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                    "argument": {
                                                                                                      "list": [
                                                                                                        {"variable": "dataNames"},
                                                                                                        {"variable": "schemaNames"},
                                                                                                        {
                                                                                                          "application": {
                                                                                                            "function": {
                                                                                                              "application": {
                                                                                                                "function": {
                                                                                                                  "application": {
                                                                                                                    "function": {
                                                                                                                      "application": {"function": {"variable": "hydra.core.dependencies.termDependencyNames"}, "argument": {"variable": "binds"}}},
                                                                                                                    "argument": {"variable": "withPrims"}}},
                                                                                                                "argument": {"variable": "withNoms"}}},
                                                                                                            "argument": {"variable": "decodedTerm"}}}]}}}}}}},
                                                                                        "argument": {
                                                                                          "application": {
                                                                                            "function": {
                                                                                              "application": {
                                                                                                "function": {
                                                                                                  "application": {
                                                                                                    "function": {
                                                                                                      "typeApplication": {
                                                                                                        "body": {
                                                                                                          "typeApplication": {
                                                                                                            "body": {
                                                                                                              "typeApplication": {
                                                                                                                "body": {
                                                                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.eithers.bimap"}, "type": {"variable": "hydra.core.errors.DecodingError"}}},
                                                                                                                "type": {"variable": "hydra.core.model.Term"}}},
                                                                                                            "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                                        "type": {"variable": "hydra.core.model.Term"}}},
                                                                                                    "argument": {
                                                                                                      "lambda": {
                                                                                                        "parameter": "_e",
                                                                                                        "domain": {"variable": "hydra.core.errors.DecodingError"},
                                                                                                        "body": {"inject": {"typeName": "hydra.core.errors.Error", "field": {"name": "decoding", "term": {"variable": "_e"}}}}}}}},
                                                                                                "argument": {"lambda": {"parameter": "_a", "domain": {"variable": "hydra.core.model.Term"}, "body": {"variable": "_a"}}}}},
                                                                                            "argument": {
                                                                                              "application": {
                                                                                                "function": {"application": {"function": {"variable": "hydra.core.decode.model.term"}, "argument": {"variable": "graph"}}},
                                                                                                "argument": {"variable": "term"}}}}}}}}},
                                                                                "argument": {
                                                                                  "typeApplication": {
                                                                                    "body": {
                                                                                      "typeApplication": {
                                                                                        "body": {
                                                                                          "either": {
                                                                                            "right": {
                                                                                              "application": {
                                                                                                "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.unions"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                "argument": {"list": [{"variable": "dataNames"}, {"variable": "schemaNames"}]}}}}},
                                                                                        "type": {"variable": "hydra.core.errors.Error"}}},
                                                                                    "type": {"set": {"variable": "hydra.core.model.Name"}}}}}}}}}}}}}}}}}},
                                                    "typeScheme": {
                                                      "variables": [],
                                                      "body": {
                                                        "function": {
                                                          "domain": {"variable": "hydra.core.model.Binding"},
                                                          "codomain": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"set": {"variable": "hydra.core.model.Name"}}}}}},
                                                      "constraints": []}}],
                                                "body": {
                                                  "application": {
                                                    "function": {
                                                      "application": {
                                                        "function": {
                                                          "typeApplication": {
                                                            "body": {
                                                              "typeApplication": {
                                                                "body": {
                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.eithers.map"}, "type": {"list": {"set": {"variable": "hydra.core.model.Name"}}}}},
                                                                "type": {"set": {"variable": "hydra.core.packaging.ModuleName"}}}},
                                                            "type": {"variable": "hydra.core.errors.Error"}}},
                                                        "argument": {
                                                          "lambda": {
                                                            "parameter": "namesList",
                                                            "domain": {"list": {"set": {"variable": "hydra.core.model.Name"}}},
                                                            "body": {
                                                              "application": {
                                                                "function": {
                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.sets.fromList"}, "type": {"variable": "hydra.core.packaging.ModuleName"}}},
                                                                "argument": {
                                                                  "application": {
                                                                    "function": {
                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.optionals.givens"}, "type": {"variable": "hydra.core.packaging.ModuleName"}}},
                                                                    "argument": {
                                                                      "application": {
                                                                        "function": {
                                                                          "application": {
                                                                            "function": {
                                                                              "typeApplication": {
                                                                                "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                "type": {"optional": {"variable": "hydra.core.packaging.ModuleName"}}}},
                                                                            "argument": {"variable": "hydra.core.names.moduleNameOf"}}},
                                                                        "argument": {
                                                                          "application": {
                                                                            "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.toList"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                            "argument": {
                                                                              "application": {
                                                                                "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.unions"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                "argument": {"variable": "namesList"}}}}}}}}}}}}}}},
                                                    "argument": {
                                                      "application": {
                                                        "function": {
                                                          "application": {
                                                            "function": {
                                                              "typeApplication": {
                                                                "body": {
                                                                  "typeApplication": {
                                                                    "body": {
                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.eithers.mapList"}, "type": {"variable": "hydra.core.model.Binding"}}},
                                                                    "type": {"set": {"variable": "hydra.core.model.Name"}}}},
                                                                "type": {"variable": "hydra.core.errors.Error"}}},
                                                            "argument": {"variable": "depNames"}}},
                                                        "argument": {"variable": "els"}}}}}}}}}}}}}}}}}}}}},
                "annotation": {
                  "map": [
                    {
                      "key": {"variable": "description"},
                      "value": {"literal": {"string": "Find dependency module names in all of a set of terms (Either version)"}}}]}}}}}}},
    {
      "term": {
        "name": "hydra.core.analysis.gatherApplications",
        "signature": {
          "typeParameters": [],
          "parameters": [{"name": "arg0", "type": {"variable": "hydra.core.model.Term"}, "isLazy": false}],
          "result": {
            "type": {"pair": {"first": {"list": {"variable": "hydra.core.model.Term"}}, "second": {"variable": "hydra.core.model.Term"}}}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "term",
                "domain": {"variable": "hydra.core.model.Term"},
                "body": {
                  "let": {
                    "bindings": [
                      {
                        "name": "go",
                        "term": {
                          "lambda": {
                            "parameter": "args",
                            "domain": {"list": {"variable": "hydra.core.model.Term"}},
                            "body": {
                              "lambda": {
                                "parameter": "t",
                                "domain": {"variable": "hydra.core.model.Term"},
                                "body": {
                                  "application": {
                                    "function": {
                                      "cases": {
                                        "typeName": "hydra.core.model.Term",
                                        "default": {
                                          "typeApplication": {
                                            "body": {
                                              "typeApplication": {
                                                "body": {"pair": {"first": {"variable": "args"}, "second": {"variable": "t"}}},
                                                "type": {"list": {"variable": "hydra.core.model.Term"}}}},
                                            "type": {"variable": "hydra.core.model.Term"}}},
                                        "cases": [
                                          {
                                            "name": "application",
                                            "handler": {
                                              "lambda": {
                                                "parameter": "app",
                                                "domain": {"variable": "hydra.core.model.Application"},
                                                "body": {
                                                  "let": {
                                                    "bindings": [
                                                      {
                                                        "name": "lhs",
                                                        "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": "rhs",
                                                            "term": {
                                                              "application": {
                                                                "function": {"project": {"typeName": "hydra.core.model.Application", "fieldName": "argument"}},
                                                                "argument": {"variable": "app"}}},
                                                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                                        "body": {
                                                          "application": {
                                                            "function": {
                                                              "application": {
                                                                "function": {"variable": "go"},
                                                                "argument": {
                                                                  "application": {
                                                                    "function": {
                                                                      "application": {
                                                                        "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.cons"}, "type": {"variable": "hydra.core.model.Term"}}},
                                                                        "argument": {"variable": "rhs"}}},
                                                                    "argument": {"variable": "args"}}}}},
                                                            "argument": {"variable": "lhs"}}}}}}}}}}]}},
                                    "argument": {"application": {"function": {"variable": "hydra.core.strip.deannotateTerm"}, "argument": {"variable": "t"}}}}}}}}},
                        "typeScheme": {
                          "variables": [],
                          "body": {
                            "function": {
                              "domain": {"list": {"variable": "hydra.core.model.Term"}},
                              "codomain": {
                                "function": {
                                  "domain": {"variable": "hydra.core.model.Term"},
                                  "codomain": {"pair": {"first": {"list": {"variable": "hydra.core.model.Term"}}, "second": {"variable": "hydra.core.model.Term"}}}}}}},
                          "constraints": []}}],
                    "body": {
                      "application": {
                        "function": {
                          "application": {
                            "function": {"variable": "go"},
                            "argument": {"typeApplication": {"body": {"list": []}, "type": {"variable": "hydra.core.model.Term"}}}}},
                        "argument": {"variable": "term"}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {"literal": {"string": "Gather applications from a term, returning (args, baseTerm)"}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.analysis.gatherArgs",
        "signature": {
          "typeParameters": [],
          "parameters": [
            {"name": "arg0", "type": {"variable": "hydra.core.model.Term"}, "isLazy": false},
            {"name": "arg1", "type": {"list": {"variable": "hydra.core.model.Term"}}, "isLazy": false}],
          "result": {
            "type": {"pair": {"first": {"variable": "hydra.core.model.Term"}, "second": {"list": {"variable": "hydra.core.model.Term"}}}}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "term",
                "domain": {"variable": "hydra.core.model.Term"},
                "body": {
                  "lambda": {
                    "parameter": "args",
                    "domain": {"list": {"variable": "hydra.core.model.Term"}},
                    "body": {
                      "application": {
                        "function": {
                          "cases": {
                            "typeName": "hydra.core.model.Term",
                            "default": {
                              "typeApplication": {
                                "body": {
                                  "typeApplication": {
                                    "body": {"pair": {"first": {"variable": "term"}, "second": {"variable": "args"}}},
                                    "type": {"variable": "hydra.core.model.Term"}}},
                                "type": {"list": {"variable": "hydra.core.model.Term"}}}},
                            "cases": [
                              {
                                "name": "application",
                                "handler": {
                                  "lambda": {
                                    "parameter": "app",
                                    "domain": {"variable": "hydra.core.model.Application"},
                                    "body": {
                                      "let": {
                                        "bindings": [
                                          {
                                            "name": "lhs",
                                            "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": "rhs",
                                                "term": {
                                                  "application": {
                                                    "function": {"project": {"typeName": "hydra.core.model.Application", "fieldName": "argument"}},
                                                    "argument": {"variable": "app"}}},
                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                            "body": {
                                              "application": {
                                                "function": {"application": {"function": {"variable": "hydra.core.analysis.gatherArgs"}, "argument": {"variable": "lhs"}}},
                                                "argument": {
                                                  "application": {
                                                    "function": {
                                                      "application": {
                                                        "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.cons"}, "type": {"variable": "hydra.core.model.Term"}}},
                                                        "argument": {"variable": "rhs"}}},
                                                    "argument": {"variable": "args"}}}}}}}}}}}},
                              {
                                "name": "typeLambda",
                                "handler": {
                                  "lambda": {
                                    "parameter": "tl",
                                    "domain": {"variable": "hydra.core.model.TypeLambda"},
                                    "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": {
                                          "application": {
                                            "function": {"application": {"function": {"variable": "hydra.core.analysis.gatherArgs"}, "argument": {"variable": "body"}}},
                                            "argument": {"variable": "args"}}}}}}}},
                              {
                                "name": "typeApplication",
                                "handler": {
                                  "lambda": {
                                    "parameter": "ta",
                                    "domain": {"variable": "hydra.core.model.TypeApplicationTerm"},
                                    "body": {
                                      "let": {
                                        "bindings": [
                                          {
                                            "name": "body",
                                            "term": {
                                              "application": {
                                                "function": {"project": {"typeName": "hydra.core.model.TypeApplicationTerm", "fieldName": "body"}},
                                                "argument": {"variable": "ta"}}},
                                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                        "body": {
                                          "application": {
                                            "function": {"application": {"function": {"variable": "hydra.core.analysis.gatherArgs"}, "argument": {"variable": "body"}}},
                                            "argument": {"variable": "args"}}}}}}}}]}},
                        "argument": {"application": {"function": {"variable": "hydra.core.strip.deannotateTerm"}, "argument": {"variable": "term"}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {"literal": {"string": "Gather term arguments, stripping type-level constructs"}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.analysis.gatherArgsWithTypeApps",
        "signature": {
          "typeParameters": [],
          "parameters": [
            {"name": "arg0", "type": {"variable": "hydra.core.model.Term"}, "isLazy": false},
            {"name": "arg1", "type": {"list": {"variable": "hydra.core.model.Term"}}, "isLazy": false},
            {"name": "arg2", "type": {"list": {"variable": "hydra.core.model.Type"}}, "isLazy": false}],
          "result": {
            "type": {
              "pair": {
                "first": {"variable": "hydra.core.model.Term"},
                "second": {
                  "pair": {"first": {"list": {"variable": "hydra.core.model.Term"}}, "second": {"list": {"variable": "hydra.core.model.Type"}}}}}}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "term",
                "domain": {"variable": "hydra.core.model.Term"},
                "body": {
                  "lambda": {
                    "parameter": "args",
                    "domain": {"list": {"variable": "hydra.core.model.Term"}},
                    "body": {
                      "lambda": {
                        "parameter": "tyArgs",
                        "domain": {"list": {"variable": "hydra.core.model.Type"}},
                        "body": {
                          "application": {
                            "function": {
                              "cases": {
                                "typeName": "hydra.core.model.Term",
                                "default": {
                                  "typeApplication": {
                                    "body": {
                                      "typeApplication": {
                                        "body": {
                                          "pair": {
                                            "first": {"variable": "term"},
                                            "second": {
                                              "typeApplication": {
                                                "body": {
                                                  "typeApplication": {
                                                    "body": {"pair": {"first": {"variable": "args"}, "second": {"variable": "tyArgs"}}},
                                                    "type": {"list": {"variable": "hydra.core.model.Term"}}}},
                                                "type": {"list": {"variable": "hydra.core.model.Type"}}}}}},
                                        "type": {"variable": "hydra.core.model.Term"}}},
                                    "type": {
                                      "pair": {"first": {"list": {"variable": "hydra.core.model.Term"}}, "second": {"list": {"variable": "hydra.core.model.Type"}}}}}},
                                "cases": [
                                  {
                                    "name": "application",
                                    "handler": {
                                      "lambda": {
                                        "parameter": "app",
                                        "domain": {"variable": "hydra.core.model.Application"},
                                        "body": {
                                          "let": {
                                            "bindings": [
                                              {
                                                "name": "lhs",
                                                "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": "rhs",
                                                    "term": {
                                                      "application": {
                                                        "function": {"project": {"typeName": "hydra.core.model.Application", "fieldName": "argument"}},
                                                        "argument": {"variable": "app"}}},
                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                                "body": {
                                                  "application": {
                                                    "function": {
                                                      "application": {
                                                        "function": {
                                                          "application": {"function": {"variable": "hydra.core.analysis.gatherArgsWithTypeApps"}, "argument": {"variable": "lhs"}}},
                                                        "argument": {
                                                          "application": {
                                                            "function": {
                                                              "application": {
                                                                "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.cons"}, "type": {"variable": "hydra.core.model.Term"}}},
                                                                "argument": {"variable": "rhs"}}},
                                                            "argument": {"variable": "args"}}}}},
                                                    "argument": {"variable": "tyArgs"}}}}}}}}}},
                                  {
                                    "name": "typeLambda",
                                    "handler": {
                                      "lambda": {
                                        "parameter": "tl",
                                        "domain": {"variable": "hydra.core.model.TypeLambda"},
                                        "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": {
                                              "application": {
                                                "function": {
                                                  "application": {
                                                    "function": {
                                                      "application": {"function": {"variable": "hydra.core.analysis.gatherArgsWithTypeApps"}, "argument": {"variable": "body"}}},
                                                    "argument": {"variable": "args"}}},
                                                "argument": {"variable": "tyArgs"}}}}}}}},
                                  {
                                    "name": "typeApplication",
                                    "handler": {
                                      "lambda": {
                                        "parameter": "ta",
                                        "domain": {"variable": "hydra.core.model.TypeApplicationTerm"},
                                        "body": {
                                          "let": {
                                            "bindings": [
                                              {
                                                "name": "body",
                                                "term": {
                                                  "application": {
                                                    "function": {"project": {"typeName": "hydra.core.model.TypeApplicationTerm", "fieldName": "body"}},
                                                    "argument": {"variable": "ta"}}},
                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                            "body": {
                                              "let": {
                                                "bindings": [
                                                  {
                                                    "name": "typ",
                                                    "term": {
                                                      "application": {
                                                        "function": {"project": {"typeName": "hydra.core.model.TypeApplicationTerm", "fieldName": "type"}},
                                                        "argument": {"variable": "ta"}}},
                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
                                                "body": {
                                                  "application": {
                                                    "function": {
                                                      "application": {
                                                        "function": {
                                                          "application": {"function": {"variable": "hydra.core.analysis.gatherArgsWithTypeApps"}, "argument": {"variable": "body"}}},
                                                        "argument": {"variable": "args"}}},
                                                    "argument": {
                                                      "application": {
                                                        "function": {
                                                          "application": {
                                                            "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.cons"}, "type": {"variable": "hydra.core.model.Type"}}},
                                                            "argument": {"variable": "typ"}}},
                                                        "argument": {"variable": "tyArgs"}}}}}}}}}}}}]}},
                            "argument": {"application": {"function": {"variable": "hydra.core.strip.deannotateTerm"}, "argument": {"variable": "term"}}}}}}}}}}},
            "annotation": {
              "map": [{"key": {"variable": "description"}, "value": {"literal": {"string": "Gather term and type arguments from a term"}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.analysis.isSelfTailRecursive",
        "signature": {
          "typeParameters": [],
          "parameters": [
            {"name": "arg0", "type": {"variable": "hydra.core.model.Name"}, "isLazy": false},
            {"name": "arg1", "type": {"variable": "hydra.core.model.Term"}, "isLazy": false}],
          "result": {"type": {"literal": "boolean"}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "funcName",
                "domain": {"variable": "hydra.core.model.Name"},
                "body": {
                  "lambda": {
                    "parameter": "body",
                    "domain": {"variable": "hydra.core.model.Term"},
                    "body": {
                      "let": {
                        "bindings": [
                          {
                            "name": "callsSelf",
                            "term": {
                              "application": {
                                "function": {"variable": "hydra.core.lib.logic.not"},
                                "argument": {
                                  "application": {
                                    "function": {
                                      "application": {"function": {"variable": "hydra.core.variables.isFreeVariableInTerm"}, "argument": {"variable": "funcName"}}},
                                    "argument": {"variable": "body"}}}}},
                            "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": "callsSelf"}}},
                                "argument": {
                                  "application": {
                                    "function": {
                                      "application": {"function": {"variable": "hydra.core.analysis.isTailRecursiveInTailPosition"}, "argument": {"variable": "funcName"}}},
                                    "argument": {"variable": "body"}}}}},
                            "argument": {"literal": {"boolean": false}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {"literal": {"string": "Check if a term body is self-tail-recursive with respect to a function name"}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.analysis.isSimpleAssignment",
        "signature": {
          "typeParameters": [],
          "parameters": [{"name": "arg0", "type": {"variable": "hydra.core.model.Term"}, "isLazy": false}],
          "result": {"type": {"literal": "boolean"}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "term",
                "domain": {"variable": "hydra.core.model.Term"},
                "body": {
                  "application": {
                    "function": {
                      "cases": {
                        "typeName": "hydra.core.model.Term",
                        "default": {
                          "let": {
                            "bindings": [
                              {
                                "name": "baseTerm",
                                "term": {
                                  "application": {
                                    "function": {
                                      "typeApplication": {
                                        "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"variable": "hydra.core.model.Term"}}},
                                        "type": {"list": {"variable": "hydra.core.model.Term"}}}},
                                    "argument": {
                                      "application": {
                                        "function": {"application": {"function": {"variable": "hydra.core.analysis.gatherArgs"}, "argument": {"variable": "term"}}},
                                        "argument": {"typeApplication": {"body": {"list": []}, "type": {"variable": "hydra.core.model.Term"}}}}}}},
                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                            "body": {
                              "application": {
                                "function": {
                                  "cases": {
                                    "typeName": "hydra.core.model.Term",
                                    "default": {"literal": {"boolean": true}},
                                    "cases": [
                                      {
                                        "name": "cases",
                                        "handler": {
                                          "lambda": {"parameter": "_", "domain": {"variable": "hydra.core.model.CaseStatement"}, "body": {"literal": {"boolean": false}}}}}]}},
                                "argument": {"variable": "baseTerm"}}}}},
                        "cases": [
                          {
                            "name": "annotated",
                            "handler": {
                              "lambda": {
                                "parameter": "at",
                                "domain": {"variable": "hydra.core.model.AnnotatedTerm"},
                                "body": {
                                  "application": {
                                    "function": {"variable": "hydra.core.analysis.isSimpleAssignment"},
                                    "argument": {
                                      "application": {
                                        "function": {"project": {"typeName": "hydra.core.model.AnnotatedTerm", "fieldName": "body"}},
                                        "argument": {"variable": "at"}}}}}}}},
                          {
                            "name": "lambda",
                            "handler": {
                              "lambda": {"parameter": "_", "domain": {"variable": "hydra.core.model.Lambda"}, "body": {"literal": {"boolean": false}}}}},
                          {
                            "name": "let",
                            "handler": {"lambda": {"parameter": "_", "domain": {"variable": "hydra.core.model.Let"}, "body": {"literal": {"boolean": false}}}}},
                          {
                            "name": "typeLambda",
                            "handler": {
                              "lambda": {"parameter": "_", "domain": {"variable": "hydra.core.model.TypeLambda"}, "body": {"literal": {"boolean": false}}}}},
                          {
                            "name": "typeApplication",
                            "handler": {
                              "lambda": {
                                "parameter": "ta",
                                "domain": {"variable": "hydra.core.model.TypeApplicationTerm"},
                                "body": {
                                  "application": {
                                    "function": {"variable": "hydra.core.analysis.isSimpleAssignment"},
                                    "argument": {
                                      "application": {
                                        "function": {"project": {"typeName": "hydra.core.model.TypeApplicationTerm", "fieldName": "body"}},
                                        "argument": {"variable": "ta"}}}}}}}}]}},
                    "argument": {"variable": "term"}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {"literal": {"string": "Check if a term can be encoded as a simple assignment"}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.analysis.isTailRecursiveInTailPosition",
        "signature": {
          "typeParameters": [],
          "parameters": [
            {"name": "arg0", "type": {"variable": "hydra.core.model.Name"}, "isLazy": false},
            {"name": "arg1", "type": {"variable": "hydra.core.model.Term"}, "isLazy": false}],
          "result": {"type": {"literal": "boolean"}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "funcName",
                "domain": {"variable": "hydra.core.model.Name"},
                "body": {
                  "lambda": {
                    "parameter": "term",
                    "domain": {"variable": "hydra.core.model.Term"},
                    "body": {
                      "let": {
                        "bindings": [
                          {
                            "name": "stripped",
                            "term": {
                              "application": {"function": {"variable": "hydra.core.strip.deannotateAndDetypeTerm"}, "argument": {"variable": "term"}}},
                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                        "body": {
                          "application": {
                            "function": {
                              "cases": {
                                "typeName": "hydra.core.model.Term",
                                "default": {
                                  "application": {
                                    "function": {
                                      "application": {"function": {"variable": "hydra.core.variables.isFreeVariableInTerm"}, "argument": {"variable": "funcName"}}},
                                    "argument": {"variable": "term"}}},
                                "cases": [
                                  {
                                    "name": "application",
                                    "handler": {
                                      "lambda": {
                                        "parameter": "app",
                                        "domain": {"variable": "hydra.core.model.Application"},
                                        "body": {
                                          "let": {
                                            "bindings": [
                                              {
                                                "name": "gathered",
                                                "term": {
                                                  "application": {"function": {"variable": "hydra.core.analysis.gatherApplications"}, "argument": {"variable": "stripped"}}},
                                                "typeScheme": {
                                                  "variables": [],
                                                  "body": {"pair": {"first": {"list": {"variable": "hydra.core.model.Term"}}, "second": {"variable": "hydra.core.model.Term"}}},
                                                  "constraints": []}}],
                                            "body": {
                                              "let": {
                                                "bindings": [
                                                  {
                                                    "name": "gatherArgs",
                                                    "term": {
                                                      "application": {
                                                        "function": {
                                                          "typeApplication": {
                                                            "body": {
                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"list": {"variable": "hydra.core.model.Term"}}}},
                                                            "type": {"variable": "hydra.core.model.Term"}}},
                                                        "argument": {"variable": "gathered"}}},
                                                    "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Term"}}, "constraints": []}}],
                                                "body": {
                                                  "let": {
                                                    "bindings": [
                                                      {
                                                        "name": "gatherFun",
                                                        "term": {
                                                          "application": {
                                                            "function": {
                                                              "typeApplication": {
                                                                "body": {
                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"list": {"variable": "hydra.core.model.Term"}}}},
                                                                "type": {"variable": "hydra.core.model.Term"}}},
                                                            "argument": {"variable": "gathered"}}},
                                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                                    "body": {
                                                      "let": {
                                                        "bindings": [
                                                          {
                                                            "name": "strippedFun",
                                                            "term": {
                                                              "application": {"function": {"variable": "hydra.core.strip.deannotateAndDetypeTerm"}, "argument": {"variable": "gatherFun"}}},
                                                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                                        "body": {
                                                          "application": {
                                                            "function": {
                                                              "cases": {
                                                                "typeName": "hydra.core.model.Term",
                                                                "default": {
                                                                  "application": {
                                                                    "function": {
                                                                      "application": {"function": {"variable": "hydra.core.variables.isFreeVariableInTerm"}, "argument": {"variable": "funcName"}}},
                                                                    "argument": {"variable": "term"}}},
                                                                "cases": [
                                                                  {
                                                                    "name": "variable",
                                                                    "handler": {
                                                                      "lambda": {
                                                                        "parameter": "vname",
                                                                        "domain": {"variable": "hydra.core.model.Name"},
                                                                        "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": {"variable": "hydra.core.model.Name"}}},
                                                                                            "argument": {"variable": "vname"}}},
                                                                                        "argument": {"variable": "funcName"}}}}},
                                                                                "argument": {
                                                                                  "let": {
                                                                                    "bindings": [
                                                                                      {
                                                                                        "name": "argsNoFunc",
                                                                                        "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.Term"}}},
                                                                                                    "argument": {
                                                                                                      "lambda": {
                                                                                                        "parameter": "ok",
                                                                                                        "domain": {"literal": "boolean"},
                                                                                                        "body": {
                                                                                                          "lambda": {
                                                                                                            "parameter": "arg",
                                                                                                            "domain": {"variable": "hydra.core.model.Term"},
                                                                                                            "body": {
                                                                                                              "application": {
                                                                                                                "function": {"application": {"function": {"variable": "hydra.core.lib.logic.and"}, "argument": {"variable": "ok"}}},
                                                                                                                "argument": {
                                                                                                                  "application": {
                                                                                                                    "function": {
                                                                                                                      "application": {"function": {"variable": "hydra.core.variables.isFreeVariableInTerm"}, "argument": {"variable": "funcName"}}},
                                                                                                                    "argument": {"variable": "arg"}}}}}}}}}}},
                                                                                                "argument": {"literal": {"boolean": true}}}},
                                                                                            "argument": {"variable": "gatherArgs"}}},
                                                                                        "typeScheme": {"variables": [], "body": {"literal": "boolean"}, "constraints": []}}],
                                                                                    "body": {
                                                                                      "let": {
                                                                                        "bindings": [
                                                                                          {
                                                                                            "name": "argsNoLambda",
                                                                                            "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.Term"}}},
                                                                                                        "argument": {
                                                                                                          "lambda": {
                                                                                                            "parameter": "ok",
                                                                                                            "domain": {"literal": "boolean"},
                                                                                                            "body": {
                                                                                                              "lambda": {
                                                                                                                "parameter": "arg",
                                                                                                                "domain": {"variable": "hydra.core.model.Term"},
                                                                                                                "body": {
                                                                                                                  "application": {
                                                                                                                    "function": {"application": {"function": {"variable": "hydra.core.lib.logic.and"}, "argument": {"variable": "ok"}}},
                                                                                                                    "argument": {
                                                                                                                      "application": {
                                                                                                                        "function": {"variable": "hydra.core.lib.logic.not"},
                                                                                                                        "argument": {
                                                                                                                          "application": {
                                                                                                                            "function": {
                                                                                                                              "application": {
                                                                                                                                "function": {
                                                                                                                                  "application": {
                                                                                                                                    "function": {
                                                                                                                                      "application": {
                                                                                                                                        "function": {"typeApplication": {"body": {"variable": "hydra.core.rewriting.foldOverTerm"}, "type": {"literal": "boolean"}}},
                                                                                                                                        "argument": {"inject": {"typeName": "hydra.core.coders.TraversalOrder", "field": {"name": "pre", "term": "unit"}}}}},
                                                                                                                                    "argument": {
                                                                                                                                      "lambda": {
                                                                                                                                        "parameter": "found",
                                                                                                                                        "domain": {"literal": "boolean"},
                                                                                                                                        "body": {
                                                                                                                                          "lambda": {
                                                                                                                                            "parameter": "t",
                                                                                                                                            "domain": {"variable": "hydra.core.model.Term"},
                                                                                                                                            "body": {
                                                                                                                                              "application": {
                                                                                                                                                "function": {"application": {"function": {"variable": "hydra.core.lib.logic.or"}, "argument": {"variable": "found"}}},
                                                                                                                                                "argument": {
                                                                                                                                                  "application": {
                                                                                                                                                    "function": {
                                                                                                                                                      "cases": {
                                                                                                                                                        "typeName": "hydra.core.model.Term",
                                                                                                                                                        "default": {"literal": {"boolean": false}},
                                                                                                                                                        "cases": [
                                                                                                                                                          {
                                                                                                                                                            "name": "lambda",
                                                                                                                                                            "handler": {
                                                                                                                                                              "lambda": {
                                                                                                                                                                "parameter": "lam",
                                                                                                                                                                "domain": {"variable": "hydra.core.model.Lambda"},
                                                                                                                                                                "body": {
                                                                                                                                                                  "let": {
                                                                                                                                                                    "bindings": [
                                                                                                                                                                      {
                                                                                                                                                                        "name": "ignore",
                                                                                                                                                                        "term": {
                                                                                                                                                                          "application": {"function": {"project": {"typeName": "hydra.core.model.Lambda", "fieldName": "body"}}, "argument": {"variable": "lam"}}},
                                                                                                                                                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                                                                                                                                                    "body": {"literal": {"boolean": true}}}}}}}]}},
                                                                                                                                                    "argument": {"variable": "t"}}}}}}}}}}},
                                                                                                                                "argument": {"literal": {"boolean": false}}}},
                                                                                                                            "argument": {"variable": "arg"}}}}}}}}}}}}},
                                                                                                    "argument": {"literal": {"boolean": true}}}},
                                                                                                "argument": {"variable": "gatherArgs"}}},
                                                                                            "typeScheme": {"variables": [], "body": {"literal": "boolean"}, "constraints": []}}],
                                                                                        "body": {
                                                                                          "application": {
                                                                                            "function": {"application": {"function": {"variable": "hydra.core.lib.logic.and"}, "argument": {"variable": "argsNoFunc"}}},
                                                                                            "argument": {"variable": "argsNoLambda"}}}}}}}}},
                                                                            "argument": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "application": {"function": {"variable": "hydra.core.variables.isFreeVariableInTerm"}, "argument": {"variable": "funcName"}}},
                                                                                "argument": {"variable": "term"}}}}}}}},
                                                                  {
                                                                    "name": "cases",
                                                                    "handler": {
                                                                      "lambda": {
                                                                        "parameter": "cs",
                                                                        "domain": {"variable": "hydra.core.model.CaseStatement"},
                                                                        "body": {
                                                                          "let": {
                                                                            "bindings": [
                                                                              {
                                                                                "name": "cases_",
                                                                                "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": "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": "branchesOk",
                                                                                        "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.CaseAlternative"}}},
                                                                                                    "argument": {
                                                                                                      "lambda": {
                                                                                                        "parameter": "ok",
                                                                                                        "domain": {"literal": "boolean"},
                                                                                                        "body": {
                                                                                                          "lambda": {
                                                                                                            "parameter": "field",
                                                                                                            "domain": {"variable": "hydra.core.model.CaseAlternative"},
                                                                                                            "body": {
                                                                                                              "application": {
                                                                                                                "function": {"application": {"function": {"variable": "hydra.core.lib.logic.and"}, "argument": {"variable": "ok"}}},
                                                                                                                "argument": {
                                                                                                                  "application": {
                                                                                                                    "function": {
                                                                                                                      "application": {"function": {"variable": "hydra.core.analysis.isTailRecursiveInTailPosition"}, "argument": {"variable": "funcName"}}},
                                                                                                                    "argument": {
                                                                                                                      "application": {
                                                                                                                        "function": {"project": {"typeName": "hydra.core.model.CaseAlternative", "fieldName": "handler"}},
                                                                                                                        "argument": {"variable": "field"}}}}}}}}}}}}},
                                                                                                "argument": {"literal": {"boolean": true}}}},
                                                                                            "argument": {"variable": "cases_"}}},
                                                                                        "typeScheme": {"variables": [], "body": {"literal": "boolean"}, "constraints": []}}],
                                                                                    "body": {
                                                                                      "let": {
                                                                                        "bindings": [
                                                                                          {
                                                                                            "name": "dfltOk",
                                                                                            "term": {
                                                                                              "application": {
                                                                                                "function": {
                                                                                                  "application": {
                                                                                                    "function": {
                                                                                                      "application": {
                                                                                                        "function": {
                                                                                                          "typeApplication": {
                                                                                                            "body": {
                                                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.optionals.match"}, "type": {"variable": "hydra.core.model.Term"}}},
                                                                                                            "type": {"literal": "boolean"}}},
                                                                                                        "argument": {"variable": "dflt"}}},
                                                                                                    "argument": {"literal": {"boolean": true}}}},
                                                                                                "argument": {
                                                                                                  "lambda": {
                                                                                                    "parameter": "d",
                                                                                                    "domain": {"variable": "hydra.core.model.Term"},
                                                                                                    "body": {
                                                                                                      "application": {
                                                                                                        "function": {
                                                                                                          "application": {"function": {"variable": "hydra.core.analysis.isTailRecursiveInTailPosition"}, "argument": {"variable": "funcName"}}},
                                                                                                        "argument": {"variable": "d"}}}}}}},
                                                                                            "typeScheme": {"variables": [], "body": {"literal": "boolean"}, "constraints": []}}],
                                                                                        "body": {
                                                                                          "let": {
                                                                                            "bindings": [
                                                                                              {
                                                                                                "name": "argsOk",
                                                                                                "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.Term"}}},
                                                                                                            "argument": {
                                                                                                              "lambda": {
                                                                                                                "parameter": "ok",
                                                                                                                "domain": {"literal": "boolean"},
                                                                                                                "body": {
                                                                                                                  "lambda": {
                                                                                                                    "parameter": "arg",
                                                                                                                    "domain": {"variable": "hydra.core.model.Term"},
                                                                                                                    "body": {
                                                                                                                      "application": {
                                                                                                                        "function": {"application": {"function": {"variable": "hydra.core.lib.logic.and"}, "argument": {"variable": "ok"}}},
                                                                                                                        "argument": {
                                                                                                                          "application": {
                                                                                                                            "function": {
                                                                                                                              "application": {"function": {"variable": "hydra.core.variables.isFreeVariableInTerm"}, "argument": {"variable": "funcName"}}},
                                                                                                                            "argument": {"variable": "arg"}}}}}}}}}}},
                                                                                                        "argument": {"literal": {"boolean": true}}}},
                                                                                                    "argument": {"variable": "gatherArgs"}}},
                                                                                                "typeScheme": {"variables": [], "body": {"literal": "boolean"}, "constraints": []}}],
                                                                                            "body": {
                                                                                              "application": {
                                                                                                "function": {
                                                                                                  "application": {
                                                                                                    "function": {"variable": "hydra.core.lib.logic.and"},
                                                                                                    "argument": {
                                                                                                      "application": {
                                                                                                        "function": {"application": {"function": {"variable": "hydra.core.lib.logic.and"}, "argument": {"variable": "branchesOk"}}},
                                                                                                        "argument": {"variable": "dfltOk"}}}}},
                                                                                                "argument": {"variable": "argsOk"}}}}}}}}}}}}}}}}]}},
                                                            "argument": {"variable": "strippedFun"}}}}}}}}}}}}}},
                                  {
                                    "name": "lambda",
                                    "handler": {
                                      "lambda": {
                                        "parameter": "lam",
                                        "domain": {"variable": "hydra.core.model.Lambda"},
                                        "body": {
                                          "application": {
                                            "function": {
                                              "application": {"function": {"variable": "hydra.core.analysis.isTailRecursiveInTailPosition"}, "argument": {"variable": "funcName"}}},
                                            "argument": {
                                              "application": {"function": {"project": {"typeName": "hydra.core.model.Lambda", "fieldName": "body"}}, "argument": {"variable": "lam"}}}}}}}},
                                  {
                                    "name": "let",
                                    "handler": {
                                      "lambda": {
                                        "parameter": "lt",
                                        "domain": {"variable": "hydra.core.model.Let"},
                                        "body": {
                                          "let": {
                                            "bindings": [
                                              {
                                                "name": "bindingsOk",
                                                "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.Binding"}}},
                                                            "argument": {
                                                              "lambda": {
                                                                "parameter": "ok",
                                                                "domain": {"literal": "boolean"},
                                                                "body": {
                                                                  "lambda": {
                                                                    "parameter": "b",
                                                                    "domain": {"variable": "hydra.core.model.Binding"},
                                                                    "body": {
                                                                      "application": {
                                                                        "function": {"application": {"function": {"variable": "hydra.core.lib.logic.and"}, "argument": {"variable": "ok"}}},
                                                                        "argument": {
                                                                          "application": {
                                                                            "function": {
                                                                              "application": {"function": {"variable": "hydra.core.variables.isFreeVariableInTerm"}, "argument": {"variable": "funcName"}}},
                                                                            "argument": {
                                                                              "application": {"function": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "term"}}, "argument": {"variable": "b"}}}}}}}}}}}}},
                                                        "argument": {"literal": {"boolean": true}}}},
                                                    "argument": {
                                                      "application": {"function": {"project": {"typeName": "hydra.core.model.Let", "fieldName": "bindings"}}, "argument": {"variable": "lt"}}}}},
                                                "typeScheme": {"variables": [], "body": {"literal": "boolean"}, "constraints": []}}],
                                            "body": {
                                              "application": {
                                                "function": {"application": {"function": {"variable": "hydra.core.lib.logic.and"}, "argument": {"variable": "bindingsOk"}}},
                                                "argument": {
                                                  "application": {
                                                    "function": {
                                                      "application": {"function": {"variable": "hydra.core.analysis.isTailRecursiveInTailPosition"}, "argument": {"variable": "funcName"}}},
                                                    "argument": {
                                                      "application": {"function": {"project": {"typeName": "hydra.core.model.Let", "fieldName": "body"}}, "argument": {"variable": "lt"}}}}}}}}}}}}]}},
                            "argument": {"variable": "stripped"}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {"literal": {"string": "Check that all self-references are in tail position"}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.analysis.lowerSelfTailRecursion",
        "signature": {
          "typeParameters": [],
          "parameters": [
            {"name": "arg0", "type": {"variable": "hydra.core.model.Name"}, "isLazy": false},
            {"name": "arg1", "type": {"list": {"variable": "hydra.core.model.Name"}}, "isLazy": false},
            {"name": "arg2", "type": {"variable": "hydra.core.model.Term"}, "isLazy": false}],
          "result": {"type": {"optional": {"variable": "hydra.core.coders.TcoLoopPlan"}}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "funcName",
                "domain": {"variable": "hydra.core.model.Name"},
                "body": {
                  "lambda": {
                    "parameter": "paramNames",
                    "domain": {"list": {"variable": "hydra.core.model.Name"}},
                    "body": {
                      "lambda": {
                        "parameter": "body",
                        "domain": {"variable": "hydra.core.model.Term"},
                        "body": {
                          "application": {
                            "function": {
                              "application": {
                                "function": {
                                  "application": {
                                    "function": {
                                      "typeApplication": {
                                        "body": {"variable": "hydra.core.lib.logic.ifElse"},
                                        "type": {"optional": {"variable": "hydra.core.coders.TcoLoopPlan"}}}},
                                    "argument": {
                                      "application": {
                                        "function": {
                                          "application": {"function": {"variable": "hydra.core.analysis.isSelfTailRecursive"}, "argument": {"variable": "funcName"}}},
                                        "argument": {"variable": "body"}}}}},
                                "argument": {
                                  "optional": {
                                    "record": {
                                      "typeName": "hydra.core.coders.TcoLoopPlan",
                                      "fields": [
                                        {"name": "params", "term": {"variable": "paramNames"}},
                                        {
                                          "name": "body",
                                          "term": {
                                            "application": {
                                              "function": {
                                                "application": {
                                                  "function": {
                                                    "application": {
                                                      "function": {
                                                        "typeApplication": {"body": {"variable": "hydra.core.analysis.lowerTcoStep"}, "type": {"list": {"variable": "hydra.core.model.Name"}}}},
                                                      "argument": {"variable": "funcName"}}},
                                                  "argument": {"variable": "paramNames"}}},
                                              "argument": {"variable": "body"}}}}]}}}}},
                            "argument": {"typeApplication": {"body": {"optional": null}, "type": {"variable": "hydra.core.coders.TcoLoopPlan"}}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {
                    "literal": {
                      "string": "Lower a self-tail-recursive function body into an explicit TcoLoopPlan, or Nothing if the body is not self-tail-recursive. Mirrors the traversal of isTailRecursiveInTailPosition, but builds a TcoStep tree instead of a boolean verdict."}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.analysis.lowerTcoStep",
        "signature": {
          "typeParameters": [{"name": "t0", "constraints": []}],
          "parameters": [
            {"name": "arg0", "type": {"variable": "hydra.core.model.Name"}, "isLazy": false},
            {"name": "arg1", "type": {"variable": "t0"}, "isLazy": false},
            {"name": "arg2", "type": {"variable": "hydra.core.model.Term"}, "isLazy": false}],
          "result": {"type": {"variable": "hydra.core.coders.TcoStep"}}},
        "body": {
          "typeLambda": {
            "parameter": "t0",
            "body": {
              "annotated": {
                "body": {
                  "lambda": {
                    "parameter": "funcName",
                    "domain": {"variable": "hydra.core.model.Name"},
                    "body": {
                      "lambda": {
                        "parameter": "paramNames",
                        "domain": {"variable": "t0"},
                        "body": {
                          "lambda": {
                            "parameter": "term",
                            "domain": {"variable": "hydra.core.model.Term"},
                            "body": {
                              "let": {
                                "bindings": [
                                  {
                                    "name": "stripped",
                                    "term": {
                                      "application": {"function": {"variable": "hydra.core.strip.deannotateAndDetypeTerm"}, "argument": {"variable": "term"}}},
                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                "body": {
                                  "application": {
                                    "function": {
                                      "cases": {
                                        "typeName": "hydra.core.model.Term",
                                        "default": {"inject": {"typeName": "hydra.core.coders.TcoStep", "field": {"name": "return", "term": {"variable": "term"}}}},
                                        "cases": [
                                          {
                                            "name": "application",
                                            "handler": {
                                              "lambda": {
                                                "parameter": "app",
                                                "domain": {"variable": "hydra.core.model.Application"},
                                                "body": {
                                                  "let": {
                                                    "bindings": [
                                                      {
                                                        "name": "gathered",
                                                        "term": {
                                                          "application": {"function": {"variable": "hydra.core.analysis.gatherApplications"}, "argument": {"variable": "stripped"}}},
                                                        "typeScheme": {
                                                          "variables": [],
                                                          "body": {"pair": {"first": {"list": {"variable": "hydra.core.model.Term"}}, "second": {"variable": "hydra.core.model.Term"}}},
                                                          "constraints": []}}],
                                                    "body": {
                                                      "let": {
                                                        "bindings": [
                                                          {
                                                            "name": "gatherArgs",
                                                            "term": {
                                                              "application": {
                                                                "function": {
                                                                  "typeApplication": {
                                                                    "body": {
                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"list": {"variable": "hydra.core.model.Term"}}}},
                                                                    "type": {"variable": "hydra.core.model.Term"}}},
                                                                "argument": {"variable": "gathered"}}},
                                                            "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Term"}}, "constraints": []}}],
                                                        "body": {
                                                          "let": {
                                                            "bindings": [
                                                              {
                                                                "name": "gatherFun",
                                                                "term": {
                                                                  "application": {
                                                                    "function": {
                                                                      "typeApplication": {
                                                                        "body": {
                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"list": {"variable": "hydra.core.model.Term"}}}},
                                                                        "type": {"variable": "hydra.core.model.Term"}}},
                                                                    "argument": {"variable": "gathered"}}},
                                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                                            "body": {
                                                              "let": {
                                                                "bindings": [
                                                                  {
                                                                    "name": "strippedFun",
                                                                    "term": {
                                                                      "application": {"function": {"variable": "hydra.core.strip.deannotateAndDetypeTerm"}, "argument": {"variable": "gatherFun"}}},
                                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                                                "body": {
                                                                  "application": {
                                                                    "function": {
                                                                      "cases": {
                                                                        "typeName": "hydra.core.model.Term",
                                                                        "default": {"inject": {"typeName": "hydra.core.coders.TcoStep", "field": {"name": "return", "term": {"variable": "term"}}}},
                                                                        "cases": [
                                                                          {
                                                                            "name": "variable",
                                                                            "handler": {
                                                                              "lambda": {
                                                                                "parameter": "vname",
                                                                                "domain": {"variable": "hydra.core.model.Name"},
                                                                                "body": {
                                                                                  "application": {
                                                                                    "function": {
                                                                                      "application": {
                                                                                        "function": {
                                                                                          "application": {
                                                                                            "function": {
                                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.logic.ifElse"}, "type": {"variable": "hydra.core.coders.TcoStep"}}},
                                                                                            "argument": {
                                                                                              "application": {
                                                                                                "function": {
                                                                                                  "application": {
                                                                                                    "function": {
                                                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.equality.equal"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                    "argument": {"variable": "vname"}}},
                                                                                                "argument": {"variable": "funcName"}}}}},
                                                                                        "argument": {"inject": {"typeName": "hydra.core.coders.TcoStep", "field": {"name": "continue", "term": {"variable": "gatherArgs"}}}}}},
                                                                                    "argument": {"inject": {"typeName": "hydra.core.coders.TcoStep", "field": {"name": "return", "term": {"variable": "term"}}}}}}}}},
                                                                          {
                                                                            "name": "cases",
                                                                            "handler": {
                                                                              "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": "cases_",
                                                                                            "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": "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": "loweredCases",
                                                                                                    "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.coders.TcoCaseAlternative"}}},
                                                                                                            "argument": {
                                                                                                              "lambda": {
                                                                                                                "parameter": "field",
                                                                                                                "domain": {"variable": "hydra.core.model.CaseAlternative"},
                                                                                                                "body": {
                                                                                                                  "let": {
                                                                                                                    "bindings": [
                                                                                                                      {
                                                                                                                        "name": "handler",
                                                                                                                        "term": {
                                                                                                                          "application": {
                                                                                                                            "function": {"project": {"typeName": "hydra.core.model.CaseAlternative", "fieldName": "handler"}},
                                                                                                                            "argument": {"variable": "field"}}},
                                                                                                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                                                                                                    "body": {
                                                                                                                      "let": {
                                                                                                                        "bindings": [
                                                                                                                          {
                                                                                                                            "name": "strippedHandler",
                                                                                                                            "term": {
                                                                                                                              "application": {"function": {"variable": "hydra.core.strip.deannotateAndDetypeTerm"}, "argument": {"variable": "handler"}}},
                                                                                                                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                                                                                                        "body": {
                                                                                                                          "application": {
                                                                                                                            "function": {
                                                                                                                              "cases": {
                                                                                                                                "typeName": "hydra.core.model.Term",
                                                                                                                                "default": {
                                                                                                                                  "record": {
                                                                                                                                    "typeName": "hydra.core.coders.TcoCaseAlternative",
                                                                                                                                    "fields": [
                                                                                                                                      {
                                                                                                                                        "name": "name",
                                                                                                                                        "term": {
                                                                                                                                          "application": {
                                                                                                                                            "function": {"project": {"typeName": "hydra.core.model.CaseAlternative", "fieldName": "name"}},
                                                                                                                                            "argument": {"variable": "field"}}}},
                                                                                                                                      {"name": "parameter", "term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "_"}}}}},
                                                                                                                                      {
                                                                                                                                        "name": "handler",
                                                                                                                                        "term": {
                                                                                                                                          "application": {
                                                                                                                                            "function": {
                                                                                                                                              "application": {
                                                                                                                                                "function": {
                                                                                                                                                  "application": {
                                                                                                                                                    "function": {"typeApplication": {"body": {"variable": "hydra.core.analysis.lowerTcoStep"}, "type": {"variable": "t0"}}},
                                                                                                                                                    "argument": {"variable": "funcName"}}},
                                                                                                                                                "argument": {"variable": "paramNames"}}},
                                                                                                                                            "argument": {"variable": "handler"}}}}]}},
                                                                                                                                "cases": [
                                                                                                                                  {
                                                                                                                                    "name": "lambda",
                                                                                                                                    "handler": {
                                                                                                                                      "lambda": {
                                                                                                                                        "parameter": "lam",
                                                                                                                                        "domain": {"variable": "hydra.core.model.Lambda"},
                                                                                                                                        "body": {
                                                                                                                                          "let": {
                                                                                                                                            "bindings": [
                                                                                                                                              {
                                                                                                                                                "name": "param",
                                                                                                                                                "term": {
                                                                                                                                                  "application": {
                                                                                                                                                    "function": {"project": {"typeName": "hydra.core.model.Lambda", "fieldName": "parameter"}},
                                                                                                                                                    "argument": {"variable": "lam"}}},
                                                                                                                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Name"}, "constraints": []}}],
                                                                                                                                            "body": {
                                                                                                                                              "let": {
                                                                                                                                                "bindings": [
                                                                                                                                                  {
                                                                                                                                                    "name": "lamBody",
                                                                                                                                                    "term": {
                                                                                                                                                      "application": {"function": {"project": {"typeName": "hydra.core.model.Lambda", "fieldName": "body"}}, "argument": {"variable": "lam"}}},
                                                                                                                                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                                                                                                                                "body": {
                                                                                                                                                  "record": {
                                                                                                                                                    "typeName": "hydra.core.coders.TcoCaseAlternative",
                                                                                                                                                    "fields": [
                                                                                                                                                      {
                                                                                                                                                        "name": "name",
                                                                                                                                                        "term": {
                                                                                                                                                          "application": {
                                                                                                                                                            "function": {"project": {"typeName": "hydra.core.model.CaseAlternative", "fieldName": "name"}},
                                                                                                                                                            "argument": {"variable": "field"}}}},
                                                                                                                                                      {"name": "parameter", "term": {"variable": "param"}},
                                                                                                                                                      {
                                                                                                                                                        "name": "handler",
                                                                                                                                                        "term": {
                                                                                                                                                          "application": {
                                                                                                                                                            "function": {
                                                                                                                                                              "application": {
                                                                                                                                                                "function": {
                                                                                                                                                                  "application": {
                                                                                                                                                                    "function": {"typeApplication": {"body": {"variable": "hydra.core.analysis.lowerTcoStep"}, "type": {"variable": "t0"}}},
                                                                                                                                                                    "argument": {"variable": "funcName"}}},
                                                                                                                                                                "argument": {"variable": "paramNames"}}},
                                                                                                                                                            "argument": {"variable": "lamBody"}}}}]}}}}}}}}}]}},
                                                                                                                            "argument": {"variable": "strippedHandler"}}}}}}}}}}},
                                                                                                        "argument": {"variable": "cases_"}}},
                                                                                                    "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.coders.TcoCaseAlternative"}}, "constraints": []}}],
                                                                                                "body": {
                                                                                                  "let": {
                                                                                                    "bindings": [
                                                                                                      {
                                                                                                        "name": "loweredDflt",
                                                                                                        "term": {
                                                                                                          "application": {
                                                                                                            "function": {
                                                                                                              "application": {
                                                                                                                "function": {
                                                                                                                  "typeApplication": {
                                                                                                                    "body": {
                                                                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.optionals.map"}, "type": {"variable": "hydra.core.model.Term"}}},
                                                                                                                    "type": {"variable": "hydra.core.coders.TcoStep"}}},
                                                                                                                "argument": {
                                                                                                                  "lambda": {
                                                                                                                    "parameter": "d",
                                                                                                                    "domain": {"variable": "hydra.core.model.Term"},
                                                                                                                    "body": {
                                                                                                                      "application": {
                                                                                                                        "function": {
                                                                                                                          "application": {
                                                                                                                            "function": {
                                                                                                                              "application": {
                                                                                                                                "function": {"typeApplication": {"body": {"variable": "hydra.core.analysis.lowerTcoStep"}, "type": {"variable": "t0"}}},
                                                                                                                                "argument": {"variable": "funcName"}}},
                                                                                                                            "argument": {"variable": "paramNames"}}},
                                                                                                                        "argument": {"variable": "d"}}}}}}},
                                                                                                            "argument": {"variable": "dflt"}}},
                                                                                                        "typeScheme": {"variables": [], "body": {"optional": {"variable": "hydra.core.coders.TcoStep"}}, "constraints": []}}],
                                                                                                    "body": {
                                                                                                      "let": {
                                                                                                        "bindings": [
                                                                                                          {
                                                                                                            "name": "scrutinee_",
                                                                                                            "term": {
                                                                                                              "application": {
                                                                                                                "function": {
                                                                                                                  "application": {
                                                                                                                    "function": {
                                                                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.optionals.withDefault"}, "type": {"variable": "hydra.core.model.Term"}}},
                                                                                                                    "argument": {"variable": "term"}}},
                                                                                                                "argument": {
                                                                                                                  "application": {
                                                                                                                    "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.head"}, "type": {"variable": "hydra.core.model.Term"}}},
                                                                                                                    "argument": {"variable": "gatherArgs"}}}}},
                                                                                                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                                                                                        "body": {
                                                                                                          "inject": {
                                                                                                            "typeName": "hydra.core.coders.TcoStep",
                                                                                                            "field": {
                                                                                                              "name": "cases",
                                                                                                              "term": {
                                                                                                                "record": {
                                                                                                                  "typeName": "hydra.core.coders.TcoCaseStatement",
                                                                                                                  "fields": [
                                                                                                                    {"name": "typeName", "term": {"variable": "tname"}},
                                                                                                                    {"name": "scrutinee", "term": {"variable": "scrutinee_"}},
                                                                                                                    {"name": "default", "term": {"variable": "loweredDflt"}},
                                                                                                                    {"name": "cases", "term": {"variable": "loweredCases"}}]}}}}}}}}}}}}}}}}}}}}]}},
                                                                    "argument": {"variable": "strippedFun"}}}}}}}}}}}}}},
                                          {
                                            "name": "lambda",
                                            "handler": {
                                              "lambda": {
                                                "parameter": "lam",
                                                "domain": {"variable": "hydra.core.model.Lambda"},
                                                "body": {
                                                  "application": {
                                                    "function": {
                                                      "application": {
                                                        "function": {
                                                          "application": {
                                                            "function": {"typeApplication": {"body": {"variable": "hydra.core.analysis.lowerTcoStep"}, "type": {"variable": "t0"}}},
                                                            "argument": {"variable": "funcName"}}},
                                                        "argument": {"variable": "paramNames"}}},
                                                    "argument": {
                                                      "application": {"function": {"project": {"typeName": "hydra.core.model.Lambda", "fieldName": "body"}}, "argument": {"variable": "lam"}}}}}}}},
                                          {
                                            "name": "let",
                                            "handler": {
                                              "lambda": {
                                                "parameter": "lt",
                                                "domain": {"variable": "hydra.core.model.Let"},
                                                "body": {
                                                  "let": {
                                                    "bindings": [
                                                      {
                                                        "name": "loweredBindings",
                                                        "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.coders.TcoBinding"}}},
                                                                "argument": {
                                                                  "lambda": {
                                                                    "parameter": "b",
                                                                    "domain": {"variable": "hydra.core.model.Binding"},
                                                                    "body": {
                                                                      "record": {
                                                                        "typeName": "hydra.core.coders.TcoBinding",
                                                                        "fields": [
                                                                          {
                                                                            "name": "name",
                                                                            "term": {
                                                                              "application": {"function": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "name"}}, "argument": {"variable": "b"}}}},
                                                                          {
                                                                            "name": "term",
                                                                            "term": {
                                                                              "application": {"function": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "term"}}, "argument": {"variable": "b"}}}},
                                                                          {
                                                                            "name": "typeScheme",
                                                                            "term": {
                                                                              "application": {
                                                                                "function": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "typeScheme"}},
                                                                                "argument": {"variable": "b"}}}}]}}}}}},
                                                            "argument": {
                                                              "application": {"function": {"project": {"typeName": "hydra.core.model.Let", "fieldName": "bindings"}}, "argument": {"variable": "lt"}}}}},
                                                        "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.coders.TcoBinding"}}, "constraints": []}}],
                                                    "body": {
                                                      "inject": {
                                                        "typeName": "hydra.core.coders.TcoStep",
                                                        "field": {
                                                          "name": "let_",
                                                          "term": {
                                                            "record": {
                                                              "typeName": "hydra.core.coders.TcoLet",
                                                              "fields": [
                                                                {"name": "bindings", "term": {"variable": "loweredBindings"}},
                                                                {
                                                                  "name": "body",
                                                                  "term": {
                                                                    "application": {
                                                                      "function": {
                                                                        "application": {
                                                                          "function": {
                                                                            "application": {
                                                                              "function": {"typeApplication": {"body": {"variable": "hydra.core.analysis.lowerTcoStep"}, "type": {"variable": "t0"}}},
                                                                              "argument": {"variable": "funcName"}}},
                                                                          "argument": {"variable": "paramNames"}}},
                                                                      "argument": {
                                                                        "application": {"function": {"project": {"typeName": "hydra.core.model.Let", "fieldName": "body"}}, "argument": {"variable": "lt"}}}}}}]}}}}}}}}}}]}},
                                    "argument": {"variable": "stripped"}}}}}}}}}}},
                "annotation": {
                  "map": [
                    {
                      "key": {"variable": "description"},
                      "value": {"literal": {"string": "Lower a term in tail position into a TcoStep (continue/return/cases/let_)"}}}]}}}}}}},
    {
      "term": {
        "name": "hydra.core.analysis.moduleContainsBinaryLiterals",
        "signature": {
          "typeParameters": [],
          "parameters": [{"name": "arg0", "type": {"variable": "hydra.core.packaging.Module"}, "isLazy": false}],
          "result": {"type": {"literal": "boolean"}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "mod",
                "domain": {"variable": "hydra.core.packaging.Module"},
                "body": {
                  "let": {
                    "bindings": [
                      {
                        "name": "checkTerm",
                        "term": {
                          "lambda": {
                            "parameter": "found",
                            "domain": {"literal": "boolean"},
                            "body": {
                              "lambda": {
                                "parameter": "term",
                                "domain": {"variable": "hydra.core.model.Term"},
                                "body": {
                                  "application": {
                                    "function": {"application": {"function": {"variable": "hydra.core.lib.logic.or"}, "argument": {"variable": "found"}}},
                                    "argument": {
                                      "application": {
                                        "function": {
                                          "cases": {
                                            "typeName": "hydra.core.model.Term",
                                            "default": {"literal": {"boolean": false}},
                                            "cases": [
                                              {
                                                "name": "literal",
                                                "handler": {
                                                  "lambda": {
                                                    "parameter": "lit",
                                                    "domain": {"variable": "hydra.core.model.Literal"},
                                                    "body": {
                                                      "application": {
                                                        "function": {
                                                          "cases": {
                                                            "typeName": "hydra.core.model.Literal",
                                                            "default": {"literal": {"boolean": false}},
                                                            "cases": [
                                                              {
                                                                "name": "binary",
                                                                "handler": {"lambda": {"parameter": "_", "domain": {"literal": "binary"}, "body": {"literal": {"boolean": true}}}}}]}},
                                                        "argument": {"variable": "lit"}}}}}}]}},
                                        "argument": {"variable": "term"}}}}}}}}},
                        "typeScheme": {
                          "variables": [],
                          "body": {
                            "function": {
                              "domain": {"literal": "boolean"},
                              "codomain": {"function": {"domain": {"variable": "hydra.core.model.Term"}, "codomain": {"literal": "boolean"}}}}},
                          "constraints": []}}],
                    "body": {
                      "let": {
                        "bindings": [
                          {
                            "name": "termContainsBinary",
                            "term": {
                              "lambda": {
                                "parameter": "term",
                                "domain": {"variable": "hydra.core.model.Term"},
                                "body": {
                                  "application": {
                                    "function": {
                                      "application": {
                                        "function": {
                                          "application": {
                                            "function": {
                                              "application": {
                                                "function": {"typeApplication": {"body": {"variable": "hydra.core.rewriting.foldOverTerm"}, "type": {"literal": "boolean"}}},
                                                "argument": {"inject": {"typeName": "hydra.core.coders.TraversalOrder", "field": {"name": "pre", "term": "unit"}}}}},
                                            "argument": {"variable": "checkTerm"}}},
                                        "argument": {"literal": {"boolean": false}}}},
                                    "argument": {"variable": "term"}}}}},
                            "typeScheme": {
                              "variables": [],
                              "body": {"function": {"domain": {"variable": "hydra.core.model.Term"}, "codomain": {"literal": "boolean"}}},
                              "constraints": []}}],
                        "body": {
                          "let": {
                            "bindings": [
                              {
                                "name": "defTerms",
                                "term": {
                                  "application": {
                                    "function": {
                                      "typeApplication": {"body": {"variable": "hydra.core.lib.optionals.givens"}, "type": {"variable": "hydra.core.model.Term"}}},
                                    "argument": {
                                      "application": {
                                        "function": {
                                          "application": {
                                            "function": {
                                              "typeApplication": {
                                                "body": {
                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.packaging.Definition"}}},
                                                "type": {"optional": {"variable": "hydra.core.model.Term"}}}},
                                            "argument": {
                                              "lambda": {
                                                "parameter": "d",
                                                "domain": {"variable": "hydra.core.packaging.Definition"},
                                                "body": {
                                                  "application": {
                                                    "function": {
                                                      "cases": {
                                                        "typeName": "hydra.core.packaging.Definition",
                                                        "default": {"typeApplication": {"body": {"optional": null}, "type": {"variable": "hydra.core.model.Term"}}},
                                                        "cases": [
                                                          {
                                                            "name": "term",
                                                            "handler": {
                                                              "lambda": {
                                                                "parameter": "td",
                                                                "domain": {"variable": "hydra.core.packaging.TermDefinition"},
                                                                "body": {
                                                                  "optional": {
                                                                    "application": {
                                                                      "function": {"project": {"typeName": "hydra.core.packaging.TermDefinition", "fieldName": "body"}},
                                                                      "argument": {"variable": "td"}}}}}}}]}},
                                                    "argument": {"variable": "d"}}}}}}},
                                        "argument": {
                                          "application": {
                                            "function": {"project": {"typeName": "hydra.core.packaging.Module", "fieldName": "definitions"}},
                                            "argument": {"variable": "mod"}}}}}}},
                                "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Term"}}, "constraints": []}}],
                            "body": {
                              "application": {
                                "function": {
                                  "application": {
                                    "function": {
                                      "application": {
                                        "function": {
                                          "typeApplication": {
                                            "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.foldl"}, "type": {"literal": "boolean"}}},
                                            "type": {"variable": "hydra.core.model.Term"}}},
                                        "argument": {
                                          "lambda": {
                                            "parameter": "acc",
                                            "domain": {"literal": "boolean"},
                                            "body": {
                                              "lambda": {
                                                "parameter": "t",
                                                "domain": {"variable": "hydra.core.model.Term"},
                                                "body": {
                                                  "application": {
                                                    "function": {"application": {"function": {"variable": "hydra.core.lib.logic.or"}, "argument": {"variable": "acc"}}},
                                                    "argument": {"application": {"function": {"variable": "termContainsBinary"}, "argument": {"variable": "t"}}}}}}}}}}},
                                    "argument": {"literal": {"boolean": false}}}},
                                "argument": {"variable": "defTerms"}}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {"literal": {"string": "Check whether a module contains any binary literal values"}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.analysis.moduleContainsDecimalLiterals",
        "signature": {
          "typeParameters": [],
          "parameters": [{"name": "arg0", "type": {"variable": "hydra.core.packaging.Module"}, "isLazy": false}],
          "result": {"type": {"literal": "boolean"}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "mod",
                "domain": {"variable": "hydra.core.packaging.Module"},
                "body": {
                  "let": {
                    "bindings": [
                      {
                        "name": "checkTerm",
                        "term": {
                          "lambda": {
                            "parameter": "found",
                            "domain": {"literal": "boolean"},
                            "body": {
                              "lambda": {
                                "parameter": "term",
                                "domain": {"variable": "hydra.core.model.Term"},
                                "body": {
                                  "application": {
                                    "function": {"application": {"function": {"variable": "hydra.core.lib.logic.or"}, "argument": {"variable": "found"}}},
                                    "argument": {
                                      "application": {
                                        "function": {
                                          "cases": {
                                            "typeName": "hydra.core.model.Term",
                                            "default": {"literal": {"boolean": false}},
                                            "cases": [
                                              {
                                                "name": "literal",
                                                "handler": {
                                                  "lambda": {
                                                    "parameter": "lit",
                                                    "domain": {"variable": "hydra.core.model.Literal"},
                                                    "body": {
                                                      "application": {
                                                        "function": {
                                                          "cases": {
                                                            "typeName": "hydra.core.model.Literal",
                                                            "default": {"literal": {"boolean": false}},
                                                            "cases": [
                                                              {
                                                                "name": "decimal",
                                                                "handler": {"lambda": {"parameter": "_", "domain": {"literal": "decimal"}, "body": {"literal": {"boolean": true}}}}}]}},
                                                        "argument": {"variable": "lit"}}}}}}]}},
                                        "argument": {"variable": "term"}}}}}}}}},
                        "typeScheme": {
                          "variables": [],
                          "body": {
                            "function": {
                              "domain": {"literal": "boolean"},
                              "codomain": {"function": {"domain": {"variable": "hydra.core.model.Term"}, "codomain": {"literal": "boolean"}}}}},
                          "constraints": []}}],
                    "body": {
                      "let": {
                        "bindings": [
                          {
                            "name": "termContainsDecimal",
                            "term": {
                              "lambda": {
                                "parameter": "term",
                                "domain": {"variable": "hydra.core.model.Term"},
                                "body": {
                                  "application": {
                                    "function": {
                                      "application": {
                                        "function": {
                                          "application": {
                                            "function": {
                                              "application": {
                                                "function": {"typeApplication": {"body": {"variable": "hydra.core.rewriting.foldOverTerm"}, "type": {"literal": "boolean"}}},
                                                "argument": {"inject": {"typeName": "hydra.core.coders.TraversalOrder", "field": {"name": "pre", "term": "unit"}}}}},
                                            "argument": {"variable": "checkTerm"}}},
                                        "argument": {"literal": {"boolean": false}}}},
                                    "argument": {"variable": "term"}}}}},
                            "typeScheme": {
                              "variables": [],
                              "body": {"function": {"domain": {"variable": "hydra.core.model.Term"}, "codomain": {"literal": "boolean"}}},
                              "constraints": []}}],
                        "body": {
                          "let": {
                            "bindings": [
                              {
                                "name": "defTerms",
                                "term": {
                                  "application": {
                                    "function": {
                                      "typeApplication": {"body": {"variable": "hydra.core.lib.optionals.givens"}, "type": {"variable": "hydra.core.model.Term"}}},
                                    "argument": {
                                      "application": {
                                        "function": {
                                          "application": {
                                            "function": {
                                              "typeApplication": {
                                                "body": {
                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.packaging.Definition"}}},
                                                "type": {"optional": {"variable": "hydra.core.model.Term"}}}},
                                            "argument": {
                                              "lambda": {
                                                "parameter": "d",
                                                "domain": {"variable": "hydra.core.packaging.Definition"},
                                                "body": {
                                                  "application": {
                                                    "function": {
                                                      "cases": {
                                                        "typeName": "hydra.core.packaging.Definition",
                                                        "default": {"typeApplication": {"body": {"optional": null}, "type": {"variable": "hydra.core.model.Term"}}},
                                                        "cases": [
                                                          {
                                                            "name": "term",
                                                            "handler": {
                                                              "lambda": {
                                                                "parameter": "td",
                                                                "domain": {"variable": "hydra.core.packaging.TermDefinition"},
                                                                "body": {
                                                                  "optional": {
                                                                    "application": {
                                                                      "function": {"project": {"typeName": "hydra.core.packaging.TermDefinition", "fieldName": "body"}},
                                                                      "argument": {"variable": "td"}}}}}}}]}},
                                                    "argument": {"variable": "d"}}}}}}},
                                        "argument": {
                                          "application": {
                                            "function": {"project": {"typeName": "hydra.core.packaging.Module", "fieldName": "definitions"}},
                                            "argument": {"variable": "mod"}}}}}}},
                                "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Term"}}, "constraints": []}}],
                            "body": {
                              "application": {
                                "function": {
                                  "application": {
                                    "function": {
                                      "application": {
                                        "function": {
                                          "typeApplication": {
                                            "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.foldl"}, "type": {"literal": "boolean"}}},
                                            "type": {"variable": "hydra.core.model.Term"}}},
                                        "argument": {
                                          "lambda": {
                                            "parameter": "acc",
                                            "domain": {"literal": "boolean"},
                                            "body": {
                                              "lambda": {
                                                "parameter": "t",
                                                "domain": {"variable": "hydra.core.model.Term"},
                                                "body": {
                                                  "application": {
                                                    "function": {"application": {"function": {"variable": "hydra.core.lib.logic.or"}, "argument": {"variable": "acc"}}},
                                                    "argument": {"application": {"function": {"variable": "termContainsDecimal"}, "argument": {"variable": "t"}}}}}}}}}}},
                                    "argument": {"literal": {"boolean": false}}}},
                                "argument": {"variable": "defTerms"}}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {"literal": {"string": "Check whether a module contains any decimal literal values"}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.analysis.moduleDependencyModuleNames",
        "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": "boolean"}, "isLazy": false},
            {"name": "arg3", "type": {"literal": "boolean"}, "isLazy": false},
            {"name": "arg4", "type": {"literal": "boolean"}, "isLazy": false},
            {"name": "arg5", "type": {"literal": "boolean"}, "isLazy": false},
            {"name": "arg6", "type": {"variable": "hydra.core.packaging.Module"}, "isLazy": false}],
          "result": {
            "type": {
              "either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"set": {"variable": "hydra.core.packaging.ModuleName"}}}}}},
        "body": {
          "typeLambda": {
            "parameter": "t0",
            "body": {
              "annotated": {
                "body": {
                  "lambda": {
                    "parameter": "cx",
                    "domain": {"variable": "t0"},
                    "body": {
                      "lambda": {
                        "parameter": "graph",
                        "domain": {"variable": "hydra.core.graph.Graph"},
                        "body": {
                          "lambda": {
                            "parameter": "binds",
                            "domain": {"literal": "boolean"},
                            "body": {
                              "lambda": {
                                "parameter": "withPrims",
                                "domain": {"literal": "boolean"},
                                "body": {
                                  "lambda": {
                                    "parameter": "withNoms",
                                    "domain": {"literal": "boolean"},
                                    "body": {
                                      "lambda": {
                                        "parameter": "withSchema",
                                        "domain": {"literal": "boolean"},
                                        "body": {
                                          "lambda": {
                                            "parameter": "mod",
                                            "domain": {"variable": "hydra.core.packaging.Module"},
                                            "body": {
                                              "let": {
                                                "bindings": [
                                                  {
                                                    "name": "allBindings",
                                                    "term": {
                                                      "application": {
                                                        "function": {
                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.optionals.givens"}, "type": {"variable": "hydra.core.model.Binding"}}},
                                                        "argument": {
                                                          "application": {
                                                            "function": {
                                                              "application": {
                                                                "function": {
                                                                  "typeApplication": {
                                                                    "body": {
                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.packaging.Definition"}}},
                                                                    "type": {"optional": {"variable": "hydra.core.model.Binding"}}}},
                                                                "argument": {
                                                                  "lambda": {
                                                                    "parameter": "d",
                                                                    "domain": {"variable": "hydra.core.packaging.Definition"},
                                                                    "body": {
                                                                      "application": {
                                                                        "function": {
                                                                          "cases": {
                                                                            "typeName": "hydra.core.packaging.Definition",
                                                                            "default": {"typeApplication": {"body": {"optional": null}, "type": {"variable": "hydra.core.model.Binding"}}},
                                                                            "cases": [
                                                                              {
                                                                                "name": "type",
                                                                                "handler": {
                                                                                  "lambda": {
                                                                                    "parameter": "td",
                                                                                    "domain": {"variable": "hydra.core.packaging.TypeDefinition"},
                                                                                    "body": {
                                                                                      "optional": {
                                                                                        "application": {
                                                                                          "function": {
                                                                                            "application": {
                                                                                              "function": {
                                                                                                "lambda": {
                                                                                                  "parameter": "name",
                                                                                                  "domain": {"variable": "hydra.core.model.Name"},
                                                                                                  "body": {
                                                                                                    "lambda": {
                                                                                                      "parameter": "typ",
                                                                                                      "domain": {"variable": "hydra.core.model.Type"},
                                                                                                      "body": {
                                                                                                        "let": {
                                                                                                          "bindings": [
                                                                                                            {
                                                                                                              "name": "schemaTerm",
                                                                                                              "term": {
                                                                                                                "inject": {
                                                                                                                  "typeName": "hydra.core.model.Term",
                                                                                                                  "field": {
                                                                                                                    "name": "variable",
                                                                                                                    "term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.model.Type"}}}}}}},
                                                                                                              "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                                                                                          "body": {
                                                                                                            "let": {
                                                                                                              "bindings": [
                                                                                                                {
                                                                                                                  "name": "dataTerm",
                                                                                                                  "term": {
                                                                                                                    "application": {
                                                                                                                      "function": {"variable": "hydra.core.annotations.normalizeTermAnnotations"},
                                                                                                                      "argument": {
                                                                                                                        "inject": {
                                                                                                                          "typeName": "hydra.core.model.Term",
                                                                                                                          "field": {
                                                                                                                            "name": "annotated",
                                                                                                                            "term": {
                                                                                                                              "record": {
                                                                                                                                "typeName": "hydra.core.model.AnnotatedTerm",
                                                                                                                                "fields": [
                                                                                                                                  {
                                                                                                                                    "name": "body",
                                                                                                                                    "term": {"application": {"function": {"variable": "hydra.core.encode.model.type"}, "argument": {"variable": "typ"}}}},
                                                                                                                                  {
                                                                                                                                    "name": "annotation",
                                                                                                                                    "term": {
                                                                                                                                      "application": {
                                                                                                                                        "function": {"variable": "hydra.core.annotations.wrapAnnotationMap"},
                                                                                                                                        "argument": {
                                                                                                                                          "application": {
                                                                                                                                            "function": {
                                                                                                                                              "typeApplication": {
                                                                                                                                                "body": {
                                                                                                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.maps.fromList"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                                                                "type": {"variable": "hydra.core.model.Term"}}},
                                                                                                                                            "argument": {
                                                                                                                                              "list": [
                                                                                                                                                {
                                                                                                                                                  "typeApplication": {
                                                                                                                                                    "body": {
                                                                                                                                                      "typeApplication": {
                                                                                                                                                        "body": {"pair": {"first": {"variable": "hydra.core.constants.keyType"}, "second": {"variable": "schemaTerm"}}},
                                                                                                                                                        "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                                                                    "type": {"variable": "hydra.core.model.Term"}}}]}}}}}}]}}}}}}},
                                                                                                                  "typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
                                                                                                              "body": {
                                                                                                                "record": {
                                                                                                                  "typeName": "hydra.core.model.Binding",
                                                                                                                  "fields": [
                                                                                                                    {"name": "name", "term": {"variable": "name"}},
                                                                                                                    {"name": "term", "term": {"variable": "dataTerm"}},
                                                                                                                    {
                                                                                                                      "name": "typeScheme",
                                                                                                                      "term": {
                                                                                                                        "optional": {
                                                                                                                          "record": {
                                                                                                                            "typeName": "hydra.core.model.TypeScheme",
                                                                                                                            "fields": [
                                                                                                                              {
                                                                                                                                "name": "variables",
                                                                                                                                "term": {"typeApplication": {"body": {"list": []}, "type": {"variable": "hydra.core.model.Name"}}}},
                                                                                                                              {
                                                                                                                                "name": "body",
                                                                                                                                "term": {
                                                                                                                                  "inject": {
                                                                                                                                    "typeName": "hydra.core.model.Type",
                                                                                                                                    "field": {
                                                                                                                                      "name": "variable",
                                                                                                                                      "term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.model.Type"}}}}}}}},
                                                                                                                              {
                                                                                                                                "name": "constraints",
                                                                                                                                "term": {
                                                                                                                                  "typeApplication": {
                                                                                                                                    "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.empty"}, "type": {"variable": "hydra.core.model.Name"}}},
                                                                                                                                    "type": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}]}}}}]}}}}}}}}}},
                                                                                              "argument": {
                                                                                                "application": {
                                                                                                  "function": {"project": {"typeName": "hydra.core.packaging.TypeDefinition", "fieldName": "name"}},
                                                                                                  "argument": {"variable": "td"}}}}},
                                                                                          "argument": {
                                                                                            "application": {
                                                                                              "function": {"project": {"typeName": "hydra.core.model.TypeScheme", "fieldName": "body"}},
                                                                                              "argument": {
                                                                                                "application": {
                                                                                                  "function": {"project": {"typeName": "hydra.core.packaging.TypeDefinition", "fieldName": "body"}},
                                                                                                  "argument": {"variable": "td"}}}}}}}}}}},
                                                                              {
                                                                                "name": "term",
                                                                                "handler": {
                                                                                  "lambda": {
                                                                                    "parameter": "td",
                                                                                    "domain": {"variable": "hydra.core.packaging.TermDefinition"},
                                                                                    "body": {
                                                                                      "optional": {
                                                                                        "record": {
                                                                                          "typeName": "hydra.core.model.Binding",
                                                                                          "fields": [
                                                                                            {
                                                                                              "name": "name",
                                                                                              "term": {
                                                                                                "application": {
                                                                                                  "function": {"project": {"typeName": "hydra.core.packaging.TermDefinition", "fieldName": "name"}},
                                                                                                  "argument": {"variable": "td"}}}},
                                                                                            {
                                                                                              "name": "term",
                                                                                              "term": {
                                                                                                "application": {
                                                                                                  "function": {"project": {"typeName": "hydra.core.packaging.TermDefinition", "fieldName": "body"}},
                                                                                                  "argument": {"variable": "td"}}}},
                                                                                            {
                                                                                              "name": "typeScheme",
                                                                                              "term": {
                                                                                                "application": {
                                                                                                  "function": {
                                                                                                    "application": {
                                                                                                      "function": {
                                                                                                        "typeApplication": {
                                                                                                          "body": {
                                                                                                            "typeApplication": {"body": {"variable": "hydra.core.lib.optionals.map"}, "type": {"variable": "hydra.core.typing.TermSignature"}}},
                                                                                                          "type": {"variable": "hydra.core.model.TypeScheme"}}},
                                                                                                      "argument": {"variable": "hydra.core.scoping.termSignatureToTypeScheme"}}},
                                                                                                  "argument": {
                                                                                                    "application": {
                                                                                                      "function": {"project": {"typeName": "hydra.core.packaging.TermDefinition", "fieldName": "signature"}},
                                                                                                      "argument": {"variable": "td"}}}}}}]}}}}}}]}},
                                                                        "argument": {"variable": "d"}}}}}}},
                                                            "argument": {
                                                              "application": {
                                                                "function": {"project": {"typeName": "hydra.core.packaging.Module", "fieldName": "definitions"}},
                                                                "argument": {"variable": "mod"}}}}}}},
                                                    "typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Binding"}}, "constraints": []}}],
                                                "body": {
                                                  "application": {
                                                    "function": {
                                                      "application": {
                                                        "function": {
                                                          "typeApplication": {
                                                            "body": {
                                                              "typeApplication": {
                                                                "body": {
                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.eithers.map"}, "type": {"set": {"variable": "hydra.core.packaging.ModuleName"}}}},
                                                                "type": {"set": {"variable": "hydra.core.packaging.ModuleName"}}}},
                                                            "type": {"variable": "hydra.core.errors.Error"}}},
                                                        "argument": {
                                                          "lambda": {
                                                            "parameter": "deps",
                                                            "domain": {"set": {"variable": "hydra.core.packaging.ModuleName"}},
                                                            "body": {
                                                              "application": {
                                                                "function": {
                                                                  "application": {
                                                                    "function": {
                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.sets.delete"}, "type": {"variable": "hydra.core.packaging.ModuleName"}}},
                                                                    "argument": {
                                                                      "application": {
                                                                        "function": {"project": {"typeName": "hydra.core.packaging.Module", "fieldName": "name"}},
                                                                        "argument": {"variable": "mod"}}}}},
                                                                "argument": {"variable": "deps"}}}}}}},
                                                    "argument": {
                                                      "application": {
                                                        "function": {
                                                          "application": {
                                                            "function": {
                                                              "application": {
                                                                "function": {
                                                                  "application": {
                                                                    "function": {
                                                                      "application": {
                                                                        "function": {
                                                                          "application": {
                                                                            "function": {
                                                                              "application": {
                                                                                "function": {"typeApplication": {"body": {"variable": "hydra.core.analysis.dependencyModuleNames"}, "type": {"variable": "t0"}}},
                                                                                "argument": {"variable": "cx"}}},
                                                                            "argument": {"variable": "graph"}}},
                                                                        "argument": {"variable": "binds"}}},
                                                                    "argument": {"variable": "withPrims"}}},
                                                                "argument": {"variable": "withNoms"}}},
                                                            "argument": {"variable": "withSchema"}}},
                                                        "argument": {"variable": "allBindings"}}}}}}}}}}}}}}}}}}}}},
                "annotation": {
                  "map": [
                    {
                      "key": {"variable": "description"},
                      "value": {
                        "literal": {
                          "string": "Find dependency module names in all elements of a module, excluding the module's own module name (Either version)"}}}]}}}}}}},
    {
      "term": {
        "name": "hydra.core.analysis.moduleNamesForDefinitions",
        "signature": {
          "typeParameters": [{"name": "t0", "constraints": []}],
          "parameters": [
            {
              "name": "arg0",
              "type": {"function": {"domain": {"variable": "hydra.core.packaging.ModuleName"}, "codomain": {"variable": "t0"}}},
              "isLazy": false},
            {"name": "arg1", "type": {"variable": "hydra.core.packaging.ModuleName"}, "isLazy": false},
            {"name": "arg2", "type": {"list": {"variable": "hydra.core.packaging.Definition"}}, "isLazy": false}],
          "result": {"type": {"application": {"function": {"variable": "hydra.core.util.ModuleNames"}, "argument": {"variable": "t0"}}}}},
        "body": {
          "typeLambda": {
            "parameter": "t0",
            "body": {
              "annotated": {
                "body": {
                  "lambda": {
                    "parameter": "encodeModuleName",
                    "domain": {"function": {"domain": {"variable": "hydra.core.packaging.ModuleName"}, "codomain": {"variable": "t0"}}},
                    "body": {
                      "lambda": {
                        "parameter": "focusNs",
                        "domain": {"variable": "hydra.core.packaging.ModuleName"},
                        "body": {
                          "lambda": {
                            "parameter": "defs",
                            "domain": {"list": {"variable": "hydra.core.packaging.Definition"}},
                            "body": {
                              "let": {
                                "bindings": [
                                  {
                                    "name": "nss",
                                    "term": {
                                      "application": {
                                        "function": {
                                          "application": {
                                            "function": {
                                              "typeApplication": {"body": {"variable": "hydra.core.lib.sets.delete"}, "type": {"variable": "hydra.core.packaging.ModuleName"}}},
                                            "argument": {"variable": "focusNs"}}},
                                        "argument": {
                                          "application": {"function": {"variable": "hydra.core.analysis.definitionDependencyModuleNames"}, "argument": {"variable": "defs"}}}}},
                                    "typeScheme": {"variables": [], "body": {"set": {"variable": "hydra.core.packaging.ModuleName"}}, "constraints": []}}],
                                "body": {
                                  "let": {
                                    "bindings": [
                                      {
                                        "name": "toPair",
                                        "term": {
                                          "lambda": {
                                            "parameter": "ns",
                                            "domain": {"variable": "hydra.core.packaging.ModuleName"},
                                            "body": {
                                              "typeApplication": {
                                                "body": {
                                                  "typeApplication": {
                                                    "body": {
                                                      "pair": {
                                                        "first": {"variable": "ns"},
                                                        "second": {"application": {"function": {"variable": "encodeModuleName"}, "argument": {"variable": "ns"}}}}},
                                                    "type": {"variable": "hydra.core.packaging.ModuleName"}}},
                                                "type": {"variable": "t0"}}}}},
                                        "typeScheme": {
                                          "variables": [],
                                          "body": {
                                            "function": {
                                              "domain": {"variable": "hydra.core.packaging.ModuleName"},
                                              "codomain": {"pair": {"first": {"variable": "hydra.core.packaging.ModuleName"}, "second": {"variable": "t0"}}}}},
                                          "constraints": []}}],
                                    "body": {
                                      "typeApplication": {
                                        "body": {
                                          "record": {
                                            "typeName": "hydra.core.util.ModuleNames",
                                            "fields": [
                                              {"name": "focus", "term": {"application": {"function": {"variable": "toPair"}, "argument": {"variable": "focusNs"}}}},
                                              {
                                                "name": "mapping",
                                                "term": {
                                                  "application": {
                                                    "function": {
                                                      "typeApplication": {
                                                        "body": {
                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.maps.fromList"}, "type": {"variable": "hydra.core.packaging.ModuleName"}}},
                                                        "type": {"variable": "t0"}}},
                                                    "argument": {
                                                      "application": {
                                                        "function": {
                                                          "application": {
                                                            "function": {
                                                              "typeApplication": {
                                                                "body": {
                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.packaging.ModuleName"}}},
                                                                "type": {"pair": {"first": {"variable": "hydra.core.packaging.ModuleName"}, "second": {"variable": "t0"}}}}},
                                                            "argument": {"variable": "toPair"}}},
                                                        "argument": {
                                                          "application": {
                                                            "function": {
                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.sets.toList"}, "type": {"variable": "hydra.core.packaging.ModuleName"}}},
                                                            "argument": {"variable": "nss"}}}}}}}}]}},
                                        "type": {"variable": "t0"}}}}}}}}}}}}},
                "annotation": {
                  "map": [{"key": {"variable": "description"}, "value": {"literal": {"string": "Create module names mapping for definitions"}}}]}}}}}}}]}