hydra-kernel-0.18.1: hydra-kernel-json/hydra/core/subterms.json
{
"name": "hydra.core.subterms",
"metadata": {
"description": "The term-graph view of a typed graph: nodes are subterms, sharing is explicit, children are inline (a tree with symbolic cross-links). graphToTermGraph builds it; schemaToTypeGraph is the type-side twin. Term graphs are Ariola-Klop's nested systems of recursion equations.",
"comments": [],
"seeAlso": [],
"provisions": []},
"dependencies": [
{"module": "hydra.core.errors"},
{"module": "hydra.core.extract.model"},
{"module": "hydra.core.graph"},
{"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.optionals"},
{"module": "hydra.core.lib.pairs"},
{"module": "hydra.core.lib.sets"},
{"module": "hydra.core.lib.strings"},
{"module": "hydra.core.model"},
{"module": "hydra.core.paths"},
{"module": "hydra.core.reflect"},
{"module": "hydra.core.rewriting"},
{"module": "hydra.core.substitution"}],
"definitions": [
{
"term": {
"name": "hydra.core.subterms.expectedForStep",
"signature": {
"typeParameters": [],
"parameters": [
{
"name": "arg0",
"type": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.Type"}}},
"isLazy": false},
{"name": "arg1", "type": {"variable": "hydra.core.model.Type"}, "isLazy": false},
{"name": "arg2", "type": {"variable": "hydra.core.model.Term"}, "isLazy": false},
{"name": "arg3", "type": {"variable": "hydra.core.paths.SubtermStep"}, "isLazy": false}],
"result": {"type": {"optional": {"variable": "hydra.core.model.Type"}}}},
"body": {
"annotated": {
"body": {
"lambda": {
"parameter": "schema",
"domain": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.Type"}}},
"body": {
"lambda": {
"parameter": "typ",
"domain": {"variable": "hydra.core.model.Type"},
"body": {
"lambda": {
"parameter": "term",
"domain": {"variable": "hydra.core.model.Term"},
"body": {
"lambda": {
"parameter": "step",
"domain": {"variable": "hydra.core.paths.SubtermStep"},
"body": {
"let": {
"bindings": [
{
"name": "elementOfList",
"term": {
"lambda": {
"parameter": "t",
"domain": {"variable": "hydra.core.model.Type"},
"body": {
"application": {
"function": {
"cases": {
"typeName": "hydra.core.model.Type",
"default": {"typeApplication": {"body": {"optional": null}, "type": {"variable": "hydra.core.model.Type"}}},
"cases": [
{
"name": "list",
"handler": {"lambda": {"parameter": "e", "domain": {"variable": "hydra.core.model.Type"}, "body": {"optional": {"variable": "e"}}}}}]}},
"argument": {"variable": "t"}}}}},
"typeScheme": {
"variables": [],
"body": {
"function": {"domain": {"variable": "hydra.core.model.Type"}, "codomain": {"optional": {"variable": "hydra.core.model.Type"}}}},
"constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "elementOfSet",
"term": {
"lambda": {
"parameter": "t",
"domain": {"variable": "hydra.core.model.Type"},
"body": {
"application": {
"function": {
"cases": {
"typeName": "hydra.core.model.Type",
"default": {"typeApplication": {"body": {"optional": null}, "type": {"variable": "hydra.core.model.Type"}}},
"cases": [
{
"name": "set",
"handler": {"lambda": {"parameter": "e", "domain": {"variable": "hydra.core.model.Type"}, "body": {"optional": {"variable": "e"}}}}}]}},
"argument": {"variable": "t"}}}}},
"typeScheme": {
"variables": [],
"body": {
"function": {"domain": {"variable": "hydra.core.model.Type"}, "codomain": {"optional": {"variable": "hydra.core.model.Type"}}}},
"constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "elementOfOptional",
"term": {
"lambda": {
"parameter": "t",
"domain": {"variable": "hydra.core.model.Type"},
"body": {
"application": {
"function": {
"cases": {
"typeName": "hydra.core.model.Type",
"default": {"typeApplication": {"body": {"optional": null}, "type": {"variable": "hydra.core.model.Type"}}},
"cases": [
{
"name": "optional",
"handler": {"lambda": {"parameter": "e", "domain": {"variable": "hydra.core.model.Type"}, "body": {"optional": {"variable": "e"}}}}}]}},
"argument": {"variable": "t"}}}}},
"typeScheme": {
"variables": [],
"body": {
"function": {"domain": {"variable": "hydra.core.model.Type"}, "codomain": {"optional": {"variable": "hydra.core.model.Type"}}}},
"constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "codomainOf",
"term": {
"lambda": {
"parameter": "t",
"domain": {"variable": "hydra.core.model.Type"},
"body": {
"application": {
"function": {
"cases": {
"typeName": "hydra.core.model.Type",
"default": {"typeApplication": {"body": {"optional": null}, "type": {"variable": "hydra.core.model.Type"}}},
"cases": [
{
"name": "function",
"handler": {
"lambda": {
"parameter": "ft",
"domain": {"variable": "hydra.core.model.FunctionType"},
"body": {
"optional": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.FunctionType", "fieldName": "codomain"}},
"argument": {"variable": "ft"}}}}}}}]}},
"argument": {"variable": "t"}}}}},
"typeScheme": {
"variables": [],
"body": {
"function": {"domain": {"variable": "hydra.core.model.Type"}, "codomain": {"optional": {"variable": "hydra.core.model.Type"}}}},
"constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "mapPairType",
"term": {
"lambda": {
"parameter": "t",
"domain": {"variable": "hydra.core.model.Type"},
"body": {
"application": {
"function": {
"cases": {
"typeName": "hydra.core.model.Type",
"default": {"typeApplication": {"body": {"optional": null}, "type": {"variable": "hydra.core.model.Type"}}},
"cases": [
{
"name": "map",
"handler": {
"lambda": {
"parameter": "mt",
"domain": {"variable": "hydra.core.model.MapType"},
"body": {
"optional": {
"inject": {
"typeName": "hydra.core.model.Type",
"field": {
"name": "pair",
"term": {
"record": {
"typeName": "hydra.core.model.PairType",
"fields": [
{
"name": "first",
"term": {
"application": {"function": {"project": {"typeName": "hydra.core.model.MapType", "fieldName": "keys"}}, "argument": {"variable": "mt"}}}},
{
"name": "second",
"term": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.MapType", "fieldName": "values"}},
"argument": {"variable": "mt"}}}}]}}}}}}}}}]}},
"argument": {"variable": "t"}}}}},
"typeScheme": {
"variables": [],
"body": {
"function": {"domain": {"variable": "hydra.core.model.Type"}, "codomain": {"optional": {"variable": "hydra.core.model.Type"}}}},
"constraints": []}}],
"body": {
"application": {
"function": {
"cases": {
"typeName": "hydra.core.paths.SubtermStep",
"default": {"typeApplication": {"body": {"optional": null}, "type": {"variable": "hydra.core.model.Type"}}},
"cases": [
{
"name": "listElement",
"handler": {
"lambda": {
"parameter": "_",
"domain": {"literal": {"integer": "int32"}},
"body": {"application": {"function": {"variable": "elementOfList"}, "argument": {"variable": "typ"}}}}}},
{
"name": "setElement",
"handler": {
"lambda": {
"parameter": "_",
"domain": {"literal": {"integer": "int32"}},
"body": {"application": {"function": {"variable": "elementOfSet"}, "argument": {"variable": "typ"}}}}}},
{
"name": "optionalGiven",
"handler": {
"lambda": {
"parameter": "_",
"domain": "unit",
"body": {"application": {"function": {"variable": "elementOfOptional"}, "argument": {"variable": "typ"}}}}}},
{
"name": "lambdaBody",
"handler": {
"lambda": {
"parameter": "_",
"domain": "unit",
"body": {"application": {"function": {"variable": "codomainOf"}, "argument": {"variable": "typ"}}}}}},
{
"name": "mapEntry",
"handler": {
"lambda": {
"parameter": "_",
"domain": {"literal": {"integer": "int32"}},
"body": {"application": {"function": {"variable": "mapPairType"}, "argument": {"variable": "typ"}}}}}},
{
"name": "pairFirst",
"handler": {
"lambda": {
"parameter": "_",
"domain": "unit",
"body": {
"application": {
"function": {
"cases": {
"typeName": "hydra.core.model.Type",
"default": {"typeApplication": {"body": {"optional": null}, "type": {"variable": "hydra.core.model.Type"}}},
"cases": [
{
"name": "pair",
"handler": {
"lambda": {
"parameter": "pt",
"domain": {"variable": "hydra.core.model.PairType"},
"body": {
"optional": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.PairType", "fieldName": "first"}},
"argument": {"variable": "pt"}}}}}}}]}},
"argument": {"variable": "typ"}}}}}},
{
"name": "pairSecond",
"handler": {
"lambda": {
"parameter": "_",
"domain": "unit",
"body": {
"application": {
"function": {
"cases": {
"typeName": "hydra.core.model.Type",
"default": {"typeApplication": {"body": {"optional": null}, "type": {"variable": "hydra.core.model.Type"}}},
"cases": [
{
"name": "pair",
"handler": {
"lambda": {
"parameter": "pt",
"domain": {"variable": "hydra.core.model.PairType"},
"body": {
"optional": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.PairType", "fieldName": "second"}},
"argument": {"variable": "pt"}}}}}}}]}},
"argument": {"variable": "typ"}}}}}},
{
"name": "recordField",
"handler": {
"lambda": {
"parameter": "fname",
"domain": {"variable": "hydra.core.model.Name"},
"body": {
"application": {
"function": {
"application": {
"function": {
"application": {"function": {"variable": "hydra.core.subterms.fieldTypeFromSchema"}, "argument": {"variable": "schema"}}},
"argument": {"variable": "term"}}},
"argument": {"variable": "fname"}}}}}},
{
"name": "injectField",
"handler": {
"lambda": {
"parameter": "fname",
"domain": {"variable": "hydra.core.model.Name"},
"body": {
"application": {
"function": {
"application": {
"function": {
"application": {"function": {"variable": "hydra.core.subterms.fieldTypeFromSchema"}, "argument": {"variable": "schema"}}},
"argument": {"variable": "term"}}},
"argument": {"variable": "fname"}}}}}}]}},
"argument": {"variable": "step"}}}}}}}}}}}}}}}}}}}}},
"annotation": {
"map": [
{
"key": {"variable": "description"},
"value": {
"literal": {
"string": "The expected type to thread into an immediate child, given this node's (synthesized) type, its term, and the step reaching the child. This is the term->type position map underlying the TermGraph:TypeGraph erasure: element positions get the container element type, mapEntry gets pair<K,V>, lambdaBody the codomain, and so on. `none` where the child's type is not fixed top-down (e.g. a function-position subterm), which is fine for non-empty children."}}}]}}}}},
{
"term": {
"name": "hydra.core.subterms.fieldTypeFromSchema",
"signature": {
"typeParameters": [],
"parameters": [
{
"name": "arg0",
"type": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.Type"}}},
"isLazy": false},
{"name": "arg1", "type": {"variable": "hydra.core.model.Term"}, "isLazy": false},
{"name": "arg2", "type": {"variable": "hydra.core.model.Name"}, "isLazy": false}],
"result": {"type": {"optional": {"variable": "hydra.core.model.Type"}}}},
"body": {
"annotated": {
"body": {
"lambda": {
"parameter": "schema",
"domain": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.Type"}}},
"body": {
"lambda": {
"parameter": "term",
"domain": {"variable": "hydra.core.model.Term"},
"body": {
"lambda": {
"parameter": "fname",
"domain": {"variable": "hydra.core.model.Name"},
"body": {
"application": {
"function": {
"cases": {
"typeName": "hydra.core.model.Term",
"default": {"typeApplication": {"body": {"optional": null}, "type": {"variable": "hydra.core.model.Type"}}},
"cases": [
{
"name": "record",
"handler": {
"lambda": {
"parameter": "r",
"domain": {"variable": "hydra.core.model.Record"},
"body": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.optionals.bind"}, "type": {"variable": "hydra.core.model.Type"}}},
"type": {"variable": "hydra.core.model.Type"}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.lookup"}, "type": {"variable": "hydra.core.model.Name"}}},
"type": {"variable": "hydra.core.model.Type"}}},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.Record", "fieldName": "typeName"}},
"argument": {"variable": "r"}}}}},
"argument": {"variable": "schema"}}}}},
"argument": {
"lambda": {
"parameter": "sty",
"domain": {"variable": "hydra.core.model.Type"},
"body": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.eithers.either"}, "type": {"variable": "hydra.core.errors.Error"}}},
"type": {"list": {"variable": "hydra.core.model.FieldType"}}}},
"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": "fields",
"domain": {"list": {"variable": "hydra.core.model.FieldType"}},
"body": {
"application": {
"function": {"application": {"function": {"variable": "hydra.core.subterms.findFieldTypeIn"}, "argument": {"variable": "fname"}}},
"argument": {"variable": "fields"}}}}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {"body": {"variable": "hydra.core.extract.model.recordType"}, "type": {"variable": "hydra.core.model.Name"}}},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.Record", "fieldName": "typeName"}},
"argument": {"variable": "r"}}}}},
"argument": {"variable": "sty"}}}}}}}}}}}},
{
"name": "inject",
"handler": {
"lambda": {
"parameter": "inj",
"domain": {"variable": "hydra.core.model.Injection"},
"body": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.optionals.bind"}, "type": {"variable": "hydra.core.model.Type"}}},
"type": {"variable": "hydra.core.model.Type"}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.lookup"}, "type": {"variable": "hydra.core.model.Name"}}},
"type": {"variable": "hydra.core.model.Type"}}},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.Injection", "fieldName": "typeName"}},
"argument": {"variable": "inj"}}}}},
"argument": {"variable": "schema"}}}}},
"argument": {
"lambda": {
"parameter": "sty",
"domain": {"variable": "hydra.core.model.Type"},
"body": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.eithers.either"}, "type": {"variable": "hydra.core.errors.Error"}}},
"type": {"list": {"variable": "hydra.core.model.FieldType"}}}},
"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": "fields",
"domain": {"list": {"variable": "hydra.core.model.FieldType"}},
"body": {
"application": {
"function": {"application": {"function": {"variable": "hydra.core.subterms.findFieldTypeIn"}, "argument": {"variable": "fname"}}},
"argument": {"variable": "fields"}}}}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {"body": {"variable": "hydra.core.extract.model.unionType"}, "type": {"variable": "hydra.core.model.Name"}}},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.Injection", "fieldName": "typeName"}},
"argument": {"variable": "inj"}}}}},
"argument": {"variable": "sty"}}}}}}}}}}}}]}},
"argument": {"variable": "term"}}}}}}}}},
"annotation": {
"map": [
{
"key": {"variable": "description"},
"value": {"literal": {"string": "The expected type of a record field / injected union field, from the named type in the schema"}}}]}}}}},
{
"term": {
"name": "hydra.core.subterms.findFieldTypeIn",
"signature": {
"typeParameters": [],
"parameters": [
{"name": "arg0", "type": {"variable": "hydra.core.model.Name"}, "isLazy": false},
{"name": "arg1", "type": {"list": {"variable": "hydra.core.model.FieldType"}}, "isLazy": false}],
"result": {"type": {"optional": {"variable": "hydra.core.model.Type"}}}},
"body": {
"annotated": {
"body": {
"lambda": {
"parameter": "fname",
"domain": {"variable": "hydra.core.model.Name"},
"body": {
"lambda": {
"parameter": "fields",
"domain": {"list": {"variable": "hydra.core.model.FieldType"}},
"body": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.optionals.map"}, "type": {"variable": "hydra.core.model.FieldType"}}},
"type": {"variable": "hydra.core.model.Type"}}},
"argument": {"project": {"typeName": "hydra.core.model.FieldType", "fieldName": "type"}}}},
"argument": {
"application": {
"function": {
"typeApplication": {"body": {"variable": "hydra.core.lib.lists.head"}, "type": {"variable": "hydra.core.model.FieldType"}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {"body": {"variable": "hydra.core.lib.lists.filter"}, "type": {"variable": "hydra.core.model.FieldType"}}},
"argument": {
"lambda": {
"parameter": "f",
"domain": {"variable": "hydra.core.model.FieldType"},
"body": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {"body": {"variable": "hydra.core.lib.equality.equal"}, "type": {"variable": "hydra.core.model.Name"}}},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.FieldType", "fieldName": "name"}},
"argument": {"variable": "f"}}}}},
"argument": {"variable": "fname"}}}}}}},
"argument": {"variable": "fields"}}}}}}}}}}},
"annotation": {
"map": [
{
"key": {"variable": "description"},
"value": {"literal": {"string": "The type of the named field within a list of field types, if present"}}}]}}}}},
{
"term": {
"name": "hydra.core.subterms.graphToTermGraph",
"signature": {
"typeParameters": [],
"parameters": [{"name": "arg0", "type": {"variable": "hydra.core.graph.Graph"}, "isLazy": false}],
"result": {
"type": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.paths.TermGraph"}}}}},
"body": {
"annotated": {
"body": {
"lambda": {
"parameter": "graph",
"domain": {"variable": "hydra.core.graph.Graph"},
"body": {
"let": {
"bindings": [
{
"name": "boundTerms",
"term": {
"application": {
"function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "boundTerms"}},
"argument": {"variable": "graph"}}},
"typeScheme": {
"variables": [],
"body": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.Term"}}},
"constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "schema",
"term": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.maps.map"}, "type": {"variable": "hydra.core.model.TypeScheme"}}},
"type": {"variable": "hydra.core.model.Type"}}},
"type": {"variable": "hydra.core.model.Name"}}},
"argument": {
"lambda": {
"parameter": "ts",
"domain": {"variable": "hydra.core.model.TypeScheme"},
"body": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.TypeScheme", "fieldName": "body"}},
"argument": {"variable": "ts"}}}}}}},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "boundTypes"}},
"argument": {"variable": "graph"}}}}},
"typeScheme": {
"variables": [],
"body": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.Type"}}},
"constraints": []}}],
"body": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {"variable": "hydra.core.lib.eithers.map"},
"type": {
"list": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.paths.TermNode"}}}}}},
"type": {"variable": "hydra.core.paths.TermGraph"}}},
"type": {"variable": "hydra.core.errors.Error"}}},
"argument": {
"lambda": {
"parameter": "roots",
"domain": {
"list": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.paths.TermNode"}}}},
"body": {
"record": {
"typeName": "hydra.core.paths.TermGraph",
"fields": [
{
"name": "roots",
"term": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.maps.fromList"}, "type": {"variable": "hydra.core.model.Name"}}},
"type": {"variable": "hydra.core.paths.TermNode"}}},
"argument": {"variable": "roots"}}}}]}}}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {"variable": "hydra.core.lib.eithers.mapList"},
"type": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.model.Term"}}}}},
"type": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.paths.TermNode"}}}}},
"type": {"variable": "hydra.core.errors.Error"}}},
"argument": {
"lambda": {
"parameter": "nt",
"domain": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.model.Term"}}},
"body": {
"let": {
"bindings": [
{
"name": "name",
"term": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"variable": "hydra.core.model.Name"}}},
"type": {"variable": "hydra.core.model.Term"}}},
"argument": {"variable": "nt"}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Name"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "term",
"term": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"variable": "hydra.core.model.Name"}}},
"type": {"variable": "hydra.core.model.Term"}}},
"argument": {"variable": "nt"}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "expected",
"term": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.subterms.rootExpectedType"}, "type": {"variable": "hydra.core.model.Name"}}},
"type": {"variable": "hydra.core.model.Type"}}},
"argument": {"variable": "schema"}}},
"argument": {"variable": "name"}}},
"typeScheme": {"variables": [], "body": {"optional": {"variable": "hydra.core.model.Type"}}, "constraints": []}}],
"body": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.eithers.map"}, "type": {"variable": "hydra.core.paths.TermNode"}}},
"type": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.paths.TermNode"}}}}},
"type": {"variable": "hydra.core.errors.Error"}}},
"argument": {
"lambda": {
"parameter": "node",
"domain": {"variable": "hydra.core.paths.TermNode"},
"body": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {"pair": {"first": {"variable": "name"}, "second": {"variable": "node"}}},
"type": {"variable": "hydra.core.model.Name"}}},
"type": {"variable": "hydra.core.paths.TermNode"}}}}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {"application": {"function": {"variable": "hydra.core.subterms.termGraphNode"}, "argument": {"variable": "graph"}}},
"argument": {"variable": "schema"}}},
"argument": {"variable": "name"}}},
"argument": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.empty"}, "type": {"variable": "hydra.core.model.Name"}}},
"type": {"pair": {"first": {"variable": "hydra.core.paths.TermNodeId"}, "second": {"variable": "hydra.core.model.Type"}}}}}}},
"argument": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.empty"}, "type": {"variable": "hydra.core.model.Name"}}}}},
"argument": {"variable": "expected"}}},
"argument": {
"wrap": {
"typeName": "hydra.core.paths.SubtermPath",
"body": {"typeApplication": {"body": {"list": []}, "type": {"variable": "hydra.core.paths.SubtermStep"}}}}}}},
"argument": {"variable": "term"}}}}}}}}}}}}}}},
"argument": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.toList"}, "type": {"variable": "hydra.core.model.Name"}}},
"type": {"variable": "hydra.core.model.Term"}}},
"argument": {"variable": "boundTerms"}}}}}}}}}}}}},
"annotation": {
"map": [
{
"key": {"variable": "description"},
"value": {
"literal": {
"string": "The term-graph view of a typed graph: one root node per binding. Sharing is explicit; children are inline (a tree); variable occurrences become symbolic references carrying their binding node's id. Input must be a POST-INFERENCE (elaborated) graph: binding schemes present, lambda domains present, typeLambda/typeApplication explicit. Node types are synthesized in one O(n) bidirectional pass; a missing annotation (or an untyped empty leaf) is a precondition failure."}}}]}}}}},
{
"term": {
"name": "hydra.core.subterms.rootExpectedType",
"signature": {
"typeParameters": [{"name": "t0", "constraints": [{"simple": "ordering"}]}, {"name": "t1", "constraints": []}],
"parameters": [
{"name": "arg0", "type": {"map": {"keys": {"variable": "t0"}, "values": {"variable": "t1"}}}, "isLazy": false},
{"name": "arg1", "type": {"variable": "t0"}, "isLazy": false}],
"result": {"type": {"optional": {"variable": "t1"}}}},
"body": {
"typeLambda": {
"parameter": "t0",
"body": {
"typeLambda": {
"parameter": "t1",
"body": {
"annotated": {
"body": {
"lambda": {
"parameter": "schema",
"domain": {"map": {"keys": {"variable": "t0"}, "values": {"variable": "t1"}}},
"body": {
"lambda": {
"parameter": "name",
"domain": {"variable": "t0"},
"body": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.lookup"}, "type": {"variable": "t0"}}},
"type": {"variable": "t1"}}},
"argument": {"variable": "name"}}},
"argument": {"variable": "schema"}}}}}}},
"annotation": {
"map": [
{
"key": {"variable": "description"},
"value": {"literal": {"string": "The expected type for a root binding node: its declared type in the schema, if present"}}}]}}}}}}}}},
{
"term": {
"name": "hydra.core.subterms.schemaToTypeGraph",
"signature": {
"typeParameters": [],
"parameters": [
{
"name": "arg0",
"type": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.Type"}}},
"isLazy": false}],
"result": {
"type": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.paths.TypeGraph"}}}}},
"body": {
"annotated": {
"body": {
"lambda": {
"parameter": "schema",
"domain": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.Type"}}},
"body": {
"let": {
"bindings": [
{
"name": "schemaNames",
"term": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.keys"}, "type": {"variable": "hydra.core.model.Name"}}},
"type": {"variable": "hydra.core.model.Type"}}},
"argument": {"variable": "schema"}}},
"typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Name"}}, "constraints": []}}],
"body": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {"variable": "hydra.core.lib.eithers.map"},
"type": {
"list": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.paths.TypeNode"}}}}}},
"type": {"variable": "hydra.core.paths.TypeGraph"}}},
"type": {"variable": "hydra.core.errors.Error"}}},
"argument": {
"lambda": {
"parameter": "roots",
"domain": {
"list": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.paths.TypeNode"}}}},
"body": {
"record": {
"typeName": "hydra.core.paths.TypeGraph",
"fields": [
{
"name": "roots",
"term": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.maps.fromList"}, "type": {"variable": "hydra.core.model.Name"}}},
"type": {"variable": "hydra.core.paths.TypeNode"}}},
"argument": {"variable": "roots"}}}}]}}}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {"variable": "hydra.core.lib.eithers.mapList"},
"type": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.model.Type"}}}}},
"type": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.paths.TypeNode"}}}}},
"type": {"variable": "hydra.core.errors.Error"}}},
"argument": {
"lambda": {
"parameter": "nt",
"domain": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.model.Type"}}},
"body": {
"let": {
"bindings": [
{
"name": "name",
"term": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"variable": "hydra.core.model.Name"}}},
"type": {"variable": "hydra.core.model.Type"}}},
"argument": {"variable": "nt"}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Name"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "typ",
"term": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"variable": "hydra.core.model.Name"}}},
"type": {"variable": "hydra.core.model.Type"}}},
"argument": {"variable": "nt"}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
"body": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.eithers.map"}, "type": {"variable": "hydra.core.paths.TypeNode"}}},
"type": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.paths.TypeNode"}}}}},
"type": {"variable": "hydra.core.errors.Error"}}},
"argument": {
"lambda": {
"parameter": "node",
"domain": {"variable": "hydra.core.paths.TypeNode"},
"body": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {"pair": {"first": {"variable": "name"}, "second": {"variable": "node"}}},
"type": {"variable": "hydra.core.model.Name"}}},
"type": {"variable": "hydra.core.paths.TypeNode"}}}}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {"variable": "hydra.core.subterms.typeGraphNode"},
"argument": {
"application": {
"function": {
"typeApplication": {"body": {"variable": "hydra.core.lib.sets.fromList"}, "type": {"variable": "hydra.core.model.Name"}}},
"argument": {"variable": "schemaNames"}}}}},
"argument": {"variable": "name"}}},
"argument": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.empty"}, "type": {"variable": "hydra.core.model.Name"}}},
"type": {"variable": "hydra.core.paths.TypeNodeId"}}}}},
"argument": {
"wrap": {
"typeName": "hydra.core.paths.SubtypePath",
"body": {"typeApplication": {"body": {"list": []}, "type": {"variable": "hydra.core.paths.SubtypeStep"}}}}}}},
"argument": {"variable": "typ"}}}}}}}}}}}}},
"argument": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.toList"}, "type": {"variable": "hydra.core.model.Name"}}},
"type": {"variable": "hydra.core.model.Type"}}},
"argument": {"variable": "schema"}}}}}}}}}}},
"annotation": {
"map": [
{
"key": {"variable": "description"},
"value": {
"literal": {
"string": "The type-graph view of a schema: one root node per named type. A Type.variable referencing a schema-bound name is a nominal reference; a forall-bound variable in scope is a variable reference to its binding node; leaf types and non-type constituents are carried as links."}}}]}}}}},
{
"term": {
"name": "hydra.core.subterms.synthesizeType",
"signature": {
"typeParameters": [{"name": "t0", "constraints": []}, {"name": "t1", "constraints": []}],
"parameters": [
{"name": "arg0", "type": {"variable": "t0"}, "isLazy": false},
{
"name": "arg1",
"type": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.Type"}}},
"isLazy": false},
{
"name": "arg2",
"type": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.Type"}}},
"isLazy": false},
{"name": "arg3", "type": {"variable": "hydra.core.model.Name"}, "isLazy": false},
{"name": "arg4", "type": {"optional": {"variable": "hydra.core.model.Type"}}, "isLazy": false},
{"name": "arg5", "type": {"variable": "t1"}, "isLazy": false},
{"name": "arg6", "type": {"variable": "hydra.core.model.Term"}, "isLazy": false}],
"result": {"type": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.model.Type"}}}}},
"body": {
"typeLambda": {
"parameter": "t0",
"body": {
"typeLambda": {
"parameter": "t1",
"body": {
"annotated": {
"body": {
"lambda": {
"parameter": "graph",
"domain": {"variable": "t0"},
"body": {
"lambda": {
"parameter": "schema",
"domain": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.Type"}}},
"body": {
"lambda": {
"parameter": "env",
"domain": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.Type"}}},
"body": {
"lambda": {
"parameter": "root",
"domain": {"variable": "hydra.core.model.Name"},
"body": {
"lambda": {
"parameter": "expected",
"domain": {"optional": {"variable": "hydra.core.model.Type"}},
"body": {
"lambda": {
"parameter": "path",
"domain": {"variable": "t1"},
"body": {
"lambda": {
"parameter": "term",
"domain": {"variable": "hydra.core.model.Term"},
"body": {
"let": {
"bindings": [
{
"name": "recurseInto",
"term": {
"lambda": {
"parameter": "mexp",
"domain": {"optional": {"variable": "hydra.core.model.Type"}},
"body": {
"lambda": {
"parameter": "child",
"domain": {"variable": "hydra.core.model.Term"},
"body": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.subterms.synthesizeType"}, "type": {"variable": "t0"}}},
"type": {"variable": "t1"}}},
"argument": {"variable": "graph"}}},
"argument": {"variable": "schema"}}},
"argument": {"variable": "env"}}},
"argument": {"variable": "root"}}},
"argument": {"variable": "mexp"}}},
"argument": {"variable": "path"}}},
"argument": {"variable": "child"}}}}}}},
"typeScheme": {
"variables": [],
"body": {
"function": {
"domain": {"optional": {"variable": "hydra.core.model.Type"}},
"codomain": {
"function": {
"domain": {"variable": "hydra.core.model.Term"},
"codomain": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.model.Type"}}}}}}},
"constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "fail",
"term": {
"typeLambda": {
"parameter": "t2",
"body": {
"lambda": {
"parameter": "msg",
"domain": {"literal": "string"},
"body": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {
"either": {
"left": {
"inject": {
"typeName": "hydra.core.errors.Error",
"field": {
"name": "other",
"term": {
"wrap": {
"typeName": "hydra.core.errors.OtherError",
"body": {
"application": {
"function": {
"application": {
"function": {"variable": "hydra.core.lib.strings.concat2"},
"argument": {
"application": {
"function": {
"application": {
"function": {"variable": "hydra.core.lib.strings.concat2"},
"argument": {"literal": {"string": "synthesizeType precondition: "}}}},
"argument": {"variable": "msg"}}}}},
"argument": {
"application": {
"function": {
"application": {"function": {"variable": "hydra.core.lib.strings.concat2"}, "argument": {"literal": {"string": " at "}}}},
"argument": {"application": {"function": {"unwrap": "hydra.core.model.Name"}, "argument": {"variable": "root"}}}}}}}}}}}}}},
"type": {"variable": "hydra.core.errors.Error"}}},
"type": {"variable": "t2"}}}}}}},
"typeScheme": {
"variables": ["t2"],
"body": {
"function": {
"domain": {"literal": "string"},
"codomain": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "t2"}}}}},
"constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "consumeExpected",
"term": {
"lambda": {
"parameter": "what",
"domain": {"literal": "string"},
"body": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.optionals.match"}, "type": {"variable": "hydra.core.model.Type"}}},
"type": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.model.Type"}}}}},
"argument": {"variable": "expected"}}},
"argument": {
"application": {
"function": {"typeApplication": {"body": {"variable": "fail"}, "type": {"variable": "hydra.core.model.Type"}}},
"argument": {
"application": {
"function": {
"application": {"function": {"variable": "hydra.core.lib.strings.concat2"}, "argument": {"literal": {"string": "untyped "}}}},
"argument": {"variable": "what"}}}}}}},
"argument": {
"lambda": {
"parameter": "t",
"domain": {"variable": "hydra.core.model.Type"},
"body": {
"typeApplication": {
"body": {"typeApplication": {"body": {"either": {"right": {"variable": "t"}}}, "type": {"variable": "hydra.core.errors.Error"}}},
"type": {"variable": "hydra.core.model.Type"}}}}}}}}},
"typeScheme": {
"variables": [],
"body": {
"function": {
"domain": {"literal": "string"},
"codomain": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.model.Type"}}}}},
"constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "elementOfExpected",
"term": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.optionals.bind"}, "type": {"variable": "hydra.core.model.Type"}}},
"type": {"variable": "hydra.core.model.Type"}}},
"argument": {"variable": "expected"}}},
"argument": {
"lambda": {
"parameter": "t",
"domain": {"variable": "hydra.core.model.Type"},
"body": {
"application": {
"function": {
"cases": {
"typeName": "hydra.core.model.Type",
"default": {"typeApplication": {"body": {"optional": null}, "type": {"variable": "hydra.core.model.Type"}}},
"cases": [
{
"name": "list",
"handler": {"lambda": {"parameter": "e", "domain": {"variable": "hydra.core.model.Type"}, "body": {"optional": {"variable": "e"}}}}},
{
"name": "set",
"handler": {"lambda": {"parameter": "e", "domain": {"variable": "hydra.core.model.Type"}, "body": {"optional": {"variable": "e"}}}}},
{
"name": "optional",
"handler": {"lambda": {"parameter": "e", "domain": {"variable": "hydra.core.model.Type"}, "body": {"optional": {"variable": "e"}}}}}]}},
"argument": {"variable": "t"}}}}}}},
"typeScheme": {"variables": [], "body": {"optional": {"variable": "hydra.core.model.Type"}}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "codomainOfExpected",
"term": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.optionals.bind"}, "type": {"variable": "hydra.core.model.Type"}}},
"type": {"variable": "hydra.core.model.Type"}}},
"argument": {"variable": "expected"}}},
"argument": {
"lambda": {
"parameter": "t",
"domain": {"variable": "hydra.core.model.Type"},
"body": {
"application": {
"function": {
"cases": {
"typeName": "hydra.core.model.Type",
"default": {"typeApplication": {"body": {"optional": null}, "type": {"variable": "hydra.core.model.Type"}}},
"cases": [
{
"name": "function",
"handler": {
"lambda": {
"parameter": "ft",
"domain": {"variable": "hydra.core.model.FunctionType"},
"body": {
"optional": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.FunctionType", "fieldName": "codomain"}},
"argument": {"variable": "ft"}}}}}}}]}},
"argument": {"variable": "t"}}}}}}},
"typeScheme": {"variables": [], "body": {"optional": {"variable": "hydra.core.model.Type"}}, "constraints": []}}],
"body": {
"application": {
"function": {
"cases": {
"typeName": "hydra.core.model.Term",
"default": {
"application": {
"function": {"typeApplication": {"body": {"variable": "fail"}, "type": {"variable": "hydra.core.model.Type"}}},
"argument": {"literal": {"string": "unsupported term constructor"}}}},
"cases": [
{
"name": "application",
"handler": {
"lambda": {
"parameter": "app",
"domain": {"variable": "hydra.core.model.Application"},
"body": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.eithers.bind"}, "type": {"variable": "hydra.core.errors.Error"}}},
"type": {"variable": "hydra.core.model.Type"}}},
"type": {"variable": "hydra.core.model.Type"}}},
"argument": {
"application": {
"function": {
"application": {
"function": {"variable": "recurseInto"},
"argument": {"typeApplication": {"body": {"optional": null}, "type": {"variable": "hydra.core.model.Type"}}}}},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.Application", "fieldName": "function"}},
"argument": {"variable": "app"}}}}}}},
"argument": {
"lambda": {
"parameter": "ftype",
"domain": {"variable": "hydra.core.model.Type"},
"body": {
"application": {
"function": {
"cases": {
"typeName": "hydra.core.model.Type",
"default": {
"application": {
"function": {"typeApplication": {"body": {"variable": "fail"}, "type": {"variable": "hydra.core.model.Type"}}},
"argument": {"literal": {"string": "application of a non-function"}}}},
"cases": [
{
"name": "function",
"handler": {
"lambda": {
"parameter": "ft",
"domain": {"variable": "hydra.core.model.FunctionType"},
"body": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {
"either": {
"right": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.FunctionType", "fieldName": "codomain"}},
"argument": {"variable": "ft"}}}}},
"type": {"variable": "hydra.core.errors.Error"}}},
"type": {"variable": "hydra.core.model.Type"}}}}}}]}},
"argument": {"variable": "ftype"}}}}}}}}}},
{
"name": "lambda",
"handler": {
"lambda": {
"parameter": "l",
"domain": {"variable": "hydra.core.model.Lambda"},
"body": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.optionals.match"}, "type": {"variable": "hydra.core.model.Type"}}},
"type": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.model.Type"}}}}},
"argument": {
"application": {"function": {"project": {"typeName": "hydra.core.model.Lambda", "fieldName": "domain"}}, "argument": {"variable": "l"}}}}},
"argument": {
"application": {
"function": {"typeApplication": {"body": {"variable": "fail"}, "type": {"variable": "hydra.core.model.Type"}}},
"argument": {"literal": {"string": "lambda without a domain annotation"}}}}}},
"argument": {
"lambda": {
"parameter": "dom",
"domain": {"variable": "hydra.core.model.Type"},
"body": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.eithers.map"}, "type": {"variable": "hydra.core.model.Type"}}},
"type": {"variable": "hydra.core.model.Type"}}},
"type": {"variable": "hydra.core.errors.Error"}}},
"argument": {
"lambda": {
"parameter": "bt",
"domain": {"variable": "hydra.core.model.Type"},
"body": {
"inject": {
"typeName": "hydra.core.model.Type",
"field": {
"name": "function",
"term": {
"record": {
"typeName": "hydra.core.model.FunctionType",
"fields": [{"name": "domain", "term": {"variable": "dom"}}, {"name": "codomain", "term": {"variable": "bt"}}]}}}}}}}}},
"argument": {
"application": {
"function": {"application": {"function": {"variable": "recurseInto"}, "argument": {"variable": "codomainOfExpected"}}},
"argument": {
"application": {"function": {"project": {"typeName": "hydra.core.model.Lambda", "fieldName": "body"}}, "argument": {"variable": "l"}}}}}}}}}}}}}},
{
"name": "typeLambda",
"handler": {
"lambda": {
"parameter": "tl",
"domain": {"variable": "hydra.core.model.TypeLambda"},
"body": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.eithers.map"}, "type": {"variable": "hydra.core.model.Type"}}},
"type": {"variable": "hydra.core.model.Type"}}},
"type": {"variable": "hydra.core.errors.Error"}}},
"argument": {
"lambda": {
"parameter": "bt",
"domain": {"variable": "hydra.core.model.Type"},
"body": {
"inject": {
"typeName": "hydra.core.model.Type",
"field": {
"name": "forall",
"term": {
"record": {
"typeName": "hydra.core.model.ForallType",
"fields": [
{
"name": "parameter",
"term": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.TypeLambda", "fieldName": "parameter"}},
"argument": {"variable": "tl"}}}},
{"name": "body", "term": {"variable": "bt"}}]}}}}}}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {"variable": "recurseInto"},
"argument": {"typeApplication": {"body": {"optional": null}, "type": {"variable": "hydra.core.model.Type"}}}}},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.TypeLambda", "fieldName": "body"}},
"argument": {"variable": "tl"}}}}}}}}}},
{
"name": "typeApplication",
"handler": {
"lambda": {
"parameter": "ta",
"domain": {"variable": "hydra.core.model.TypeApplicationTerm"},
"body": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.eithers.bind"}, "type": {"variable": "hydra.core.errors.Error"}}},
"type": {"variable": "hydra.core.model.Type"}}},
"type": {"variable": "hydra.core.model.Type"}}},
"argument": {
"application": {
"function": {
"application": {
"function": {"variable": "recurseInto"},
"argument": {"typeApplication": {"body": {"optional": null}, "type": {"variable": "hydra.core.model.Type"}}}}},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.TypeApplicationTerm", "fieldName": "body"}},
"argument": {"variable": "ta"}}}}}}},
"argument": {
"lambda": {
"parameter": "bt",
"domain": {"variable": "hydra.core.model.Type"},
"body": {
"application": {
"function": {
"cases": {
"typeName": "hydra.core.model.Type",
"default": {
"application": {
"function": {"typeApplication": {"body": {"variable": "fail"}, "type": {"variable": "hydra.core.model.Type"}}},
"argument": {"literal": {"string": "type application of a non-forall"}}}},
"cases": [
{
"name": "forall",
"handler": {
"lambda": {
"parameter": "ft",
"domain": {"variable": "hydra.core.model.ForallType"},
"body": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {
"either": {
"right": {
"application": {
"function": {
"application": {
"function": {"variable": "hydra.core.substitution.substInType"},
"argument": {
"application": {
"function": {
"application": {
"function": {"variable": "hydra.core.substitution.singletonTypeSubst"},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.ForallType", "fieldName": "parameter"}},
"argument": {"variable": "ft"}}}}},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.TypeApplicationTerm", "fieldName": "type"}},
"argument": {"variable": "ta"}}}}}}},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.ForallType", "fieldName": "body"}},
"argument": {"variable": "ft"}}}}}}},
"type": {"variable": "hydra.core.errors.Error"}}},
"type": {"variable": "hydra.core.model.Type"}}}}}}]}},
"argument": {"variable": "bt"}}}}}}}}}},
{
"name": "variable",
"handler": {
"lambda": {
"parameter": "name",
"domain": {"variable": "hydra.core.model.Name"},
"body": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.optionals.match"}, "type": {"variable": "hydra.core.model.Type"}}},
"type": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.model.Type"}}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.lookup"}, "type": {"variable": "hydra.core.model.Name"}}},
"type": {"variable": "hydra.core.model.Type"}}},
"argument": {"variable": "name"}}},
"argument": {"variable": "env"}}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.optionals.match"}, "type": {"variable": "hydra.core.model.Type"}}},
"type": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.model.Type"}}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.lookup"}, "type": {"variable": "hydra.core.model.Name"}}},
"type": {"variable": "hydra.core.model.Type"}}},
"argument": {"variable": "name"}}},
"argument": {"variable": "schema"}}}}},
"argument": {
"application": {
"function": {"typeApplication": {"body": {"variable": "fail"}, "type": {"variable": "hydra.core.model.Type"}}},
"argument": {
"application": {
"function": {
"application": {"function": {"variable": "hydra.core.lib.strings.concat2"}, "argument": {"literal": {"string": "unbound variable "}}}},
"argument": {"application": {"function": {"unwrap": "hydra.core.model.Name"}, "argument": {"variable": "name"}}}}}}}}},
"argument": {
"lambda": {
"parameter": "t",
"domain": {"variable": "hydra.core.model.Type"},
"body": {
"typeApplication": {
"body": {"typeApplication": {"body": {"either": {"right": {"variable": "t"}}}, "type": {"variable": "hydra.core.errors.Error"}}},
"type": {"variable": "hydra.core.model.Type"}}}}}}}}},
"argument": {
"lambda": {
"parameter": "t",
"domain": {"variable": "hydra.core.model.Type"},
"body": {
"typeApplication": {
"body": {"typeApplication": {"body": {"either": {"right": {"variable": "t"}}}, "type": {"variable": "hydra.core.errors.Error"}}},
"type": {"variable": "hydra.core.model.Type"}}}}}}}}}},
{
"name": "unit",
"handler": {
"lambda": {
"parameter": "_",
"domain": "unit",
"body": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {"either": {"right": {"inject": {"typeName": "hydra.core.model.Type", "field": {"name": "unit", "term": "unit"}}}}},
"type": {"variable": "hydra.core.errors.Error"}}},
"type": {"variable": "hydra.core.model.Type"}}}}}},
{
"name": "literal",
"handler": {
"lambda": {
"parameter": "lit",
"domain": {"variable": "hydra.core.model.Literal"},
"body": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {
"either": {
"right": {
"inject": {
"typeName": "hydra.core.model.Type",
"field": {
"name": "literal",
"term": {"application": {"function": {"variable": "hydra.core.reflect.literalType"}, "argument": {"variable": "lit"}}}}}}}},
"type": {"variable": "hydra.core.errors.Error"}}},
"type": {"variable": "hydra.core.model.Type"}}}}}},
{
"name": "optional",
"handler": {
"lambda": {
"parameter": "mt",
"domain": {"optional": {"variable": "hydra.core.model.Term"}},
"body": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.optionals.match"}, "type": {"variable": "hydra.core.model.Term"}}},
"type": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.model.Type"}}}}},
"argument": {"variable": "mt"}}},
"argument": {"application": {"function": {"variable": "consumeExpected"}, "argument": {"literal": {"string": "optional none"}}}}}},
"argument": {
"lambda": {
"parameter": "t",
"domain": {"variable": "hydra.core.model.Term"},
"body": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.eithers.map"}, "type": {"variable": "hydra.core.model.Type"}}},
"type": {"variable": "hydra.core.model.Type"}}},
"type": {"variable": "hydra.core.errors.Error"}}},
"argument": {
"lambda": {
"parameter": "x",
"domain": {"variable": "hydra.core.model.Type"},
"body": {"inject": {"typeName": "hydra.core.model.Type", "field": {"name": "optional", "term": {"variable": "x"}}}}}}}},
"argument": {
"application": {
"function": {"application": {"function": {"variable": "recurseInto"}, "argument": {"variable": "elementOfExpected"}}},
"argument": {"variable": "t"}}}}}}}}}}}},
{
"name": "list",
"handler": {
"lambda": {
"parameter": "els",
"domain": {"list": {"variable": "hydra.core.model.Term"}},
"body": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.optionals.match"}, "type": {"variable": "hydra.core.model.Term"}}},
"type": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.model.Type"}}}}},
"argument": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.head"}, "type": {"variable": "hydra.core.model.Term"}}},
"argument": {"variable": "els"}}}}},
"argument": {"application": {"function": {"variable": "consumeExpected"}, "argument": {"literal": {"string": "empty list"}}}}}},
"argument": {
"lambda": {
"parameter": "t0",
"domain": {"variable": "hydra.core.model.Term"},
"body": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.eithers.map"}, "type": {"variable": "hydra.core.model.Type"}}},
"type": {"variable": "hydra.core.model.Type"}}},
"type": {"variable": "hydra.core.errors.Error"}}},
"argument": {
"lambda": {
"parameter": "x",
"domain": {"variable": "hydra.core.model.Type"},
"body": {"inject": {"typeName": "hydra.core.model.Type", "field": {"name": "list", "term": {"variable": "x"}}}}}}}},
"argument": {
"application": {
"function": {"application": {"function": {"variable": "recurseInto"}, "argument": {"variable": "elementOfExpected"}}},
"argument": {"variable": "t0"}}}}}}}}}}}},
{
"name": "set",
"handler": {
"lambda": {
"parameter": "s",
"domain": {"set": {"variable": "hydra.core.model.Term"}},
"body": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.optionals.match"}, "type": {"variable": "hydra.core.model.Term"}}},
"type": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.model.Type"}}}}},
"argument": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.head"}, "type": {"variable": "hydra.core.model.Term"}}},
"argument": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.toList"}, "type": {"variable": "hydra.core.model.Term"}}},
"argument": {"variable": "s"}}}}}}},
"argument": {"application": {"function": {"variable": "consumeExpected"}, "argument": {"literal": {"string": "empty set"}}}}}},
"argument": {
"lambda": {
"parameter": "t0",
"domain": {"variable": "hydra.core.model.Term"},
"body": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.eithers.map"}, "type": {"variable": "hydra.core.model.Type"}}},
"type": {"variable": "hydra.core.model.Type"}}},
"type": {"variable": "hydra.core.errors.Error"}}},
"argument": {
"lambda": {
"parameter": "x",
"domain": {"variable": "hydra.core.model.Type"},
"body": {"inject": {"typeName": "hydra.core.model.Type", "field": {"name": "set", "term": {"variable": "x"}}}}}}}},
"argument": {
"application": {
"function": {"application": {"function": {"variable": "recurseInto"}, "argument": {"variable": "elementOfExpected"}}},
"argument": {"variable": "t0"}}}}}}}}}}}},
{
"name": "map",
"handler": {
"lambda": {
"parameter": "m",
"domain": {"map": {"keys": {"variable": "hydra.core.model.Term"}, "values": {"variable": "hydra.core.model.Term"}}},
"body": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {"variable": "hydra.core.lib.optionals.match"},
"type": {"pair": {"first": {"variable": "hydra.core.model.Term"}, "second": {"variable": "hydra.core.model.Term"}}}}},
"type": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.model.Type"}}}}},
"argument": {
"application": {
"function": {
"typeApplication": {
"body": {"variable": "hydra.core.lib.lists.head"},
"type": {"pair": {"first": {"variable": "hydra.core.model.Term"}, "second": {"variable": "hydra.core.model.Term"}}}}},
"argument": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.toList"}, "type": {"variable": "hydra.core.model.Term"}}},
"type": {"variable": "hydra.core.model.Term"}}},
"argument": {"variable": "m"}}}}}}},
"argument": {"application": {"function": {"variable": "consumeExpected"}, "argument": {"literal": {"string": "empty map"}}}}}},
"argument": {
"lambda": {
"parameter": "kv",
"domain": {"pair": {"first": {"variable": "hydra.core.model.Term"}, "second": {"variable": "hydra.core.model.Term"}}},
"body": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.eithers.bind"}, "type": {"variable": "hydra.core.errors.Error"}}},
"type": {"variable": "hydra.core.model.Type"}}},
"type": {"variable": "hydra.core.model.Type"}}},
"argument": {
"application": {
"function": {
"application": {
"function": {"variable": "recurseInto"},
"argument": {"typeApplication": {"body": {"optional": null}, "type": {"variable": "hydra.core.model.Type"}}}}},
"argument": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"variable": "hydra.core.model.Term"}}},
"type": {"variable": "hydra.core.model.Term"}}},
"argument": {"variable": "kv"}}}}}}},
"argument": {
"lambda": {
"parameter": "kt",
"domain": {"variable": "hydra.core.model.Type"},
"body": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.eithers.map"}, "type": {"variable": "hydra.core.model.Type"}}},
"type": {"variable": "hydra.core.model.Type"}}},
"type": {"variable": "hydra.core.errors.Error"}}},
"argument": {
"lambda": {
"parameter": "vt",
"domain": {"variable": "hydra.core.model.Type"},
"body": {
"inject": {
"typeName": "hydra.core.model.Type",
"field": {
"name": "map",
"term": {
"record": {
"typeName": "hydra.core.model.MapType",
"fields": [{"name": "keys", "term": {"variable": "kt"}}, {"name": "values", "term": {"variable": "vt"}}]}}}}}}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {"variable": "recurseInto"},
"argument": {"typeApplication": {"body": {"optional": null}, "type": {"variable": "hydra.core.model.Type"}}}}},
"argument": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"variable": "hydra.core.model.Term"}}},
"type": {"variable": "hydra.core.model.Term"}}},
"argument": {"variable": "kv"}}}}}}}}}}}}}}}}}},
{
"name": "pair",
"handler": {
"lambda": {
"parameter": "p",
"domain": {"pair": {"first": {"variable": "hydra.core.model.Term"}, "second": {"variable": "hydra.core.model.Term"}}},
"body": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.eithers.bind"}, "type": {"variable": "hydra.core.errors.Error"}}},
"type": {"variable": "hydra.core.model.Type"}}},
"type": {"variable": "hydra.core.model.Type"}}},
"argument": {
"application": {
"function": {
"application": {
"function": {"variable": "recurseInto"},
"argument": {"typeApplication": {"body": {"optional": null}, "type": {"variable": "hydra.core.model.Type"}}}}},
"argument": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"variable": "hydra.core.model.Term"}}},
"type": {"variable": "hydra.core.model.Term"}}},
"argument": {"variable": "p"}}}}}}},
"argument": {
"lambda": {
"parameter": "ft",
"domain": {"variable": "hydra.core.model.Type"},
"body": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.eithers.map"}, "type": {"variable": "hydra.core.model.Type"}}},
"type": {"variable": "hydra.core.model.Type"}}},
"type": {"variable": "hydra.core.errors.Error"}}},
"argument": {
"lambda": {
"parameter": "st",
"domain": {"variable": "hydra.core.model.Type"},
"body": {
"inject": {
"typeName": "hydra.core.model.Type",
"field": {
"name": "pair",
"term": {
"record": {
"typeName": "hydra.core.model.PairType",
"fields": [{"name": "first", "term": {"variable": "ft"}}, {"name": "second", "term": {"variable": "st"}}]}}}}}}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {"variable": "recurseInto"},
"argument": {"typeApplication": {"body": {"optional": null}, "type": {"variable": "hydra.core.model.Type"}}}}},
"argument": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"variable": "hydra.core.model.Term"}}},
"type": {"variable": "hydra.core.model.Term"}}},
"argument": {"variable": "p"}}}}}}}}}}}}}},
{
"name": "either",
"handler": {
"lambda": {
"parameter": "e",
"domain": {"either": {"left": {"variable": "hydra.core.model.Term"}, "right": {"variable": "hydra.core.model.Term"}}},
"body": {"application": {"function": {"variable": "consumeExpected"}, "argument": {"literal": {"string": "either value"}}}}}}},
{
"name": "record",
"handler": {
"lambda": {
"parameter": "r",
"domain": {"variable": "hydra.core.model.Record"},
"body": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.optionals.match"}, "type": {"variable": "hydra.core.model.Type"}}},
"type": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.model.Type"}}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.lookup"}, "type": {"variable": "hydra.core.model.Name"}}},
"type": {"variable": "hydra.core.model.Type"}}},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.Record", "fieldName": "typeName"}},
"argument": {"variable": "r"}}}}},
"argument": {"variable": "schema"}}}}},
"argument": {
"application": {
"function": {"typeApplication": {"body": {"variable": "fail"}, "type": {"variable": "hydra.core.model.Type"}}},
"argument": {
"application": {
"function": {
"application": {
"function": {"variable": "hydra.core.lib.strings.concat2"},
"argument": {"literal": {"string": "record type not in schema: "}}}},
"argument": {
"application": {
"function": {"unwrap": "hydra.core.model.Name"},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.Record", "fieldName": "typeName"}},
"argument": {"variable": "r"}}}}}}}}}}},
"argument": {
"lambda": {
"parameter": "t",
"domain": {"variable": "hydra.core.model.Type"},
"body": {
"typeApplication": {
"body": {"typeApplication": {"body": {"either": {"right": {"variable": "t"}}}, "type": {"variable": "hydra.core.errors.Error"}}},
"type": {"variable": "hydra.core.model.Type"}}}}}}}}}},
{
"name": "inject",
"handler": {
"lambda": {
"parameter": "inj",
"domain": {"variable": "hydra.core.model.Injection"},
"body": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.optionals.match"}, "type": {"variable": "hydra.core.model.Type"}}},
"type": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.model.Type"}}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.lookup"}, "type": {"variable": "hydra.core.model.Name"}}},
"type": {"variable": "hydra.core.model.Type"}}},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.Injection", "fieldName": "typeName"}},
"argument": {"variable": "inj"}}}}},
"argument": {"variable": "schema"}}}}},
"argument": {
"application": {
"function": {"typeApplication": {"body": {"variable": "fail"}, "type": {"variable": "hydra.core.model.Type"}}},
"argument": {
"application": {
"function": {
"application": {
"function": {"variable": "hydra.core.lib.strings.concat2"},
"argument": {"literal": {"string": "union type not in schema: "}}}},
"argument": {
"application": {
"function": {"unwrap": "hydra.core.model.Name"},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.Injection", "fieldName": "typeName"}},
"argument": {"variable": "inj"}}}}}}}}}}},
"argument": {
"lambda": {
"parameter": "t",
"domain": {"variable": "hydra.core.model.Type"},
"body": {
"typeApplication": {
"body": {"typeApplication": {"body": {"either": {"right": {"variable": "t"}}}, "type": {"variable": "hydra.core.errors.Error"}}},
"type": {"variable": "hydra.core.model.Type"}}}}}}}}}},
{
"name": "wrap",
"handler": {
"lambda": {
"parameter": "w",
"domain": {"variable": "hydra.core.model.WrappedTerm"},
"body": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.optionals.match"}, "type": {"variable": "hydra.core.model.Type"}}},
"type": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.model.Type"}}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.lookup"}, "type": {"variable": "hydra.core.model.Name"}}},
"type": {"variable": "hydra.core.model.Type"}}},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.WrappedTerm", "fieldName": "typeName"}},
"argument": {"variable": "w"}}}}},
"argument": {"variable": "schema"}}}}},
"argument": {
"application": {
"function": {"typeApplication": {"body": {"variable": "fail"}, "type": {"variable": "hydra.core.model.Type"}}},
"argument": {
"application": {
"function": {
"application": {
"function": {"variable": "hydra.core.lib.strings.concat2"},
"argument": {"literal": {"string": "wrapper type not in schema: "}}}},
"argument": {
"application": {
"function": {"unwrap": "hydra.core.model.Name"},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.WrappedTerm", "fieldName": "typeName"}},
"argument": {"variable": "w"}}}}}}}}}}},
"argument": {
"lambda": {
"parameter": "t",
"domain": {"variable": "hydra.core.model.Type"},
"body": {
"typeApplication": {
"body": {"typeApplication": {"body": {"either": {"right": {"variable": "t"}}}, "type": {"variable": "hydra.core.errors.Error"}}},
"type": {"variable": "hydra.core.model.Type"}}}}}}}}}},
{
"name": "annotated",
"handler": {
"lambda": {
"parameter": "at",
"domain": {"variable": "hydra.core.model.AnnotatedTerm"},
"body": {
"application": {
"function": {"application": {"function": {"variable": "recurseInto"}, "argument": {"variable": "expected"}}},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.AnnotatedTerm", "fieldName": "body"}},
"argument": {"variable": "at"}}}}}}}},
{
"name": "let",
"handler": {
"lambda": {
"parameter": "lt",
"domain": {"variable": "hydra.core.model.Let"},
"body": {
"application": {
"function": {"application": {"function": {"variable": "recurseInto"}, "argument": {"variable": "expected"}}},
"argument": {
"application": {"function": {"project": {"typeName": "hydra.core.model.Let", "fieldName": "body"}}, "argument": {"variable": "lt"}}}}}}}},
{
"name": "project",
"handler": {
"lambda": {
"parameter": "p",
"domain": {"variable": "hydra.core.model.Projection"},
"body": {
"let": {
"bindings": [
{
"name": "tname",
"term": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.Projection", "fieldName": "typeName"}},
"argument": {"variable": "p"}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Name"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "fname",
"term": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.Projection", "fieldName": "fieldName"}},
"argument": {"variable": "p"}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Name"}, "constraints": []}}],
"body": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.optionals.match"}, "type": {"variable": "hydra.core.model.Type"}}},
"type": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.model.Type"}}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.lookup"}, "type": {"variable": "hydra.core.model.Name"}}},
"type": {"variable": "hydra.core.model.Type"}}},
"argument": {"variable": "tname"}}},
"argument": {"variable": "schema"}}}}},
"argument": {
"application": {
"function": {"typeApplication": {"body": {"variable": "fail"}, "type": {"variable": "hydra.core.model.Type"}}},
"argument": {
"application": {
"function": {
"application": {
"function": {"variable": "hydra.core.lib.strings.concat2"},
"argument": {"literal": {"string": "projection type not in schema: "}}}},
"argument": {"application": {"function": {"unwrap": "hydra.core.model.Name"}, "argument": {"variable": "tname"}}}}}}}}},
"argument": {
"lambda": {
"parameter": "sty",
"domain": {"variable": "hydra.core.model.Type"},
"body": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.eithers.bind"}, "type": {"variable": "hydra.core.errors.Error"}}},
"type": {"list": {"variable": "hydra.core.model.FieldType"}}}},
"type": {"variable": "hydra.core.model.Type"}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {"body": {"variable": "hydra.core.extract.model.recordType"}, "type": {"variable": "hydra.core.model.Name"}}},
"argument": {"variable": "tname"}}},
"argument": {"variable": "sty"}}}}},
"argument": {
"lambda": {
"parameter": "fields",
"domain": {"list": {"variable": "hydra.core.model.FieldType"}},
"body": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.optionals.match"}, "type": {"variable": "hydra.core.model.Type"}}},
"type": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.model.Type"}}}}},
"argument": {
"application": {
"function": {"application": {"function": {"variable": "hydra.core.subterms.findFieldTypeIn"}, "argument": {"variable": "fname"}}},
"argument": {"variable": "fields"}}}}},
"argument": {
"application": {
"function": {"typeApplication": {"body": {"variable": "fail"}, "type": {"variable": "hydra.core.model.Type"}}},
"argument": {
"application": {
"function": {
"application": {
"function": {"variable": "hydra.core.lib.strings.concat2"},
"argument": {"literal": {"string": "projected field not in record type: "}}}},
"argument": {"application": {"function": {"unwrap": "hydra.core.model.Name"}, "argument": {"variable": "fname"}}}}}}}}},
"argument": {
"lambda": {
"parameter": "ftyp",
"domain": {"variable": "hydra.core.model.Type"},
"body": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {
"either": {
"right": {
"inject": {
"typeName": "hydra.core.model.Type",
"field": {
"name": "function",
"term": {
"record": {
"typeName": "hydra.core.model.FunctionType",
"fields": [
{
"name": "domain",
"term": {"inject": {"typeName": "hydra.core.model.Type", "field": {"name": "variable", "term": {"variable": "tname"}}}}},
{"name": "codomain", "term": {"variable": "ftyp"}}]}}}}}}},
"type": {"variable": "hydra.core.errors.Error"}}},
"type": {"variable": "hydra.core.model.Type"}}}}}}}}}}}}}}}}}}}}}},
{
"name": "unwrap",
"handler": {
"lambda": {
"parameter": "tname",
"domain": {"variable": "hydra.core.model.Name"},
"body": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.optionals.match"}, "type": {"variable": "hydra.core.model.Type"}}},
"type": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.model.Type"}}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.lookup"}, "type": {"variable": "hydra.core.model.Name"}}},
"type": {"variable": "hydra.core.model.Type"}}},
"argument": {"variable": "tname"}}},
"argument": {"variable": "schema"}}}}},
"argument": {
"application": {
"function": {"typeApplication": {"body": {"variable": "fail"}, "type": {"variable": "hydra.core.model.Type"}}},
"argument": {
"application": {
"function": {
"application": {
"function": {"variable": "hydra.core.lib.strings.concat2"},
"argument": {"literal": {"string": "unwrap type not in schema: "}}}},
"argument": {"application": {"function": {"unwrap": "hydra.core.model.Name"}, "argument": {"variable": "tname"}}}}}}}}},
"argument": {
"lambda": {
"parameter": "sty",
"domain": {"variable": "hydra.core.model.Type"},
"body": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.eithers.map"}, "type": {"variable": "hydra.core.model.Type"}}},
"type": {"variable": "hydra.core.model.Type"}}},
"type": {"variable": "hydra.core.errors.Error"}}},
"argument": {
"lambda": {
"parameter": "inner",
"domain": {"variable": "hydra.core.model.Type"},
"body": {
"inject": {
"typeName": "hydra.core.model.Type",
"field": {
"name": "function",
"term": {
"record": {
"typeName": "hydra.core.model.FunctionType",
"fields": [
{
"name": "domain",
"term": {"inject": {"typeName": "hydra.core.model.Type", "field": {"name": "variable", "term": {"variable": "tname"}}}}},
{"name": "codomain", "term": {"variable": "inner"}}]}}}}}}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {"body": {"variable": "hydra.core.extract.model.wrappedType"}, "type": {"variable": "hydra.core.model.Name"}}},
"argument": {"variable": "tname"}}},
"argument": {"variable": "sty"}}}}}}}}}}}},
{
"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": "rep",
"term": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.optionals.match"}, "type": {"variable": "hydra.core.model.Term"}}},
"type": {"optional": {"variable": "hydra.core.model.Term"}}}},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.CaseStatement", "fieldName": "default"}},
"argument": {"variable": "cs"}}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.optionals.map"}, "type": {"variable": "hydra.core.model.CaseAlternative"}}},
"type": {"variable": "hydra.core.model.Term"}}},
"argument": {"project": {"typeName": "hydra.core.model.CaseAlternative", "fieldName": "handler"}}}},
"argument": {
"application": {
"function": {
"typeApplication": {"body": {"variable": "hydra.core.lib.lists.head"}, "type": {"variable": "hydra.core.model.CaseAlternative"}}},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.CaseStatement", "fieldName": "cases"}},
"argument": {"variable": "cs"}}}}}}}}},
"argument": {"lambda": {"parameter": "d", "domain": {"variable": "hydra.core.model.Term"}, "body": {"optional": {"variable": "d"}}}}}},
"typeScheme": {"variables": [], "body": {"optional": {"variable": "hydra.core.model.Term"}}, "constraints": []}}],
"body": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.optionals.match"}, "type": {"variable": "hydra.core.model.Term"}}},
"type": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.model.Type"}}}}},
"argument": {"variable": "rep"}}},
"argument": {
"application": {
"function": {"typeApplication": {"body": {"variable": "fail"}, "type": {"variable": "hydra.core.model.Type"}}},
"argument": {"literal": {"string": "case statement with no branches"}}}}}},
"argument": {
"lambda": {
"parameter": "handler",
"domain": {"variable": "hydra.core.model.Term"},
"body": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.eithers.bind"}, "type": {"variable": "hydra.core.errors.Error"}}},
"type": {"variable": "hydra.core.model.Type"}}},
"type": {"variable": "hydra.core.model.Type"}}},
"argument": {
"application": {
"function": {
"application": {
"function": {"variable": "recurseInto"},
"argument": {"typeApplication": {"body": {"optional": null}, "type": {"variable": "hydra.core.model.Type"}}}}},
"argument": {"variable": "handler"}}}}},
"argument": {
"lambda": {
"parameter": "htype",
"domain": {"variable": "hydra.core.model.Type"},
"body": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.eithers.map"}, "type": {"variable": "hydra.core.model.FunctionType"}}},
"type": {"variable": "hydra.core.model.Type"}}},
"type": {"variable": "hydra.core.errors.Error"}}},
"argument": {
"lambda": {
"parameter": "ft",
"domain": {"variable": "hydra.core.model.FunctionType"},
"body": {
"inject": {
"typeName": "hydra.core.model.Type",
"field": {
"name": "function",
"term": {
"record": {
"typeName": "hydra.core.model.FunctionType",
"fields": [
{
"name": "domain",
"term": {"inject": {"typeName": "hydra.core.model.Type", "field": {"name": "variable", "term": {"variable": "tname"}}}}},
{
"name": "codomain",
"term": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.FunctionType", "fieldName": "codomain"}},
"argument": {"variable": "ft"}}}}]}}}}}}}}},
"argument": {"application": {"function": {"variable": "hydra.core.extract.model.functionType"}, "argument": {"variable": "htype"}}}}}}}}}}}}}}}}}}}}]}},
"argument": {"variable": "term"}}}}}}}}}}}}}}}}}}}}}}}}}}},
"annotation": {
"map": [
{
"key": {"variable": "description"},
"value": {
"literal": {
"string": "Synthesize the type of an elaborated subterm, syntax-directed and without unification, threading `expected` top-down. Reads annotations (lambda domain, typeApplication type) and combines child types bottom-up; synthesis-incomplete leaves (empty list/set/map, optional none, either's absent branch) CONSUME `expected`. `expected = none` at such a leaf is a precondition failure with path."}}}]}}}}}}}}},
{
"term": {
"name": "hydra.core.subterms.termAttributesOf",
"signature": {
"typeParameters": [],
"parameters": [{"name": "arg0", "type": {"variable": "hydra.core.model.Term"}, "isLazy": false}],
"result": {"type": {"list": {"variable": "hydra.core.paths.TermAttributeLink"}}}},
"body": {
"annotated": {
"body": {
"lambda": {
"parameter": "term",
"domain": {"variable": "hydra.core.model.Term"},
"body": {
"application": {
"function": {
"cases": {
"typeName": "hydra.core.model.Term",
"default": {"typeApplication": {"body": {"list": []}, "type": {"variable": "hydra.core.paths.TermAttributeLink"}}},
"cases": [
{
"name": "cases",
"handler": {
"lambda": {
"parameter": "cs",
"domain": {"variable": "hydra.core.model.CaseStatement"},
"body": {
"list": [
{
"inject": {
"typeName": "hydra.core.paths.TermAttributeLink",
"field": {
"name": "casesTypeName",
"term": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.CaseStatement", "fieldName": "typeName"}},
"argument": {"variable": "cs"}}}}}}]}}}},
{
"name": "inject",
"handler": {
"lambda": {
"parameter": "inj",
"domain": {"variable": "hydra.core.model.Injection"},
"body": {
"list": [
{
"inject": {
"typeName": "hydra.core.paths.TermAttributeLink",
"field": {
"name": "injectTypeName",
"term": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.Injection", "fieldName": "typeName"}},
"argument": {"variable": "inj"}}}}}}]}}}},
{
"name": "lambda",
"handler": {
"lambda": {
"parameter": "l",
"domain": {"variable": "hydra.core.model.Lambda"},
"body": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {"body": {"variable": "hydra.core.lib.lists.concat2"}, "type": {"variable": "hydra.core.paths.TermAttributeLink"}}},
"argument": {
"list": [
{
"inject": {
"typeName": "hydra.core.paths.TermAttributeLink",
"field": {
"name": "lambdaParameter",
"term": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.Lambda", "fieldName": "parameter"}},
"argument": {"variable": "l"}}}}}}]}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.optionals.match"}, "type": {"variable": "hydra.core.model.Type"}}},
"type": {"list": {"variable": "hydra.core.paths.TermAttributeLink"}}}},
"argument": {
"application": {"function": {"project": {"typeName": "hydra.core.model.Lambda", "fieldName": "domain"}}, "argument": {"variable": "l"}}}}},
"argument": {"typeApplication": {"body": {"list": []}, "type": {"variable": "hydra.core.paths.TermAttributeLink"}}}}},
"argument": {
"lambda": {
"parameter": "d",
"domain": {"variable": "hydra.core.model.Type"},
"body": {
"list": [
{
"inject": {"typeName": "hydra.core.paths.TermAttributeLink", "field": {"name": "lambdaDomainGiven", "term": {"variable": "d"}}}}]}}}}}}}}}},
{
"name": "literal",
"handler": {
"lambda": {
"parameter": "lit",
"domain": {"variable": "hydra.core.model.Literal"},
"body": {
"list": [
{
"inject": {"typeName": "hydra.core.paths.TermAttributeLink", "field": {"name": "literal", "term": {"variable": "lit"}}}}]}}}},
{
"name": "project",
"handler": {
"lambda": {
"parameter": "p",
"domain": {"variable": "hydra.core.model.Projection"},
"body": {
"list": [
{
"inject": {
"typeName": "hydra.core.paths.TermAttributeLink",
"field": {
"name": "projectTypeName",
"term": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.Projection", "fieldName": "typeName"}},
"argument": {"variable": "p"}}}}}},
{
"inject": {
"typeName": "hydra.core.paths.TermAttributeLink",
"field": {
"name": "projectFieldName",
"term": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.Projection", "fieldName": "fieldName"}},
"argument": {"variable": "p"}}}}}}]}}}},
{
"name": "record",
"handler": {
"lambda": {
"parameter": "r",
"domain": {"variable": "hydra.core.model.Record"},
"body": {
"list": [
{
"inject": {
"typeName": "hydra.core.paths.TermAttributeLink",
"field": {
"name": "recordTypeName",
"term": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.Record", "fieldName": "typeName"}},
"argument": {"variable": "r"}}}}}}]}}}},
{
"name": "typeApplication",
"handler": {
"lambda": {
"parameter": "ta",
"domain": {"variable": "hydra.core.model.TypeApplicationTerm"},
"body": {
"list": [
{
"inject": {
"typeName": "hydra.core.paths.TermAttributeLink",
"field": {
"name": "typeApplicationType",
"term": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.TypeApplicationTerm", "fieldName": "type"}},
"argument": {"variable": "ta"}}}}}}]}}}},
{
"name": "typeLambda",
"handler": {
"lambda": {
"parameter": "tl",
"domain": {"variable": "hydra.core.model.TypeLambda"},
"body": {
"list": [
{
"inject": {
"typeName": "hydra.core.paths.TermAttributeLink",
"field": {
"name": "typeLambdaParameter",
"term": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.TypeLambda", "fieldName": "parameter"}},
"argument": {"variable": "tl"}}}}}}]}}}},
{
"name": "unwrap",
"handler": {
"lambda": {
"parameter": "u",
"domain": {"variable": "hydra.core.model.Name"},
"body": {
"list": [
{
"inject": {"typeName": "hydra.core.paths.TermAttributeLink", "field": {"name": "unwrapTypeName", "term": {"variable": "u"}}}}]}}}},
{
"name": "wrap",
"handler": {
"lambda": {
"parameter": "w",
"domain": {"variable": "hydra.core.model.WrappedTerm"},
"body": {
"list": [
{
"inject": {
"typeName": "hydra.core.paths.TermAttributeLink",
"field": {
"name": "wrapTypeName",
"term": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.WrappedTerm", "fieldName": "typeName"}},
"argument": {"variable": "w"}}}}}}]}}}}]}},
"argument": {"variable": "term"}}}}},
"annotation": {
"map": [
{
"key": {"variable": "description"},
"value": {
"literal": {"string": "The content attribute links contributed by a term constructor (a non-term constituent, with its value)"}}}]}}}}},
{
"term": {
"name": "hydra.core.subterms.termGraphNode",
"signature": {
"typeParameters": [],
"parameters": [
{"name": "arg0", "type": {"variable": "hydra.core.graph.Graph"}, "isLazy": false},
{
"name": "arg1",
"type": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.Type"}}},
"isLazy": false},
{"name": "arg2", "type": {"variable": "hydra.core.model.Name"}, "isLazy": false},
{
"name": "arg3",
"type": {
"map": {
"keys": {"variable": "hydra.core.model.Name"},
"values": {"pair": {"first": {"variable": "hydra.core.paths.TermNodeId"}, "second": {"variable": "hydra.core.model.Type"}}}}},
"isLazy": false},
{"name": "arg4", "type": {"set": {"variable": "hydra.core.model.Name"}}, "isLazy": false},
{"name": "arg5", "type": {"optional": {"variable": "hydra.core.model.Type"}}, "isLazy": false},
{"name": "arg6", "type": {"variable": "hydra.core.paths.SubtermPath"}, "isLazy": false},
{"name": "arg7", "type": {"variable": "hydra.core.model.Term"}, "isLazy": false}],
"result": {
"type": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.paths.TermNode"}}}}},
"body": {
"annotated": {
"body": {
"lambda": {
"parameter": "graph",
"domain": {"variable": "hydra.core.graph.Graph"},
"body": {
"lambda": {
"parameter": "schema",
"domain": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.Type"}}},
"body": {
"lambda": {
"parameter": "root",
"domain": {"variable": "hydra.core.model.Name"},
"body": {
"lambda": {
"parameter": "env",
"domain": {
"map": {
"keys": {"variable": "hydra.core.model.Name"},
"values": {"pair": {"first": {"variable": "hydra.core.paths.TermNodeId"}, "second": {"variable": "hydra.core.model.Type"}}}}},
"body": {
"lambda": {
"parameter": "lambdaScope",
"domain": {"set": {"variable": "hydra.core.model.Name"}},
"body": {
"lambda": {
"parameter": "expected",
"domain": {"optional": {"variable": "hydra.core.model.Type"}},
"body": {
"lambda": {
"parameter": "path",
"domain": {"variable": "hydra.core.paths.SubtermPath"},
"body": {
"lambda": {
"parameter": "term",
"domain": {"variable": "hydra.core.model.Term"},
"body": {
"let": {
"bindings": [
{
"name": "steps",
"term": {"application": {"function": {"unwrap": "hydra.core.paths.SubtermPath"}, "argument": {"variable": "path"}}},
"typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.paths.SubtermStep"}}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "thisId",
"term": {
"record": {
"typeName": "hydra.core.paths.TermNodeId",
"fields": [{"name": "root", "term": {"variable": "root"}}, {"name": "path", "term": {"variable": "path"}}]}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.paths.TermNodeId"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "envTypes",
"term": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {"variable": "hydra.core.lib.maps.map"},
"type": {"pair": {"first": {"variable": "hydra.core.paths.TermNodeId"}, "second": {"variable": "hydra.core.model.Type"}}}}},
"type": {"variable": "hydra.core.model.Type"}}},
"type": {"variable": "hydra.core.model.Name"}}},
"argument": {
"lambda": {
"parameter": "p",
"domain": {"pair": {"first": {"variable": "hydra.core.paths.TermNodeId"}, "second": {"variable": "hydra.core.model.Type"}}},
"body": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"variable": "hydra.core.paths.TermNodeId"}}},
"type": {"variable": "hydra.core.model.Type"}}},
"argument": {"variable": "p"}}}}}}},
"argument": {"variable": "env"}}},
"typeScheme": {
"variables": [],
"body": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.Type"}}},
"constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "childEnv",
"term": {
"application": {
"function": {
"cases": {
"typeName": "hydra.core.model.Term",
"default": {"variable": "env"},
"cases": [
{
"name": "lambda",
"handler": {
"lambda": {
"parameter": "l",
"domain": {"variable": "hydra.core.model.Lambda"},
"body": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.insert"}, "type": {"variable": "hydra.core.model.Name"}}},
"type": {"pair": {"first": {"variable": "hydra.core.paths.TermNodeId"}, "second": {"variable": "hydra.core.model.Type"}}}}},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.Lambda", "fieldName": "parameter"}},
"argument": {"variable": "l"}}}}},
"argument": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {
"pair": {
"first": {"variable": "thisId"},
"second": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {"body": {"variable": "hydra.core.lib.optionals.withDefault"}, "type": {"variable": "hydra.core.model.Type"}}},
"argument": {
"inject": {
"typeName": "hydra.core.model.Type",
"field": {"name": "variable", "term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "?"}}}}}}}}},
"argument": {
"application": {"function": {"project": {"typeName": "hydra.core.model.Lambda", "fieldName": "domain"}}, "argument": {"variable": "l"}}}}}}},
"type": {"variable": "hydra.core.paths.TermNodeId"}}},
"type": {"variable": "hydra.core.model.Type"}}}}},
"argument": {"variable": "env"}}}}}},
{
"name": "let",
"handler": {
"lambda": {
"parameter": "lt",
"domain": {"variable": "hydra.core.model.Let"},
"body": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {"variable": "hydra.core.lib.lists.foldl"},
"type": {
"map": {
"keys": {"variable": "hydra.core.model.Name"},
"values": {"pair": {"first": {"variable": "hydra.core.paths.TermNodeId"}, "second": {"variable": "hydra.core.model.Type"}}}}}}},
"type": {"variable": "hydra.core.model.Binding"}}},
"argument": {
"lambda": {
"parameter": "acc",
"domain": {
"map": {
"keys": {"variable": "hydra.core.model.Name"},
"values": {"pair": {"first": {"variable": "hydra.core.paths.TermNodeId"}, "second": {"variable": "hydra.core.model.Type"}}}}},
"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": "bid",
"term": {
"record": {
"typeName": "hydra.core.paths.TermNodeId",
"fields": [
{"name": "root", "term": {"variable": "root"}},
{
"name": "path",
"term": {
"wrap": {
"typeName": "hydra.core.paths.SubtermPath",
"body": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {"body": {"variable": "hydra.core.lib.lists.concat2"}, "type": {"variable": "hydra.core.paths.SubtermStep"}}},
"argument": {"variable": "steps"}}},
"argument": {
"list": [
{"inject": {"typeName": "hydra.core.paths.SubtermStep", "field": {"name": "letBinding", "term": {"variable": "bname"}}}}]}}}}}}]}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.paths.TermNodeId"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "btype",
"term": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {"body": {"variable": "hydra.core.lib.optionals.withDefault"}, "type": {"variable": "hydra.core.model.Type"}}},
"argument": {
"inject": {
"typeName": "hydra.core.model.Type",
"field": {"name": "variable", "term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "?"}}}}}}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.optionals.map"}, "type": {"variable": "hydra.core.model.TypeScheme"}}},
"type": {"variable": "hydra.core.model.Type"}}},
"argument": {"project": {"typeName": "hydra.core.model.TypeScheme", "fieldName": "body"}}}},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "typeScheme"}},
"argument": {"variable": "b"}}}}}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
"body": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.insert"}, "type": {"variable": "hydra.core.model.Name"}}},
"type": {"pair": {"first": {"variable": "hydra.core.paths.TermNodeId"}, "second": {"variable": "hydra.core.model.Type"}}}}},
"argument": {"variable": "bname"}}},
"argument": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {"pair": {"first": {"variable": "bid"}, "second": {"variable": "btype"}}},
"type": {"variable": "hydra.core.paths.TermNodeId"}}},
"type": {"variable": "hydra.core.model.Type"}}}}},
"argument": {"variable": "acc"}}}}}}}}}}}}}}},
"argument": {"variable": "env"}}},
"argument": {
"application": {"function": {"project": {"typeName": "hydra.core.model.Let", "fieldName": "bindings"}}, "argument": {"variable": "lt"}}}}}}}}]}},
"argument": {"variable": "term"}}},
"typeScheme": {
"variables": [],
"body": {
"map": {
"keys": {"variable": "hydra.core.model.Name"},
"values": {"pair": {"first": {"variable": "hydra.core.paths.TermNodeId"}, "second": {"variable": "hydra.core.model.Type"}}}}},
"constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "childLambdaScope",
"term": {
"application": {
"function": {
"cases": {
"typeName": "hydra.core.model.Term",
"default": {"variable": "lambdaScope"},
"cases": [
{
"name": "lambda",
"handler": {
"lambda": {
"parameter": "l",
"domain": {"variable": "hydra.core.model.Lambda"},
"body": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.insert"}, "type": {"variable": "hydra.core.model.Name"}}},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.Lambda", "fieldName": "parameter"}},
"argument": {"variable": "l"}}}}},
"argument": {"variable": "lambdaScope"}}}}}}]}},
"argument": {"variable": "term"}}},
"typeScheme": {"variables": [], "body": {"set": {"variable": "hydra.core.model.Name"}}, "constraints": []}}],
"body": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.eithers.bind"}, "type": {"variable": "hydra.core.errors.Error"}}},
"type": {"variable": "hydra.core.model.Type"}}},
"type": {"variable": "hydra.core.paths.TermNode"}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.subterms.synthesizeType"}, "type": {"variable": "hydra.core.graph.Graph"}}},
"type": {"variable": "hydra.core.paths.SubtermPath"}}},
"argument": {"variable": "graph"}}},
"argument": {"variable": "schema"}}},
"argument": {"variable": "envTypes"}}},
"argument": {"variable": "root"}}},
"argument": {"variable": "expected"}}},
"argument": {"variable": "path"}}},
"argument": {"variable": "term"}}}}},
"argument": {
"lambda": {
"parameter": "typ",
"domain": {"variable": "hydra.core.model.Type"},
"body": {
"let": {
"bindings": [
{
"name": "attrLinks",
"term": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.paths.TermAttributeLink"}}},
"type": {"variable": "hydra.core.paths.TermLink"}}},
"argument": {
"lambda": {
"parameter": "x",
"domain": {"variable": "hydra.core.paths.TermAttributeLink"},
"body": {"inject": {"typeName": "hydra.core.paths.TermLink", "field": {"name": "attribute", "term": {"variable": "x"}}}}}}}},
"argument": {"application": {"function": {"variable": "hydra.core.subterms.termAttributesOf"}, "argument": {"variable": "term"}}}}},
"typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.paths.TermLink"}}, "constraints": []}}],
"body": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.eithers.bind"}, "type": {"variable": "hydra.core.errors.Error"}}},
"type": {"list": {"variable": "hydra.core.paths.TermLink"}}}},
"type": {"variable": "hydra.core.paths.TermNode"}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {"variable": "hydra.core.lib.eithers.mapList"},
"type": {"pair": {"first": {"variable": "hydra.core.paths.SubtermStep"}, "second": {"variable": "hydra.core.model.Term"}}}}},
"type": {"variable": "hydra.core.paths.TermLink"}}},
"type": {"variable": "hydra.core.errors.Error"}}},
"argument": {
"lambda": {
"parameter": "st",
"domain": {"pair": {"first": {"variable": "hydra.core.paths.SubtermStep"}, "second": {"variable": "hydra.core.model.Term"}}},
"body": {
"let": {
"bindings": [
{
"name": "step",
"term": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"variable": "hydra.core.paths.SubtermStep"}}},
"type": {"variable": "hydra.core.model.Term"}}},
"argument": {"variable": "st"}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.paths.SubtermStep"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "child",
"term": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"variable": "hydra.core.paths.SubtermStep"}}},
"type": {"variable": "hydra.core.model.Term"}}},
"argument": {"variable": "st"}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "childPath",
"term": {
"wrap": {
"typeName": "hydra.core.paths.SubtermPath",
"body": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {"body": {"variable": "hydra.core.lib.lists.concat2"}, "type": {"variable": "hydra.core.paths.SubtermStep"}}},
"argument": {"variable": "steps"}}},
"argument": {"list": [{"variable": "step"}]}}}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.paths.SubtermPath"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "childExpected",
"term": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {"application": {"function": {"variable": "hydra.core.subterms.expectedForStep"}, "argument": {"variable": "schema"}}},
"argument": {"variable": "typ"}}},
"argument": {"variable": "term"}}},
"argument": {"variable": "step"}}},
"typeScheme": {"variables": [], "body": {"optional": {"variable": "hydra.core.model.Type"}}, "constraints": []}}],
"body": {
"application": {
"function": {
"cases": {
"typeName": "hydra.core.model.Term",
"default": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.eithers.map"}, "type": {"variable": "hydra.core.paths.TermNode"}}},
"type": {"variable": "hydra.core.paths.TermLink"}}},
"type": {"variable": "hydra.core.errors.Error"}}},
"argument": {
"lambda": {
"parameter": "cnode",
"domain": {"variable": "hydra.core.paths.TermNode"},
"body": {
"inject": {
"typeName": "hydra.core.paths.TermLink",
"field": {
"name": "subterm",
"term": {
"record": {
"typeName": "hydra.core.paths.SubtermLink",
"fields": [{"name": "step", "term": {"variable": "step"}}, {"name": "child", "term": {"variable": "cnode"}}]}}}}}}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {"application": {"function": {"variable": "hydra.core.subterms.termGraphNode"}, "argument": {"variable": "graph"}}},
"argument": {"variable": "schema"}}},
"argument": {"variable": "root"}}},
"argument": {"variable": "childEnv"}}},
"argument": {"variable": "childLambdaScope"}}},
"argument": {"variable": "childExpected"}}},
"argument": {"variable": "childPath"}}},
"argument": {"variable": "child"}}}}},
"cases": [
{
"name": "variable",
"handler": {
"lambda": {
"parameter": "name",
"domain": {"variable": "hydra.core.model.Name"},
"body": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.eithers.map"}, "type": {"variable": "hydra.core.paths.TermReference"}}},
"type": {"variable": "hydra.core.paths.TermLink"}}},
"type": {"variable": "hydra.core.errors.Error"}}},
"argument": {
"lambda": {
"parameter": "ref",
"domain": {"variable": "hydra.core.paths.TermReference"},
"body": {
"inject": {
"typeName": "hydra.core.paths.TermLink",
"field": {
"name": "reference",
"term": {
"record": {
"typeName": "hydra.core.paths.TermReferenceLink",
"fields": [{"name": "step", "term": {"variable": "step"}}, {"name": "target", "term": {"variable": "ref"}}]}}}}}}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {"application": {"function": {"variable": "hydra.core.subterms.termReferenceFor"}, "argument": {"variable": "graph"}}},
"argument": {"variable": "childEnv"}}},
"argument": {"variable": "childLambdaScope"}}},
"argument": {"variable": "name"}}}}}}}}]}},
"argument": {"variable": "child"}}}}}}}}}}}}}}},
"argument": {"application": {"function": {"variable": "hydra.core.rewriting.subtermsWithSteps"}, "argument": {"variable": "term"}}}}}}},
"argument": {
"lambda": {
"parameter": "childLinks",
"domain": {"list": {"variable": "hydra.core.paths.TermLink"}},
"body": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {
"either": {
"right": {
"record": {
"typeName": "hydra.core.paths.TermNode",
"fields": [
{"name": "term", "term": {"variable": "term"}},
{"name": "type", "term": {"variable": "typ"}},
{
"name": "links",
"term": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {"body": {"variable": "hydra.core.lib.lists.concat2"}, "type": {"variable": "hydra.core.paths.TermLink"}}},
"argument": {"variable": "attrLinks"}}},
"argument": {"variable": "childLinks"}}}}]}}}},
"type": {"variable": "hydra.core.errors.Error"}}},
"type": {"variable": "hydra.core.paths.TermNode"}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}},
"annotation": {
"map": [
{
"key": {"variable": "description"},
"value": {
"literal": {
"string": "Build a term-graph node (inline) for the subterm at the given path within a root binding. `env` maps each in-scope local variable to its (binder node id, type); `lambdaScope` marks the lambda-bound subset. `expected` is the type flowing top-down, consumed by synthesis-incomplete leaves. A variable child is not a node: the parent emits a reference link for it."}}}]}}}}},
{
"term": {
"name": "hydra.core.subterms.termReferenceFor",
"signature": {
"typeParameters": [],
"parameters": [
{"name": "arg0", "type": {"variable": "hydra.core.graph.Graph"}, "isLazy": false},
{
"name": "arg1",
"type": {
"map": {
"keys": {"variable": "hydra.core.model.Name"},
"values": {"pair": {"first": {"variable": "hydra.core.paths.TermNodeId"}, "second": {"variable": "hydra.core.model.Type"}}}}},
"isLazy": false},
{"name": "arg2", "type": {"set": {"variable": "hydra.core.model.Name"}}, "isLazy": false},
{"name": "arg3", "type": {"variable": "hydra.core.model.Name"}, "isLazy": false}],
"result": {
"type": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.paths.TermReference"}}}}},
"body": {
"annotated": {
"body": {
"lambda": {
"parameter": "graph",
"domain": {"variable": "hydra.core.graph.Graph"},
"body": {
"lambda": {
"parameter": "env",
"domain": {
"map": {
"keys": {"variable": "hydra.core.model.Name"},
"values": {"pair": {"first": {"variable": "hydra.core.paths.TermNodeId"}, "second": {"variable": "hydra.core.model.Type"}}}}},
"body": {
"lambda": {
"parameter": "lambdaScope",
"domain": {"set": {"variable": "hydra.core.model.Name"}},
"body": {
"lambda": {
"parameter": "name",
"domain": {"variable": "hydra.core.model.Name"},
"body": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {"variable": "hydra.core.lib.optionals.match"},
"type": {"pair": {"first": {"variable": "hydra.core.paths.TermNodeId"}, "second": {"variable": "hydra.core.model.Type"}}}}},
"type": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.paths.TermReference"}}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.lookup"}, "type": {"variable": "hydra.core.model.Name"}}},
"type": {"pair": {"first": {"variable": "hydra.core.paths.TermNodeId"}, "second": {"variable": "hydra.core.model.Type"}}}}},
"argument": {"variable": "name"}}},
"argument": {"variable": "env"}}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {"variable": "hydra.core.lib.logic.ifElse"},
"type": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.paths.TermReference"}}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.member"}, "type": {"variable": "hydra.core.model.Name"}}},
"type": {"variable": "hydra.core.model.Term"}}},
"argument": {"variable": "name"}}},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "boundTerms"}},
"argument": {"variable": "graph"}}}}}}},
"argument": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {
"either": {
"right": {
"inject": {
"typeName": "hydra.core.paths.TermReference",
"field": {
"name": "let",
"term": {
"record": {
"typeName": "hydra.core.paths.LetVariableReference",
"fields": [
{"name": "variable", "term": {"variable": "name"}},
{
"name": "bindingNode",
"term": {
"record": {
"typeName": "hydra.core.paths.TermNodeId",
"fields": [
{"name": "root", "term": {"variable": "name"}},
{
"name": "path",
"term": {
"wrap": {
"typeName": "hydra.core.paths.SubtermPath",
"body": {"typeApplication": {"body": {"list": []}, "type": {"variable": "hydra.core.paths.SubtermStep"}}}}}}]}}},
{
"name": "type",
"term": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {"body": {"variable": "hydra.core.lib.optionals.withDefault"}, "type": {"variable": "hydra.core.model.Type"}}},
"argument": {
"inject": {
"typeName": "hydra.core.model.Type",
"field": {"name": "variable", "term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "?"}}}}}}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.optionals.map"}, "type": {"variable": "hydra.core.model.TypeScheme"}}},
"type": {"variable": "hydra.core.model.Type"}}},
"argument": {"project": {"typeName": "hydra.core.model.TypeScheme", "fieldName": "body"}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.lookup"}, "type": {"variable": "hydra.core.model.Name"}}},
"type": {"variable": "hydra.core.model.TypeScheme"}}},
"argument": {"variable": "name"}}},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "boundTypes"}},
"argument": {"variable": "graph"}}}}}}}}}}]}}}}}}},
"type": {"variable": "hydra.core.errors.Error"}}},
"type": {"variable": "hydra.core.paths.TermReference"}}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {"variable": "hydra.core.lib.logic.ifElse"},
"type": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.paths.TermReference"}}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.member"}, "type": {"variable": "hydra.core.model.Name"}}},
"type": {"variable": "hydra.core.graph.Primitive"}}},
"argument": {"variable": "name"}}},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "primitives"}},
"argument": {"variable": "graph"}}}}}}},
"argument": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {
"either": {
"right": {
"inject": {
"typeName": "hydra.core.paths.TermReference",
"field": {
"name": "primitive",
"term": {
"record": {
"typeName": "hydra.core.paths.PrimitiveReference",
"fields": [
{"name": "name", "term": {"variable": "name"}},
{
"name": "type",
"term": {
"inject": {
"typeName": "hydra.core.model.Type",
"field": {"name": "variable", "term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "?"}}}}}}}}]}}}}}}},
"type": {"variable": "hydra.core.errors.Error"}}},
"type": {"variable": "hydra.core.paths.TermReference"}}}}},
"argument": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {
"either": {
"left": {
"inject": {
"typeName": "hydra.core.errors.Error",
"field": {
"name": "other",
"term": {
"wrap": {
"typeName": "hydra.core.errors.OtherError",
"body": {
"application": {
"function": {
"application": {
"function": {"variable": "hydra.core.lib.strings.concat2"},
"argument": {"literal": {"string": "free variable in term graph: "}}}},
"argument": {"application": {"function": {"unwrap": "hydra.core.model.Name"}, "argument": {"variable": "name"}}}}}}}}}}}},
"type": {"variable": "hydra.core.errors.Error"}}},
"type": {"variable": "hydra.core.paths.TermReference"}}}}}}}}},
"argument": {
"lambda": {
"parameter": "idType",
"domain": {"pair": {"first": {"variable": "hydra.core.paths.TermNodeId"}, "second": {"variable": "hydra.core.model.Type"}}},
"body": {
"let": {
"bindings": [
{
"name": "binderId",
"term": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"variable": "hydra.core.paths.TermNodeId"}}},
"type": {"variable": "hydra.core.model.Type"}}},
"argument": {"variable": "idType"}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.paths.TermNodeId"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "occType",
"term": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"variable": "hydra.core.paths.TermNodeId"}}},
"type": {"variable": "hydra.core.model.Type"}}},
"argument": {"variable": "idType"}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
"body": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {"variable": "hydra.core.lib.logic.ifElse"},
"type": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.paths.TermReference"}}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.member"}, "type": {"variable": "hydra.core.model.Name"}}},
"argument": {"variable": "name"}}},
"argument": {"variable": "lambdaScope"}}}}},
"argument": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {
"either": {
"right": {
"inject": {
"typeName": "hydra.core.paths.TermReference",
"field": {
"name": "lambda",
"term": {
"record": {
"typeName": "hydra.core.paths.LambdaVariableReference",
"fields": [
{"name": "variable", "term": {"variable": "name"}},
{"name": "boundByNode", "term": {"variable": "binderId"}},
{"name": "type", "term": {"variable": "occType"}}]}}}}}}},
"type": {"variable": "hydra.core.errors.Error"}}},
"type": {"variable": "hydra.core.paths.TermReference"}}}}},
"argument": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {
"either": {
"right": {
"inject": {
"typeName": "hydra.core.paths.TermReference",
"field": {
"name": "let",
"term": {
"record": {
"typeName": "hydra.core.paths.LetVariableReference",
"fields": [
{"name": "variable", "term": {"variable": "name"}},
{"name": "bindingNode", "term": {"variable": "binderId"}},
{"name": "type", "term": {"variable": "occType"}}]}}}}}}},
"type": {"variable": "hydra.core.errors.Error"}}},
"type": {"variable": "hydra.core.paths.TermReference"}}}}}}}}}}}}}}}}}}}}},
"annotation": {
"map": [
{
"key": {"variable": "description"},
"value": {
"literal": {
"string": "Classify a variable occurrence, carrying its binder's node id: lambda-bound (node = the binding lambda), let-bound — locally or as a graph binding — (node = the bound term), or a primitive; a free variable is a precondition failure. `lambdaScope` marks which local names are lambda-bound."}}}]}}}}},
{
"term": {
"name": "hydra.core.subterms.typeAttributesOf",
"signature": {
"typeParameters": [],
"parameters": [{"name": "arg0", "type": {"variable": "hydra.core.model.Type"}, "isLazy": false}],
"result": {"type": {"list": {"variable": "hydra.core.paths.TypeAttributeLink"}}}},
"body": {
"annotated": {
"body": {
"lambda": {
"parameter": "typ",
"domain": {"variable": "hydra.core.model.Type"},
"body": {
"application": {
"function": {
"cases": {
"typeName": "hydra.core.model.Type",
"default": {"typeApplication": {"body": {"list": []}, "type": {"variable": "hydra.core.paths.TypeAttributeLink"}}},
"cases": [
{
"name": "annotated",
"handler": {
"lambda": {
"parameter": "at",
"domain": {"variable": "hydra.core.model.AnnotatedType"},
"body": {
"list": [
{
"inject": {
"typeName": "hydra.core.paths.TypeAttributeLink",
"field": {
"name": "annotatedAnnotation",
"term": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.AnnotatedType", "fieldName": "annotation"}},
"argument": {"variable": "at"}}}}}}]}}}},
{
"name": "forall",
"handler": {
"lambda": {
"parameter": "ft",
"domain": {"variable": "hydra.core.model.ForallType"},
"body": {
"list": [
{
"inject": {
"typeName": "hydra.core.paths.TypeAttributeLink",
"field": {
"name": "forallParameter",
"term": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.ForallType", "fieldName": "parameter"}},
"argument": {"variable": "ft"}}}}}}]}}}},
{
"name": "literal",
"handler": {
"lambda": {
"parameter": "lt",
"domain": {"variable": "hydra.core.model.LiteralType"},
"body": {
"list": [
{"inject": {"typeName": "hydra.core.paths.TypeAttributeLink", "field": {"name": "literal", "term": {"variable": "lt"}}}}]}}}}]}},
"argument": {"variable": "typ"}}}}},
"annotation": {
"map": [
{
"key": {"variable": "description"},
"value": {
"literal": {
"string": "The content attribute links contributed by a type constructor: annotation, forall parameter, or literal type"}}}]}}}}},
{
"term": {
"name": "hydra.core.subterms.typeGraphNode",
"signature": {
"typeParameters": [],
"parameters": [
{"name": "arg0", "type": {"set": {"variable": "hydra.core.model.Name"}}, "isLazy": false},
{"name": "arg1", "type": {"variable": "hydra.core.model.Name"}, "isLazy": false},
{
"name": "arg2",
"type": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.paths.TypeNodeId"}}},
"isLazy": false},
{"name": "arg3", "type": {"variable": "hydra.core.paths.SubtypePath"}, "isLazy": false},
{"name": "arg4", "type": {"variable": "hydra.core.model.Type"}, "isLazy": false}],
"result": {
"type": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.paths.TypeNode"}}}}},
"body": {
"annotated": {
"body": {
"lambda": {
"parameter": "schemaNames",
"domain": {"set": {"variable": "hydra.core.model.Name"}},
"body": {
"lambda": {
"parameter": "root",
"domain": {"variable": "hydra.core.model.Name"},
"body": {
"lambda": {
"parameter": "forallScope",
"domain": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.paths.TypeNodeId"}}},
"body": {
"lambda": {
"parameter": "path",
"domain": {"variable": "hydra.core.paths.SubtypePath"},
"body": {
"lambda": {
"parameter": "typ",
"domain": {"variable": "hydra.core.model.Type"},
"body": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.eithers.map"}, "type": {"list": {"variable": "hydra.core.paths.TypeLink"}}}},
"type": {"variable": "hydra.core.paths.TypeNode"}}},
"type": {"variable": "hydra.core.errors.Error"}}},
"argument": {
"lambda": {
"parameter": "links",
"domain": {"list": {"variable": "hydra.core.paths.TypeLink"}},
"body": {
"record": {
"typeName": "hydra.core.paths.TypeNode",
"fields": [{"name": "type", "term": {"variable": "typ"}}, {"name": "links", "term": {"variable": "links"}}]}}}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {"application": {"function": {"variable": "hydra.core.subterms.typeLinks"}, "argument": {"variable": "schemaNames"}}},
"argument": {"variable": "root"}}},
"argument": {"variable": "forallScope"}}},
"argument": {"variable": "path"}}},
"argument": {"variable": "typ"}}}}}}}}}}}}}}},
"annotation": {
"map": [
{
"key": {"variable": "description"},
"value": {"literal": {"string": "Build a type-graph node (inline) for the subtype at the given path within a named root type"}}}]}}}}},
{
"term": {
"name": "hydra.core.subterms.typeLinks",
"signature": {
"typeParameters": [],
"parameters": [
{"name": "arg0", "type": {"set": {"variable": "hydra.core.model.Name"}}, "isLazy": false},
{"name": "arg1", "type": {"variable": "hydra.core.model.Name"}, "isLazy": false},
{
"name": "arg2",
"type": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.paths.TypeNodeId"}}},
"isLazy": false},
{"name": "arg3", "type": {"variable": "hydra.core.paths.SubtypePath"}, "isLazy": false},
{"name": "arg4", "type": {"variable": "hydra.core.model.Type"}, "isLazy": false}],
"result": {
"type": {
"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"list": {"variable": "hydra.core.paths.TypeLink"}}}}}},
"body": {
"annotated": {
"body": {
"lambda": {
"parameter": "schemaNames",
"domain": {"set": {"variable": "hydra.core.model.Name"}},
"body": {
"lambda": {
"parameter": "root",
"domain": {"variable": "hydra.core.model.Name"},
"body": {
"lambda": {
"parameter": "forallScope",
"domain": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.paths.TypeNodeId"}}},
"body": {
"lambda": {
"parameter": "path",
"domain": {"variable": "hydra.core.paths.SubtypePath"},
"body": {
"lambda": {
"parameter": "typ",
"domain": {"variable": "hydra.core.model.Type"},
"body": {
"let": {
"bindings": [
{
"name": "steps",
"term": {"application": {"function": {"unwrap": "hydra.core.paths.SubtypePath"}, "argument": {"variable": "path"}}},
"typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.paths.SubtypeStep"}}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "thisId",
"term": {
"record": {
"typeName": "hydra.core.paths.TypeNodeId",
"fields": [{"name": "root", "term": {"variable": "root"}}, {"name": "path", "term": {"variable": "path"}}]}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.paths.TypeNodeId"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "attrLinks",
"term": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.paths.TypeAttributeLink"}}},
"type": {"variable": "hydra.core.paths.TypeLink"}}},
"argument": {
"lambda": {
"parameter": "x",
"domain": {"variable": "hydra.core.paths.TypeAttributeLink"},
"body": {"inject": {"typeName": "hydra.core.paths.TypeLink", "field": {"name": "attribute", "term": {"variable": "x"}}}}}}}},
"argument": {"application": {"function": {"variable": "hydra.core.subterms.typeAttributesOf"}, "argument": {"variable": "typ"}}}}},
"typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.paths.TypeLink"}}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "childScope",
"term": {
"application": {
"function": {
"cases": {
"typeName": "hydra.core.model.Type",
"default": {"variable": "forallScope"},
"cases": [
{
"name": "forall",
"handler": {
"lambda": {
"parameter": "ft",
"domain": {"variable": "hydra.core.model.ForallType"},
"body": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.insert"}, "type": {"variable": "hydra.core.model.Name"}}},
"type": {"variable": "hydra.core.paths.TypeNodeId"}}},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.ForallType", "fieldName": "parameter"}},
"argument": {"variable": "ft"}}}}},
"argument": {"variable": "thisId"}}},
"argument": {"variable": "forallScope"}}}}}}]}},
"argument": {"variable": "typ"}}},
"typeScheme": {
"variables": [],
"body": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.paths.TypeNodeId"}}},
"constraints": []}}],
"body": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.eithers.bind"}, "type": {"variable": "hydra.core.errors.Error"}}},
"type": {"list": {"variable": "hydra.core.paths.TypeLink"}}}},
"type": {"list": {"variable": "hydra.core.paths.TypeLink"}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {"variable": "hydra.core.lib.eithers.mapList"},
"type": {"pair": {"first": {"variable": "hydra.core.paths.SubtypeStep"}, "second": {"variable": "hydra.core.model.Type"}}}}},
"type": {"variable": "hydra.core.paths.TypeLink"}}},
"type": {"variable": "hydra.core.errors.Error"}}},
"argument": {
"lambda": {
"parameter": "st",
"domain": {"pair": {"first": {"variable": "hydra.core.paths.SubtypeStep"}, "second": {"variable": "hydra.core.model.Type"}}},
"body": {
"let": {
"bindings": [
{
"name": "step",
"term": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"variable": "hydra.core.paths.SubtypeStep"}}},
"type": {"variable": "hydra.core.model.Type"}}},
"argument": {"variable": "st"}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.paths.SubtypeStep"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "child",
"term": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"variable": "hydra.core.paths.SubtypeStep"}}},
"type": {"variable": "hydra.core.model.Type"}}},
"argument": {"variable": "st"}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "childPath",
"term": {
"wrap": {
"typeName": "hydra.core.paths.SubtypePath",
"body": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {"body": {"variable": "hydra.core.lib.lists.concat2"}, "type": {"variable": "hydra.core.paths.SubtypeStep"}}},
"argument": {"variable": "steps"}}},
"argument": {"list": [{"variable": "step"}]}}}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.paths.SubtypePath"}, "constraints": []}}],
"body": {
"application": {
"function": {
"cases": {
"typeName": "hydra.core.model.Type",
"default": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.eithers.map"}, "type": {"variable": "hydra.core.paths.TypeNode"}}},
"type": {"variable": "hydra.core.paths.TypeLink"}}},
"type": {"variable": "hydra.core.errors.Error"}}},
"argument": {
"lambda": {
"parameter": "cnode",
"domain": {"variable": "hydra.core.paths.TypeNode"},
"body": {
"inject": {
"typeName": "hydra.core.paths.TypeLink",
"field": {
"name": "subtype",
"term": {
"record": {
"typeName": "hydra.core.paths.SubtypeLink",
"fields": [{"name": "step", "term": {"variable": "step"}}, {"name": "child", "term": {"variable": "cnode"}}]}}}}}}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"application": {"function": {"variable": "hydra.core.subterms.typeGraphNode"}, "argument": {"variable": "schemaNames"}}},
"argument": {"variable": "root"}}},
"argument": {"variable": "childScope"}}},
"argument": {"variable": "childPath"}}},
"argument": {"variable": "child"}}}}},
"cases": [
{
"name": "variable",
"handler": {
"lambda": {
"parameter": "name",
"domain": {"variable": "hydra.core.model.Name"},
"body": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.eithers.map"}, "type": {"variable": "hydra.core.paths.TypeReference"}}},
"type": {"variable": "hydra.core.paths.TypeLink"}}},
"type": {"variable": "hydra.core.errors.Error"}}},
"argument": {
"lambda": {
"parameter": "ref",
"domain": {"variable": "hydra.core.paths.TypeReference"},
"body": {
"inject": {
"typeName": "hydra.core.paths.TypeLink",
"field": {
"name": "reference",
"term": {
"record": {
"typeName": "hydra.core.paths.TypeReferenceLink",
"fields": [{"name": "step", "term": {"variable": "step"}}, {"name": "target", "term": {"variable": "ref"}}]}}}}}}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"application": {"function": {"variable": "hydra.core.subterms.typeReferenceFor"}, "argument": {"variable": "schemaNames"}}},
"argument": {"variable": "childScope"}}},
"argument": {"variable": "name"}}}}}}}}]}},
"argument": {"variable": "child"}}}}}}}}}}}}},
"argument": {"application": {"function": {"variable": "hydra.core.rewriting.subtypesWithSteps"}, "argument": {"variable": "typ"}}}}}}},
"argument": {
"lambda": {
"parameter": "childLinks",
"domain": {"list": {"variable": "hydra.core.paths.TypeLink"}},
"body": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {
"either": {
"right": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {"body": {"variable": "hydra.core.lib.lists.concat2"}, "type": {"variable": "hydra.core.paths.TypeLink"}}},
"argument": {"variable": "attrLinks"}}},
"argument": {"variable": "childLinks"}}}}},
"type": {"variable": "hydra.core.errors.Error"}}},
"type": {"list": {"variable": "hydra.core.paths.TypeLink"}}}}}}}}}}}}}}}}}}}}}}}}}},
"annotation": {
"map": [
{
"key": {"variable": "description"},
"value": {
"literal": {
"string": "The outgoing links of a type node: its content attributes, and one link per immediate subtype — a variable occurrence becomes a reference link on the parent (occurrences are not nodes), any other subtype an inline subtype link. `forallScope` maps each in-scope forall variable to its binding node id."}}}]}}}}},
{
"term": {
"name": "hydra.core.subterms.typeReferenceFor",
"signature": {
"typeParameters": [],
"parameters": [
{"name": "arg0", "type": {"set": {"variable": "hydra.core.model.Name"}}, "isLazy": false},
{
"name": "arg1",
"type": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.paths.TypeNodeId"}}},
"isLazy": false},
{"name": "arg2", "type": {"variable": "hydra.core.model.Name"}, "isLazy": false}],
"result": {
"type": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.paths.TypeReference"}}}}},
"body": {
"annotated": {
"body": {
"lambda": {
"parameter": "schemaNames",
"domain": {"set": {"variable": "hydra.core.model.Name"}},
"body": {
"lambda": {
"parameter": "forallScope",
"domain": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.paths.TypeNodeId"}}},
"body": {
"lambda": {
"parameter": "name",
"domain": {"variable": "hydra.core.model.Name"},
"body": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {"variable": "hydra.core.lib.logic.ifElse"},
"type": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.paths.TypeReference"}}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.member"}, "type": {"variable": "hydra.core.model.Name"}}},
"argument": {"variable": "name"}}},
"argument": {"variable": "schemaNames"}}}}},
"argument": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {
"either": {
"right": {
"inject": {
"typeName": "hydra.core.paths.TypeReference",
"field": {
"name": "nominal",
"term": {
"record": {"typeName": "hydra.core.paths.NominalTypeReference", "fields": [{"name": "name", "term": {"variable": "name"}}]}}}}}}},
"type": {"variable": "hydra.core.errors.Error"}}},
"type": {"variable": "hydra.core.paths.TypeReference"}}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.optionals.match"}, "type": {"variable": "hydra.core.paths.TypeNodeId"}}},
"type": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.paths.TypeReference"}}}}},
"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.paths.TypeNodeId"}}},
"argument": {"variable": "name"}}},
"argument": {"variable": "forallScope"}}}}},
"argument": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {
"either": {
"left": {
"inject": {
"typeName": "hydra.core.errors.Error",
"field": {
"name": "other",
"term": {
"wrap": {
"typeName": "hydra.core.errors.OtherError",
"body": {
"application": {
"function": {
"application": {
"function": {"variable": "hydra.core.lib.strings.concat2"},
"argument": {"literal": {"string": "free type variable in type graph: "}}}},
"argument": {"application": {"function": {"unwrap": "hydra.core.model.Name"}, "argument": {"variable": "name"}}}}}}}}}}}},
"type": {"variable": "hydra.core.errors.Error"}}},
"type": {"variable": "hydra.core.paths.TypeReference"}}}}},
"argument": {
"lambda": {
"parameter": "binderId",
"domain": {"variable": "hydra.core.paths.TypeNodeId"},
"body": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {
"either": {
"right": {
"inject": {
"typeName": "hydra.core.paths.TypeReference",
"field": {
"name": "variable",
"term": {
"record": {
"typeName": "hydra.core.paths.TypeVariableReference",
"fields": [{"name": "variable", "term": {"variable": "name"}}, {"name": "boundByNode", "term": {"variable": "binderId"}}]}}}}}}},
"type": {"variable": "hydra.core.errors.Error"}}},
"type": {"variable": "hydra.core.paths.TypeReference"}}}}}}}}}}}}}}},
"annotation": {
"map": [
{
"key": {"variable": "description"},
"value": {
"literal": {
"string": "Classify a type variable occurrence: a schema-bound name is a nominal reference; a forall-bound variable in scope is a variable reference carrying its binding forall's node id; anything else is a free-variable precondition failure."}}}]}}}}}]}