hydra-kernel-0.18.1: hydra-kernel-json/hydra/core/predicates.json
{
"name": "hydra.core.predicates",
"metadata": {"description": "Type and term classification predicates", "comments": [], "seeAlso": [], "provisions": []},
"dependencies": [
{"module": "hydra.core.arity"},
{"module": "hydra.core.coders"},
{"module": "hydra.core.decode.model"},
{"module": "hydra.core.dependencies"},
{"module": "hydra.core.errors"},
{"module": "hydra.core.graph"},
{"module": "hydra.core.lexical"},
{"module": "hydra.core.lib.eithers"},
{"module": "hydra.core.lib.equality"},
{"module": "hydra.core.lib.functions"},
{"module": "hydra.core.lib.lists"},
{"module": "hydra.core.lib.logic"},
{"module": "hydra.core.lib.maps"},
{"module": "hydra.core.lib.optionals"},
{"module": "hydra.core.lib.ordering"},
{"module": "hydra.core.lib.pairs"},
{"module": "hydra.core.lib.sets"},
{"module": "hydra.core.lib.strings"},
{"module": "hydra.core.model"},
{"module": "hydra.core.packaging"},
{"module": "hydra.core.reflect"},
{"module": "hydra.core.rewriting"},
{"module": "hydra.core.scoping"},
{"module": "hydra.core.strip"},
{"module": "hydra.core.variants"}],
"definitions": [
{
"term": {
"name": "hydra.core.predicates.isComplexBinding",
"signature": {
"typeParameters": [],
"parameters": [
{"name": "arg0", "type": {"variable": "hydra.core.graph.Graph"}, "isLazy": false},
{"name": "arg1", "type": {"variable": "hydra.core.model.Binding"}, "isLazy": false}],
"result": {"type": {"literal": "boolean"}}},
"body": {
"annotated": {
"body": {
"lambda": {
"parameter": "tc",
"domain": {"variable": "hydra.core.graph.Graph"},
"body": {
"lambda": {
"parameter": "b",
"domain": {"variable": "hydra.core.model.Binding"},
"body": {
"let": {
"bindings": [
{
"name": "term",
"term": {
"application": {"function": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "term"}}, "argument": {"variable": "b"}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "mts",
"term": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "typeScheme"}},
"argument": {"variable": "b"}}},
"typeScheme": {"variables": [], "body": {"optional": {"variable": "hydra.core.model.TypeScheme"}}, "constraints": []}}],
"body": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.optionals.match"}, "type": {"variable": "hydra.core.model.TypeScheme"}}},
"type": {"literal": "boolean"}}},
"argument": {"variable": "mts"}}},
"argument": {
"application": {
"function": {"application": {"function": {"variable": "hydra.core.predicates.isComplexTerm"}, "argument": {"variable": "tc"}}},
"argument": {"variable": "term"}}}}},
"argument": {
"lambda": {
"parameter": "ts",
"domain": {"variable": "hydra.core.model.TypeScheme"},
"body": {
"let": {
"bindings": [
{
"name": "isPolymorphic",
"term": {
"application": {
"function": {"variable": "hydra.core.lib.logic.not"},
"argument": {
"application": {
"function": {
"typeApplication": {"body": {"variable": "hydra.core.lib.lists.isEmpty"}, "type": {"variable": "hydra.core.model.Name"}}},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.TypeScheme", "fieldName": "variables"}},
"argument": {"variable": "ts"}}}}}}},
"typeScheme": {"variables": [], "body": {"literal": "boolean"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "isNonNullary",
"term": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.lib.ordering.gt"}, "type": {"literal": {"integer": "int32"}}}},
"argument": {
"application": {
"function": {"variable": "hydra.core.arity.typeArity"},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.TypeScheme", "fieldName": "body"}},
"argument": {"variable": "ts"}}}}}}},
"argument": {"literal": {"integer": {"int32": 0}}}}},
"typeScheme": {"variables": [], "body": {"literal": "boolean"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "isComplex",
"term": {
"application": {
"function": {"application": {"function": {"variable": "hydra.core.predicates.isComplexTerm"}, "argument": {"variable": "tc"}}},
"argument": {"variable": "term"}}},
"typeScheme": {"variables": [], "body": {"literal": "boolean"}, "constraints": []}}],
"body": {
"application": {
"function": {
"application": {
"function": {"variable": "hydra.core.lib.logic.or"},
"argument": {
"application": {
"function": {"application": {"function": {"variable": "hydra.core.lib.logic.or"}, "argument": {"variable": "isPolymorphic"}}},
"argument": {"variable": "isNonNullary"}}}}},
"argument": {"variable": "isComplex"}}}}}}}}}}}}}}}}}}}}},
"annotation": {
"map": [
{
"key": {"variable": "description"},
"value": {"literal": {"string": "Check if a binding needs to be treated as a function"}}}]}}}}},
{
"term": {
"name": "hydra.core.predicates.isComplexTerm",
"signature": {
"typeParameters": [],
"parameters": [
{"name": "arg0", "type": {"variable": "hydra.core.graph.Graph"}, "isLazy": false},
{"name": "arg1", "type": {"variable": "hydra.core.model.Term"}, "isLazy": false}],
"result": {"type": {"literal": "boolean"}}},
"body": {
"annotated": {
"body": {
"lambda": {
"parameter": "tc",
"domain": {"variable": "hydra.core.graph.Graph"},
"body": {
"lambda": {
"parameter": "t",
"domain": {"variable": "hydra.core.model.Term"},
"body": {
"application": {
"function": {
"cases": {
"typeName": "hydra.core.model.Term",
"default": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.foldl"}, "type": {"literal": "boolean"}}},
"type": {"variable": "hydra.core.model.Term"}}},
"argument": {
"lambda": {
"parameter": "b",
"domain": {"literal": "boolean"},
"body": {
"lambda": {
"parameter": "sub",
"domain": {"variable": "hydra.core.model.Term"},
"body": {
"application": {
"function": {"application": {"function": {"variable": "hydra.core.lib.logic.or"}, "argument": {"variable": "b"}}},
"argument": {
"application": {
"function": {"application": {"function": {"variable": "hydra.core.predicates.isComplexTerm"}, "argument": {"variable": "tc"}}},
"argument": {"variable": "sub"}}}}}}}}}}},
"argument": {"literal": {"boolean": false}}}},
"argument": {"application": {"function": {"variable": "hydra.core.rewriting.subterms"}, "argument": {"variable": "t"}}}}},
"cases": [
{
"name": "let",
"handler": {"lambda": {"parameter": "_", "domain": {"variable": "hydra.core.model.Let"}, "body": {"literal": {"boolean": true}}}}},
{
"name": "typeApplication",
"handler": {
"lambda": {
"parameter": "_",
"domain": {"variable": "hydra.core.model.TypeApplicationTerm"},
"body": {"literal": {"boolean": true}}}}},
{
"name": "typeLambda",
"handler": {
"lambda": {"parameter": "_", "domain": {"variable": "hydra.core.model.TypeLambda"}, "body": {"literal": {"boolean": true}}}}},
{
"name": "variable",
"handler": {
"lambda": {
"parameter": "name",
"domain": {"variable": "hydra.core.model.Name"},
"body": {
"application": {
"function": {"application": {"function": {"variable": "hydra.core.predicates.isComplexVariable"}, "argument": {"variable": "tc"}}},
"argument": {"variable": "name"}}}}}}]}},
"argument": {"variable": "t"}}}}}}},
"annotation": {
"map": [
{
"key": {"variable": "description"},
"value": {"literal": {"string": "Check if a term needs to be treated as a function rather than a simple value"}}}]}}}}},
{
"term": {
"name": "hydra.core.predicates.isComplexVariable",
"signature": {
"typeParameters": [],
"parameters": [
{"name": "arg0", "type": {"variable": "hydra.core.graph.Graph"}, "isLazy": false},
{"name": "arg1", "type": {"variable": "hydra.core.model.Name"}, "isLazy": false}],
"result": {"type": {"literal": "boolean"}}},
"body": {
"annotated": {
"body": {
"lambda": {
"parameter": "tc",
"domain": {"variable": "hydra.core.graph.Graph"},
"body": {
"lambda": {
"parameter": "name",
"domain": {"variable": "hydra.core.model.Name"},
"body": {
"let": {
"bindings": [
{
"name": "metaLookup",
"term": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.lookup"}, "type": {"variable": "hydra.core.model.Name"}}},
"type": {"variable": "hydra.core.model.Term"}}},
"argument": {"variable": "name"}}},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "metadata"}},
"argument": {"variable": "tc"}}}}},
"typeScheme": {"variables": [], "body": {"optional": {"variable": "hydra.core.model.Term"}}, "constraints": []}}],
"body": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.lib.logic.ifElse"}, "type": {"literal": "boolean"}}},
"argument": {
"application": {
"function": {
"typeApplication": {"body": {"variable": "hydra.core.lib.optionals.isGiven"}, "type": {"variable": "hydra.core.model.Term"}}},
"argument": {"variable": "metaLookup"}}}}},
"argument": {"literal": {"boolean": true}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.lib.logic.ifElse"}, "type": {"literal": "boolean"}}},
"argument": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.member"}, "type": {"variable": "hydra.core.model.Name"}}},
"argument": {"variable": "name"}}},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "lambdaVariables"}},
"argument": {"variable": "tc"}}}}}}},
"argument": {"literal": {"boolean": true}}}},
"argument": {
"let": {
"bindings": [
{
"name": "typeLookup",
"term": {
"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": "tc"}}}}},
"typeScheme": {"variables": [], "body": {"optional": {"variable": "hydra.core.model.TypeScheme"}}, "constraints": []}}],
"body": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.optionals.match"}, "type": {"variable": "hydra.core.model.TypeScheme"}}},
"type": {"literal": "boolean"}}},
"argument": {"variable": "typeLookup"}}},
"argument": {
"let": {
"bindings": [
{
"name": "primLookup",
"term": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.lookup"}, "type": {"variable": "hydra.core.model.Name"}}},
"type": {"variable": "hydra.core.graph.Primitive"}}},
"argument": {"variable": "name"}}},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.graph.Graph", "fieldName": "primitives"}},
"argument": {"variable": "tc"}}}}},
"typeScheme": {"variables": [], "body": {"optional": {"variable": "hydra.core.graph.Primitive"}}, "constraints": []}}],
"body": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.optionals.match"}, "type": {"variable": "hydra.core.graph.Primitive"}}},
"type": {"literal": "boolean"}}},
"argument": {"variable": "primLookup"}}},
"argument": {"literal": {"boolean": true}}}},
"argument": {
"lambda": {
"parameter": "prim",
"domain": {"variable": "hydra.core.graph.Primitive"},
"body": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.lib.ordering.gt"}, "type": {"literal": {"integer": "int32"}}}},
"argument": {
"application": {
"function": {"variable": "hydra.core.arity.typeSchemeArity"},
"argument": {
"application": {
"function": {"variable": "hydra.core.scoping.termSignatureToTypeScheme"},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.packaging.PrimitiveDefinition", "fieldName": "signature"}},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.graph.Primitive", "fieldName": "definition"}},
"argument": {"variable": "prim"}}}}}}}}}}},
"argument": {"literal": {"integer": {"int32": 0}}}}}}}}}}}}},
"argument": {
"lambda": {
"parameter": "ts",
"domain": {"variable": "hydra.core.model.TypeScheme"},
"body": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.lib.ordering.gt"}, "type": {"literal": {"integer": "int32"}}}},
"argument": {"application": {"function": {"variable": "hydra.core.arity.typeSchemeArity"}, "argument": {"variable": "ts"}}}}},
"argument": {"literal": {"integer": {"int32": 0}}}}}}}}}}}}}}}}}}}}},
"annotation": {
"map": [
{"key": {"variable": "description"}, "value": {"literal": {"string": "Check if a variable is bound to a complex term"}}}]}}}}},
{
"term": {
"name": "hydra.core.predicates.isEncodedTerm",
"signature": {
"typeParameters": [],
"parameters": [{"name": "arg0", "type": {"variable": "hydra.core.model.Term"}, "isLazy": false}],
"result": {"type": {"literal": "boolean"}}},
"body": {
"annotated": {
"body": {
"lambda": {
"parameter": "t",
"domain": {"variable": "hydra.core.model.Term"},
"body": {
"application": {
"function": {
"cases": {
"typeName": "hydra.core.model.Term",
"default": {"literal": {"boolean": false}},
"cases": [
{
"name": "application",
"handler": {
"lambda": {
"parameter": "a",
"domain": {"variable": "hydra.core.model.Application"},
"body": {
"application": {
"function": {"variable": "hydra.core.predicates.isEncodedTerm"},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.Application", "fieldName": "function"}},
"argument": {"variable": "a"}}}}}}}},
{
"name": "inject",
"handler": {
"lambda": {
"parameter": "i",
"domain": {"variable": "hydra.core.model.Injection"},
"body": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.lib.equality.equal"}, "type": {"literal": "string"}}},
"argument": {"literal": {"string": "hydra.core.model.Term"}}}},
"argument": {
"application": {
"function": {"unwrap": "hydra.core.model.Name"},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.Injection", "fieldName": "typeName"}},
"argument": {"variable": "i"}}}}}}}}}}]}},
"argument": {"application": {"function": {"variable": "hydra.core.strip.deannotateTerm"}, "argument": {"variable": "t"}}}}}}},
"annotation": {
"map": [
{
"key": {"variable": "description"},
"value": {"literal": {"string": "Determines whether a given term is an encoded term (meta-level term)"}}}]}}}}},
{
"term": {
"name": "hydra.core.predicates.isEncodedType",
"signature": {
"typeParameters": [],
"parameters": [{"name": "arg0", "type": {"variable": "hydra.core.model.Term"}, "isLazy": false}],
"result": {"type": {"literal": "boolean"}}},
"body": {
"annotated": {
"body": {
"lambda": {
"parameter": "t",
"domain": {"variable": "hydra.core.model.Term"},
"body": {
"application": {
"function": {
"cases": {
"typeName": "hydra.core.model.Term",
"default": {"literal": {"boolean": false}},
"cases": [
{
"name": "application",
"handler": {
"lambda": {
"parameter": "a",
"domain": {"variable": "hydra.core.model.Application"},
"body": {
"application": {
"function": {"variable": "hydra.core.predicates.isEncodedType"},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.Application", "fieldName": "function"}},
"argument": {"variable": "a"}}}}}}}},
{
"name": "inject",
"handler": {
"lambda": {
"parameter": "i",
"domain": {"variable": "hydra.core.model.Injection"},
"body": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.lib.equality.equal"}, "type": {"literal": "string"}}},
"argument": {"literal": {"string": "hydra.core.model.Type"}}}},
"argument": {
"application": {
"function": {"unwrap": "hydra.core.model.Name"},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.Injection", "fieldName": "typeName"}},
"argument": {"variable": "i"}}}}}}}}}}]}},
"argument": {"application": {"function": {"variable": "hydra.core.strip.deannotateTerm"}, "argument": {"variable": "t"}}}}}}},
"annotation": {
"map": [
{
"key": {"variable": "description"},
"value": {"literal": {"string": "Determines whether a given term is an encoded type"}}}]}}}}},
{
"term": {
"name": "hydra.core.predicates.isEnumRowType",
"signature": {
"typeParameters": [],
"parameters": [{"name": "arg0", "type": {"list": {"variable": "hydra.core.model.FieldType"}}, "isLazy": false}],
"result": {"type": {"literal": "boolean"}}},
"body": {
"annotated": {
"body": {
"lambda": {
"parameter": "rt",
"domain": {"list": {"variable": "hydra.core.model.FieldType"}},
"body": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.foldl"}, "type": {"literal": "boolean"}}},
"type": {"literal": "boolean"}}},
"argument": {"variable": "hydra.core.lib.logic.and"}}},
"argument": {"literal": {"boolean": true}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.model.FieldType"}}},
"type": {"literal": "boolean"}}},
"argument": {
"lambda": {
"parameter": "f",
"domain": {"variable": "hydra.core.model.FieldType"},
"body": {
"application": {
"function": {"variable": "hydra.core.predicates.isUnitType"},
"argument": {
"application": {
"function": {"variable": "hydra.core.strip.deannotateType"},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.FieldType", "fieldName": "type"}},
"argument": {"variable": "f"}}}}}}}}}}},
"argument": {"variable": "rt"}}}}}}},
"annotation": {
"map": [
{
"key": {"variable": "description"},
"value": {"literal": {"string": "Check if a row type represents an enum (all fields are unit-typed)"}}}]}}}}},
{
"term": {
"name": "hydra.core.predicates.isEnumType",
"signature": {
"typeParameters": [],
"parameters": [{"name": "arg0", "type": {"variable": "hydra.core.model.Type"}, "isLazy": false}],
"result": {"type": {"literal": "boolean"}}},
"body": {
"annotated": {
"body": {
"lambda": {
"parameter": "typ",
"domain": {"variable": "hydra.core.model.Type"},
"body": {
"application": {
"function": {
"cases": {
"typeName": "hydra.core.model.Type",
"default": {"literal": {"boolean": false}},
"cases": [
{
"name": "union",
"handler": {
"lambda": {
"parameter": "rt",
"domain": {"list": {"variable": "hydra.core.model.FieldType"}},
"body": {"application": {"function": {"variable": "hydra.core.predicates.isEnumRowType"}, "argument": {"variable": "rt"}}}}}}]}},
"argument": {"application": {"function": {"variable": "hydra.core.strip.deannotateType"}, "argument": {"variable": "typ"}}}}}}},
"annotation": {"map": [{"key": {"variable": "description"}, "value": {"literal": {"string": "Check if a type is an enum type"}}}]}}}}},
{
"term": {
"name": "hydra.core.predicates.isNominalType",
"signature": {
"typeParameters": [],
"parameters": [{"name": "arg0", "type": {"variable": "hydra.core.model.Type"}, "isLazy": false}],
"result": {"type": {"literal": "boolean"}}},
"body": {
"annotated": {
"body": {
"lambda": {
"parameter": "typ",
"domain": {"variable": "hydra.core.model.Type"},
"body": {
"application": {
"function": {
"cases": {
"typeName": "hydra.core.model.Type",
"default": {"literal": {"boolean": false}},
"cases": [
{
"name": "record",
"handler": {
"lambda": {
"parameter": "rt",
"domain": {"list": {"variable": "hydra.core.model.FieldType"}},
"body": {"literal": {"boolean": true}}}}},
{
"name": "union",
"handler": {
"lambda": {
"parameter": "rt",
"domain": {"list": {"variable": "hydra.core.model.FieldType"}},
"body": {"literal": {"boolean": true}}}}},
{
"name": "wrap",
"handler": {"lambda": {"parameter": "wt", "domain": {"variable": "hydra.core.model.Type"}, "body": {"literal": {"boolean": true}}}}},
{
"name": "forall",
"handler": {
"lambda": {
"parameter": "fa",
"domain": {"variable": "hydra.core.model.ForallType"},
"body": {
"application": {
"function": {"variable": "hydra.core.predicates.isNominalType"},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.ForallType", "fieldName": "body"}},
"argument": {"variable": "fa"}}}}}}}}]}},
"argument": {"application": {"function": {"variable": "hydra.core.strip.deannotateType"}, "argument": {"variable": "typ"}}}}}}},
"annotation": {
"map": [
{
"key": {"variable": "description"},
"value": {
"literal": {
"string": "Check whether a type is a nominal type definition (record, union, wrap, or forall wrapping one). Type aliases (applications, functions, literal types, etc.) return false."}}}]}}}}},
{
"term": {
"name": "hydra.core.predicates.isSerializable",
"signature": {
"typeParameters": [{"name": "t0", "constraints": []}],
"parameters": [
{"name": "arg0", "type": {"variable": "t0"}, "isLazy": false},
{"name": "arg1", "type": {"variable": "hydra.core.graph.Graph"}, "isLazy": false},
{"name": "arg2", "type": {"variable": "hydra.core.model.Binding"}, "isLazy": false}],
"result": {"type": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"literal": "boolean"}}}}},
"body": {
"typeLambda": {
"parameter": "t0",
"body": {
"annotated": {
"body": {
"lambda": {
"parameter": "cx",
"domain": {"variable": "t0"},
"body": {
"lambda": {
"parameter": "graph",
"domain": {"variable": "hydra.core.graph.Graph"},
"body": {
"lambda": {
"parameter": "el",
"domain": {"variable": "hydra.core.model.Binding"},
"body": {
"let": {
"bindings": [
{
"name": "variants",
"term": {
"lambda": {
"parameter": "typ",
"domain": {"variable": "hydra.core.model.Type"},
"body": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.model.Type"}}},
"type": {"variable": "hydra.core.variants.TypeVariant"}}},
"argument": {"variable": "hydra.core.reflect.typeVariant"}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {"body": {"variable": "hydra.core.rewriting.foldOverType"}, "type": {"list": {"variable": "hydra.core.model.Type"}}}},
"argument": {"inject": {"typeName": "hydra.core.coders.TraversalOrder", "field": {"name": "pre", "term": "unit"}}}}},
"argument": {
"lambda": {
"parameter": "m",
"domain": {"list": {"variable": "hydra.core.model.Type"}},
"body": {
"lambda": {
"parameter": "t",
"domain": {"variable": "hydra.core.model.Type"},
"body": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.cons"}, "type": {"variable": "hydra.core.model.Type"}}},
"argument": {"variable": "t"}}},
"argument": {"variable": "m"}}}}}}}}},
"argument": {"typeApplication": {"body": {"list": []}, "type": {"variable": "hydra.core.model.Type"}}}}},
"argument": {"variable": "typ"}}}}}}},
"typeScheme": {
"variables": [],
"body": {
"function": {"domain": {"variable": "hydra.core.model.Type"}, "codomain": {"list": {"variable": "hydra.core.variants.TypeVariant"}}}},
"constraints": []}}],
"body": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {"variable": "hydra.core.lib.eithers.map"},
"type": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.Type"}}}}},
"type": {"literal": "boolean"}}},
"type": {"variable": "hydra.core.errors.Error"}}},
"argument": {
"lambda": {
"parameter": "deps",
"domain": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.Type"}}},
"body": {
"let": {
"bindings": [
{
"name": "allVariants",
"term": {
"application": {
"function": {
"typeApplication": {"body": {"variable": "hydra.core.lib.sets.fromList"}, "type": {"variable": "hydra.core.variants.TypeVariant"}}},
"argument": {
"application": {
"function": {
"typeApplication": {"body": {"variable": "hydra.core.lib.lists.concat"}, "type": {"variable": "hydra.core.variants.TypeVariant"}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.model.Type"}}},
"type": {"list": {"variable": "hydra.core.variants.TypeVariant"}}}},
"argument": {"variable": "variants"}}},
"argument": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.elems"}, "type": {"variable": "hydra.core.model.Name"}}},
"type": {"variable": "hydra.core.model.Type"}}},
"argument": {"variable": "deps"}}}}}}}}},
"typeScheme": {"variables": [], "body": {"set": {"variable": "hydra.core.variants.TypeVariant"}}, "constraints": []}}],
"body": {
"application": {
"function": {"variable": "hydra.core.lib.logic.not"},
"argument": {
"application": {
"function": {
"application": {
"function": {"variable": "hydra.core.lib.logic.or"},
"argument": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {"body": {"variable": "hydra.core.lib.sets.member"}, "type": {"variable": "hydra.core.variants.TypeVariant"}}},
"argument": {"inject": {"typeName": "hydra.core.variants.TypeVariant", "field": {"name": "effect", "term": "unit"}}}}},
"argument": {"variable": "allVariants"}}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {"variable": "hydra.core.lib.logic.or"},
"argument": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {"body": {"variable": "hydra.core.lib.sets.member"}, "type": {"variable": "hydra.core.variants.TypeVariant"}}},
"argument": {"inject": {"typeName": "hydra.core.variants.TypeVariant", "field": {"name": "function", "term": "unit"}}}}},
"argument": {"variable": "allVariants"}}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {"body": {"variable": "hydra.core.lib.sets.member"}, "type": {"variable": "hydra.core.variants.TypeVariant"}}},
"argument": {"inject": {"typeName": "hydra.core.variants.TypeVariant", "field": {"name": "void", "term": "unit"}}}}},
"argument": {"variable": "allVariants"}}}}}}}}}}}}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.predicates.typeDependencies"}, "type": {"variable": "t0"}}},
"argument": {"variable": "cx"}}},
"argument": {"variable": "graph"}}},
"argument": {"literal": {"boolean": false}}}},
"argument": {
"typeApplication": {"body": {"variable": "hydra.core.lib.functions.identity"}, "type": {"variable": "hydra.core.model.Type"}}}}},
"argument": {
"application": {"function": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "name"}}, "argument": {"variable": "el"}}}}}}}}}}}}}}},
"annotation": {
"map": [
{
"key": {"variable": "description"},
"value": {
"literal": {"string": "Check if an element is serializable (no function, effect, or void types in dependencies) (Either version)"}}}]}}}}}}},
{
"term": {
"name": "hydra.core.predicates.isSerializableByName",
"signature": {
"typeParameters": [{"name": "t0", "constraints": []}],
"parameters": [
{"name": "arg0", "type": {"variable": "t0"}, "isLazy": false},
{"name": "arg1", "type": {"variable": "hydra.core.graph.Graph"}, "isLazy": false},
{"name": "arg2", "type": {"variable": "hydra.core.model.Name"}, "isLazy": false}],
"result": {"type": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"literal": "boolean"}}}}},
"body": {
"typeLambda": {
"parameter": "t0",
"body": {
"annotated": {
"body": {
"lambda": {
"parameter": "cx",
"domain": {"variable": "t0"},
"body": {
"lambda": {
"parameter": "graph",
"domain": {"variable": "hydra.core.graph.Graph"},
"body": {
"lambda": {
"parameter": "name",
"domain": {"variable": "hydra.core.model.Name"},
"body": {
"let": {
"bindings": [
{
"name": "variants",
"term": {
"lambda": {
"parameter": "typ",
"domain": {"variable": "hydra.core.model.Type"},
"body": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.model.Type"}}},
"type": {"variable": "hydra.core.variants.TypeVariant"}}},
"argument": {"variable": "hydra.core.reflect.typeVariant"}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {"body": {"variable": "hydra.core.rewriting.foldOverType"}, "type": {"list": {"variable": "hydra.core.model.Type"}}}},
"argument": {"inject": {"typeName": "hydra.core.coders.TraversalOrder", "field": {"name": "pre", "term": "unit"}}}}},
"argument": {
"lambda": {
"parameter": "m",
"domain": {"list": {"variable": "hydra.core.model.Type"}},
"body": {
"lambda": {
"parameter": "t",
"domain": {"variable": "hydra.core.model.Type"},
"body": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.cons"}, "type": {"variable": "hydra.core.model.Type"}}},
"argument": {"variable": "t"}}},
"argument": {"variable": "m"}}}}}}}}},
"argument": {"typeApplication": {"body": {"list": []}, "type": {"variable": "hydra.core.model.Type"}}}}},
"argument": {"variable": "typ"}}}}}}},
"typeScheme": {
"variables": [],
"body": {
"function": {"domain": {"variable": "hydra.core.model.Type"}, "codomain": {"list": {"variable": "hydra.core.variants.TypeVariant"}}}},
"constraints": []}}],
"body": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {"variable": "hydra.core.lib.eithers.map"},
"type": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.Type"}}}}},
"type": {"literal": "boolean"}}},
"type": {"variable": "hydra.core.errors.Error"}}},
"argument": {
"lambda": {
"parameter": "deps",
"domain": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.Type"}}},
"body": {
"let": {
"bindings": [
{
"name": "allVariants",
"term": {
"application": {
"function": {
"typeApplication": {"body": {"variable": "hydra.core.lib.sets.fromList"}, "type": {"variable": "hydra.core.variants.TypeVariant"}}},
"argument": {
"application": {
"function": {
"typeApplication": {"body": {"variable": "hydra.core.lib.lists.concat"}, "type": {"variable": "hydra.core.variants.TypeVariant"}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.model.Type"}}},
"type": {"list": {"variable": "hydra.core.variants.TypeVariant"}}}},
"argument": {"variable": "variants"}}},
"argument": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.elems"}, "type": {"variable": "hydra.core.model.Name"}}},
"type": {"variable": "hydra.core.model.Type"}}},
"argument": {"variable": "deps"}}}}}}}}},
"typeScheme": {"variables": [], "body": {"set": {"variable": "hydra.core.variants.TypeVariant"}}, "constraints": []}}],
"body": {
"application": {
"function": {"variable": "hydra.core.lib.logic.not"},
"argument": {
"application": {
"function": {
"application": {
"function": {"variable": "hydra.core.lib.logic.or"},
"argument": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {"body": {"variable": "hydra.core.lib.sets.member"}, "type": {"variable": "hydra.core.variants.TypeVariant"}}},
"argument": {"inject": {"typeName": "hydra.core.variants.TypeVariant", "field": {"name": "effect", "term": "unit"}}}}},
"argument": {"variable": "allVariants"}}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {"variable": "hydra.core.lib.logic.or"},
"argument": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {"body": {"variable": "hydra.core.lib.sets.member"}, "type": {"variable": "hydra.core.variants.TypeVariant"}}},
"argument": {"inject": {"typeName": "hydra.core.variants.TypeVariant", "field": {"name": "function", "term": "unit"}}}}},
"argument": {"variable": "allVariants"}}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {"body": {"variable": "hydra.core.lib.sets.member"}, "type": {"variable": "hydra.core.variants.TypeVariant"}}},
"argument": {"inject": {"typeName": "hydra.core.variants.TypeVariant", "field": {"name": "void", "term": "unit"}}}}},
"argument": {"variable": "allVariants"}}}}}}}}}}}}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.predicates.typeDependencies"}, "type": {"variable": "t0"}}},
"argument": {"variable": "cx"}}},
"argument": {"variable": "graph"}}},
"argument": {"literal": {"boolean": false}}}},
"argument": {
"typeApplication": {"body": {"variable": "hydra.core.lib.functions.identity"}, "type": {"variable": "hydra.core.model.Type"}}}}},
"argument": {"variable": "name"}}}}}}}}}}}}},
"annotation": {
"map": [
{
"key": {"variable": "description"},
"value": {
"literal": {
"string": "Check if a type (by name) is serializable, resolving all type dependencies (no function, effect, or void types) (Either version)"}}}]}}}}}}},
{
"term": {
"name": "hydra.core.predicates.isSerializableType",
"signature": {
"typeParameters": [],
"parameters": [{"name": "arg0", "type": {"variable": "hydra.core.model.Type"}, "isLazy": false}],
"result": {"type": {"literal": "boolean"}}},
"body": {
"annotated": {
"body": {
"lambda": {
"parameter": "typ",
"domain": {"variable": "hydra.core.model.Type"},
"body": {
"let": {
"bindings": [
{
"name": "allVariants",
"term": {
"application": {
"function": {
"typeApplication": {"body": {"variable": "hydra.core.lib.sets.fromList"}, "type": {"variable": "hydra.core.variants.TypeVariant"}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.model.Type"}}},
"type": {"variable": "hydra.core.variants.TypeVariant"}}},
"argument": {"variable": "hydra.core.reflect.typeVariant"}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {"body": {"variable": "hydra.core.rewriting.foldOverType"}, "type": {"list": {"variable": "hydra.core.model.Type"}}}},
"argument": {"inject": {"typeName": "hydra.core.coders.TraversalOrder", "field": {"name": "pre", "term": "unit"}}}}},
"argument": {
"lambda": {
"parameter": "m",
"domain": {"list": {"variable": "hydra.core.model.Type"}},
"body": {
"lambda": {
"parameter": "t",
"domain": {"variable": "hydra.core.model.Type"},
"body": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.cons"}, "type": {"variable": "hydra.core.model.Type"}}},
"argument": {"variable": "t"}}},
"argument": {"variable": "m"}}}}}}}}},
"argument": {"typeApplication": {"body": {"list": []}, "type": {"variable": "hydra.core.model.Type"}}}}},
"argument": {"variable": "typ"}}}}}}},
"typeScheme": {"variables": [], "body": {"set": {"variable": "hydra.core.variants.TypeVariant"}}, "constraints": []}}],
"body": {
"application": {
"function": {"variable": "hydra.core.lib.logic.not"},
"argument": {
"application": {
"function": {
"application": {
"function": {"variable": "hydra.core.lib.logic.or"},
"argument": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {"body": {"variable": "hydra.core.lib.sets.member"}, "type": {"variable": "hydra.core.variants.TypeVariant"}}},
"argument": {"inject": {"typeName": "hydra.core.variants.TypeVariant", "field": {"name": "effect", "term": "unit"}}}}},
"argument": {"variable": "allVariants"}}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {"variable": "hydra.core.lib.logic.or"},
"argument": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {"body": {"variable": "hydra.core.lib.sets.member"}, "type": {"variable": "hydra.core.variants.TypeVariant"}}},
"argument": {"inject": {"typeName": "hydra.core.variants.TypeVariant", "field": {"name": "function", "term": "unit"}}}}},
"argument": {"variable": "allVariants"}}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {"body": {"variable": "hydra.core.lib.sets.member"}, "type": {"variable": "hydra.core.variants.TypeVariant"}}},
"argument": {"inject": {"typeName": "hydra.core.variants.TypeVariant", "field": {"name": "void", "term": "unit"}}}}},
"argument": {"variable": "allVariants"}}}}}}}}}}}}},
"annotation": {
"map": [
{
"key": {"variable": "description"},
"value": {"literal": {"string": "Check if a type is serializable (no function, effect, or void types in the type itself)"}}}]}}}}},
{
"term": {
"name": "hydra.core.predicates.isTrivialTerm",
"signature": {
"typeParameters": [],
"parameters": [{"name": "arg0", "type": {"variable": "hydra.core.model.Term"}, "isLazy": false}],
"result": {"type": {"literal": "boolean"}}},
"body": {
"annotated": {
"body": {
"lambda": {
"parameter": "t",
"domain": {"variable": "hydra.core.model.Term"},
"body": {
"application": {
"function": {
"cases": {
"typeName": "hydra.core.model.Term",
"default": {"literal": {"boolean": false}},
"cases": [
{
"name": "literal",
"handler": {
"lambda": {"parameter": "_", "domain": {"variable": "hydra.core.model.Literal"}, "body": {"literal": {"boolean": true}}}}},
{
"name": "variable",
"handler": {
"lambda": {
"parameter": "nm",
"domain": {"variable": "hydra.core.model.Name"},
"body": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.lib.equality.equal"}, "type": {"literal": {"integer": "int32"}}}},
"argument": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.length"}, "type": {"literal": "string"}}},
"argument": {
"application": {
"function": {"application": {"function": {"variable": "hydra.core.lib.strings.splitOn"}, "argument": {"literal": {"string": "."}}}},
"argument": {"application": {"function": {"unwrap": "hydra.core.model.Name"}, "argument": {"variable": "nm"}}}}}}}}},
"argument": {"literal": {"integer": {"int32": 1}}}}}}}},
{"name": "unit", "handler": {"lambda": {"parameter": "_", "domain": "unit", "body": {"literal": {"boolean": true}}}}},
{
"name": "application",
"handler": {
"lambda": {
"parameter": "app",
"domain": {"variable": "hydra.core.model.Application"},
"body": {
"let": {
"bindings": [
{
"name": "fun",
"term": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.Application", "fieldName": "function"}},
"argument": {"variable": "app"}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "arg",
"term": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.Application", "fieldName": "argument"}},
"argument": {"variable": "app"}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
"body": {
"application": {
"function": {
"cases": {
"typeName": "hydra.core.model.Term",
"default": {"literal": {"boolean": false}},
"cases": [
{
"name": "project",
"handler": {
"lambda": {
"parameter": "_",
"domain": {"variable": "hydra.core.model.Projection"},
"body": {"application": {"function": {"variable": "hydra.core.predicates.isTrivialTerm"}, "argument": {"variable": "arg"}}}}}},
{
"name": "unwrap",
"handler": {
"lambda": {
"parameter": "_",
"domain": {"variable": "hydra.core.model.Name"},
"body": {"application": {"function": {"variable": "hydra.core.predicates.isTrivialTerm"}, "argument": {"variable": "arg"}}}}}}]}},
"argument": {"variable": "fun"}}}}}}}}}},
{
"name": "optional",
"handler": {
"lambda": {
"parameter": "opt",
"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": {"literal": "boolean"}}},
"argument": {"variable": "opt"}}},
"argument": {"literal": {"boolean": true}}}},
"argument": {
"lambda": {
"parameter": "inner",
"domain": {"variable": "hydra.core.model.Term"},
"body": {"application": {"function": {"variable": "hydra.core.predicates.isTrivialTerm"}, "argument": {"variable": "inner"}}}}}}}}}},
{
"name": "record",
"handler": {
"lambda": {
"parameter": "rec",
"domain": {"variable": "hydra.core.model.Record"},
"body": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.foldl"}, "type": {"literal": "boolean"}}},
"type": {"variable": "hydra.core.model.Field"}}},
"argument": {
"lambda": {
"parameter": "acc",
"domain": {"literal": "boolean"},
"body": {
"lambda": {
"parameter": "fld",
"domain": {"variable": "hydra.core.model.Field"},
"body": {
"application": {
"function": {"application": {"function": {"variable": "hydra.core.lib.logic.and"}, "argument": {"variable": "acc"}}},
"argument": {
"application": {
"function": {"variable": "hydra.core.predicates.isTrivialTerm"},
"argument": {
"application": {"function": {"project": {"typeName": "hydra.core.model.Field", "fieldName": "term"}}, "argument": {"variable": "fld"}}}}}}}}}}}}},
"argument": {"literal": {"boolean": true}}}},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.Record", "fieldName": "fields"}},
"argument": {"variable": "rec"}}}}}}}},
{
"name": "wrap",
"handler": {
"lambda": {
"parameter": "wt",
"domain": {"variable": "hydra.core.model.WrappedTerm"},
"body": {
"application": {
"function": {"variable": "hydra.core.predicates.isTrivialTerm"},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.WrappedTerm", "fieldName": "body"}},
"argument": {"variable": "wt"}}}}}}}},
{
"name": "typeApplication",
"handler": {
"lambda": {
"parameter": "ta",
"domain": {"variable": "hydra.core.model.TypeApplicationTerm"},
"body": {
"application": {
"function": {"variable": "hydra.core.predicates.isTrivialTerm"},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.TypeApplicationTerm", "fieldName": "body"}},
"argument": {"variable": "ta"}}}}}}}},
{
"name": "typeLambda",
"handler": {
"lambda": {
"parameter": "tl",
"domain": {"variable": "hydra.core.model.TypeLambda"},
"body": {
"application": {
"function": {"variable": "hydra.core.predicates.isTrivialTerm"},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.TypeLambda", "fieldName": "body"}},
"argument": {"variable": "tl"}}}}}}}}]}},
"argument": {"application": {"function": {"variable": "hydra.core.strip.deannotateTerm"}, "argument": {"variable": "t"}}}}}}},
"annotation": {
"map": [
{
"key": {"variable": "description"},
"value": {"literal": {"string": "Check if a term is trivially cheap (no thunking needed)"}}}]}}}}},
{
"term": {
"name": "hydra.core.predicates.isType",
"signature": {
"typeParameters": [],
"parameters": [{"name": "arg0", "type": {"variable": "hydra.core.model.Type"}, "isLazy": false}],
"result": {"type": {"literal": "boolean"}}},
"body": {
"annotated": {
"body": {
"lambda": {
"parameter": "t",
"domain": {"variable": "hydra.core.model.Type"},
"body": {
"application": {
"function": {
"cases": {
"typeName": "hydra.core.model.Type",
"default": {"literal": {"boolean": false}},
"cases": [
{
"name": "application",
"handler": {
"lambda": {
"parameter": "a",
"domain": {"variable": "hydra.core.model.ApplicationType"},
"body": {
"application": {
"function": {"variable": "hydra.core.predicates.isType"},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.ApplicationType", "fieldName": "function"}},
"argument": {"variable": "a"}}}}}}}},
{
"name": "forall",
"handler": {
"lambda": {
"parameter": "l",
"domain": {"variable": "hydra.core.model.ForallType"},
"body": {
"application": {
"function": {"variable": "hydra.core.predicates.isType"},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.ForallType", "fieldName": "body"}},
"argument": {"variable": "l"}}}}}}}},
{
"name": "union",
"handler": {
"lambda": {
"parameter": "rt",
"domain": {"list": {"variable": "hydra.core.model.FieldType"}},
"body": {"literal": {"boolean": false}}}}},
{
"name": "variable",
"handler": {
"lambda": {
"parameter": "v",
"domain": {"variable": "hydra.core.model.Name"},
"body": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {"body": {"variable": "hydra.core.lib.equality.equal"}, "type": {"variable": "hydra.core.model.Name"}}},
"argument": {"variable": "v"}}},
"argument": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.model.Type"}}}}}}}}}]}},
"argument": {"application": {"function": {"variable": "hydra.core.strip.deannotateType"}, "argument": {"variable": "t"}}}}}}},
"annotation": {
"map": [
{
"key": {"variable": "description"},
"value": {"literal": {"string": "Check whether a type is a type (always true for non-encoded types)"}}}]}}}}},
{
"term": {
"name": "hydra.core.predicates.isUnitTerm",
"signature": {
"typeParameters": [],
"parameters": [{"name": "arg0", "type": {"variable": "hydra.core.model.Term"}, "isLazy": false}],
"result": {"type": {"literal": "boolean"}}},
"body": {
"annotated": {
"body": {
"cases": {
"typeName": "hydra.core.model.Term",
"default": {"literal": {"boolean": false}},
"cases": [{"name": "unit", "handler": {"lambda": {"parameter": "_", "domain": "unit", "body": {"literal": {"boolean": true}}}}}]}},
"annotation": {
"map": [{"key": {"variable": "description"}, "value": {"literal": {"string": "Check whether a term is the unit term"}}}]}}}}},
{
"term": {
"name": "hydra.core.predicates.isUnitType",
"signature": {
"typeParameters": [],
"parameters": [{"name": "arg0", "type": {"variable": "hydra.core.model.Type"}, "isLazy": false}],
"result": {"type": {"literal": "boolean"}}},
"body": {
"annotated": {
"body": {
"cases": {
"typeName": "hydra.core.model.Type",
"default": {"literal": {"boolean": false}},
"cases": [{"name": "unit", "handler": {"lambda": {"parameter": "_", "domain": "unit", "body": {"literal": {"boolean": true}}}}}]}},
"annotation": {
"map": [{"key": {"variable": "description"}, "value": {"literal": {"string": "Check whether a type is the unit type"}}}]}}}}},
{
"term": {
"name": "hydra.core.predicates.typeDependencies",
"signature": {
"typeParameters": [{"name": "t0", "constraints": []}],
"parameters": [
{"name": "arg0", "type": {"variable": "t0"}, "isLazy": false},
{"name": "arg1", "type": {"variable": "hydra.core.graph.Graph"}, "isLazy": false},
{"name": "arg2", "type": {"literal": "boolean"}, "isLazy": false},
{
"name": "arg3",
"type": {"function": {"domain": {"variable": "hydra.core.model.Type"}, "codomain": {"variable": "hydra.core.model.Type"}}},
"isLazy": false},
{"name": "arg4", "type": {"variable": "hydra.core.model.Name"}, "isLazy": false}],
"result": {
"type": {
"either": {
"left": {"variable": "hydra.core.errors.Error"},
"right": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.Type"}}}}}}},
"body": {
"typeLambda": {
"parameter": "t0",
"body": {
"annotated": {
"body": {
"lambda": {
"parameter": "cx",
"domain": {"variable": "t0"},
"body": {
"lambda": {
"parameter": "graph",
"domain": {"variable": "hydra.core.graph.Graph"},
"body": {
"lambda": {
"parameter": "withSchema",
"domain": {"literal": "boolean"},
"body": {
"lambda": {
"parameter": "transform",
"domain": {"function": {"domain": {"variable": "hydra.core.model.Type"}, "codomain": {"variable": "hydra.core.model.Type"}}},
"body": {
"lambda": {
"parameter": "name",
"domain": {"variable": "hydra.core.model.Name"},
"body": {
"let": {
"bindings": [
{
"name": "requireType",
"term": {
"lambda": {
"parameter": "name",
"domain": {"variable": "hydra.core.model.Name"},
"body": {
"let": {
"bindings": [
{
"name": "cx1",
"term": {"variable": "cx"},
"typeScheme": {"variables": [], "body": {"variable": "t0"}, "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.Binding"}}},
"type": {"variable": "hydra.core.model.Type"}}},
"argument": {
"application": {
"function": {"application": {"function": {"variable": "hydra.core.lexical.requireBinding"}, "argument": {"variable": "graph"}}},
"argument": {"variable": "name"}}}}},
"argument": {
"lambda": {
"parameter": "el",
"domain": {"variable": "hydra.core.model.Binding"},
"body": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.eithers.bimap"}, "type": {"variable": "hydra.core.errors.DecodingError"}}},
"type": {"variable": "hydra.core.model.Type"}}},
"type": {"variable": "hydra.core.errors.Error"}}},
"type": {"variable": "hydra.core.model.Type"}}},
"argument": {
"lambda": {
"parameter": "_e",
"domain": {"variable": "hydra.core.errors.DecodingError"},
"body": {"inject": {"typeName": "hydra.core.errors.Error", "field": {"name": "decoding", "term": {"variable": "_e"}}}}}}}},
"argument": {"lambda": {"parameter": "_a", "domain": {"variable": "hydra.core.model.Type"}, "body": {"variable": "_a"}}}}},
"argument": {
"application": {
"function": {"application": {"function": {"variable": "hydra.core.decode.model.type"}, "argument": {"variable": "graph"}}},
"argument": {
"application": {"function": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "term"}}, "argument": {"variable": "el"}}}}}}}}}}}}}}},
"typeScheme": {
"variables": [],
"body": {
"function": {
"domain": {"variable": "hydra.core.model.Name"},
"codomain": {"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"variable": "hydra.core.model.Type"}}}}},
"constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "toPair",
"term": {
"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.model.Type"}}},
"type": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.model.Type"}}}}},
"type": {"variable": "hydra.core.errors.Error"}}},
"argument": {
"lambda": {
"parameter": "typ",
"domain": {"variable": "hydra.core.model.Type"},
"body": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {
"pair": {
"first": {"variable": "name"},
"second": {"application": {"function": {"variable": "transform"}, "argument": {"variable": "typ"}}}}},
"type": {"variable": "hydra.core.model.Name"}}},
"type": {"variable": "hydra.core.model.Type"}}}}}}},
"argument": {"application": {"function": {"variable": "requireType"}, "argument": {"variable": "name"}}}}}}},
"typeScheme": {
"variables": [],
"body": {
"function": {
"domain": {"variable": "hydra.core.model.Name"},
"codomain": {
"either": {
"left": {"variable": "hydra.core.errors.Error"},
"right": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.model.Type"}}}}}}},
"constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "deps",
"term": {
"lambda": {
"parameter": "seeds",
"domain": {"set": {"variable": "hydra.core.model.Name"}},
"body": {
"lambda": {
"parameter": "names",
"domain": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.Type"}}},
"body": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {"variable": "hydra.core.lib.logic.ifElse"},
"type": {
"either": {
"left": {"variable": "hydra.core.errors.Error"},
"right": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.Type"}}}}}}},
"argument": {
"application": {
"function": {
"typeApplication": {"body": {"variable": "hydra.core.lib.sets.isEmpty"}, "type": {"variable": "hydra.core.model.Name"}}},
"argument": {"variable": "seeds"}}}}},
"argument": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"either": {"right": {"variable": "names"}}}, "type": {"variable": "hydra.core.errors.Error"}}},
"type": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.Type"}}}}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.eithers.bind"}, "type": {"variable": "hydra.core.errors.Error"}}},
"type": {"list": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.model.Type"}}}}}},
"type": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.Type"}}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.eithers.mapList"}, "type": {"variable": "hydra.core.model.Name"}}},
"type": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.model.Type"}}}}},
"type": {"variable": "hydra.core.errors.Error"}}},
"argument": {"variable": "toPair"}}},
"argument": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.toList"}, "type": {"variable": "hydra.core.model.Name"}}},
"argument": {"variable": "seeds"}}}}}}},
"argument": {
"lambda": {
"parameter": "pairs",
"domain": {"list": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.model.Type"}}}},
"body": {
"let": {
"bindings": [
{
"name": "newNames",
"term": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.union"}, "type": {"variable": "hydra.core.model.Name"}}},
"type": {"variable": "hydra.core.model.Type"}}},
"argument": {"variable": "names"}}},
"argument": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.maps.fromList"}, "type": {"variable": "hydra.core.model.Name"}}},
"type": {"variable": "hydra.core.model.Type"}}},
"argument": {"variable": "pairs"}}}}},
"typeScheme": {
"variables": [],
"body": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.Type"}}},
"constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "refs",
"term": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.lists.foldl"}, "type": {"set": {"variable": "hydra.core.model.Name"}}}},
"type": {"set": {"variable": "hydra.core.model.Name"}}}},
"argument": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.union"}, "type": {"variable": "hydra.core.model.Name"}}}}},
"argument": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.empty"}, "type": {"variable": "hydra.core.model.Name"}}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {"variable": "hydra.core.lib.lists.map"},
"type": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.model.Type"}}}}},
"type": {"set": {"variable": "hydra.core.model.Name"}}}},
"argument": {
"lambda": {
"parameter": "pair",
"domain": {"pair": {"first": {"variable": "hydra.core.model.Name"}, "second": {"variable": "hydra.core.model.Type"}}},
"body": {
"application": {
"function": {
"application": {"function": {"variable": "hydra.core.dependencies.typeDependencyNames"}, "argument": {"variable": "withSchema"}}},
"argument": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"variable": "hydra.core.model.Name"}}},
"type": {"variable": "hydra.core.model.Type"}}},
"argument": {"variable": "pair"}}}}}}}}},
"argument": {"variable": "pairs"}}}}},
"typeScheme": {"variables": [], "body": {"set": {"variable": "hydra.core.model.Name"}}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "visited",
"term": {
"application": {
"function": {
"typeApplication": {"body": {"variable": "hydra.core.lib.sets.fromList"}, "type": {"variable": "hydra.core.model.Name"}}},
"argument": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.keys"}, "type": {"variable": "hydra.core.model.Name"}}},
"type": {"variable": "hydra.core.model.Type"}}},
"argument": {"variable": "names"}}}}},
"typeScheme": {"variables": [], "body": {"set": {"variable": "hydra.core.model.Name"}}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "newSeeds",
"term": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {"body": {"variable": "hydra.core.lib.sets.difference"}, "type": {"variable": "hydra.core.model.Name"}}},
"argument": {"variable": "refs"}}},
"argument": {"variable": "visited"}}},
"typeScheme": {"variables": [], "body": {"set": {"variable": "hydra.core.model.Name"}}, "constraints": []}}],
"body": {
"application": {
"function": {"application": {"function": {"variable": "deps"}, "argument": {"variable": "newSeeds"}}},
"argument": {"variable": "newNames"}}}}}}}}}}}}}}}}}}}}},
"typeScheme": {
"variables": [],
"body": {
"function": {
"domain": {"set": {"variable": "hydra.core.model.Name"}},
"codomain": {
"function": {
"domain": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.Type"}}},
"codomain": {
"either": {
"left": {"variable": "hydra.core.errors.Error"},
"right": {"map": {"keys": {"variable": "hydra.core.model.Name"}, "values": {"variable": "hydra.core.model.Type"}}}}}}}}},
"constraints": []}}],
"body": {
"application": {
"function": {
"application": {
"function": {"variable": "deps"},
"argument": {
"application": {
"function": {
"typeApplication": {"body": {"variable": "hydra.core.lib.sets.singleton"}, "type": {"variable": "hydra.core.model.Name"}}},
"argument": {"variable": "name"}}}}},
"argument": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.empty"}, "type": {"variable": "hydra.core.model.Name"}}},
"type": {"variable": "hydra.core.model.Type"}}}}}}}}}}}}}}}}}}}}},
"annotation": {
"map": [
{
"key": {"variable": "description"},
"value": {"literal": {"string": "Get all type dependencies for a given type name (Either version)"}}}]}}}}}}}]}