hydra-kernel-0.18.1: hydra-kernel-json/hydra/core/dsls.json
{
"name": "hydra.core.dsls",
"metadata": {
"description": "Functions for generating domain-specific DSL modules from type modules",
"comments": [],
"seeAlso": [],
"provisions": []},
"dependencies": [
{"module": "hydra.core.annotations"},
{"module": "hydra.core.coders"},
{"module": "hydra.core.constants"},
{"module": "hydra.core.decode.model"},
{"module": "hydra.core.encode.model"},
{"module": "hydra.core.errors"},
{"module": "hydra.core.formatting"},
{"module": "hydra.core.lexical"},
{"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.names"},
{"module": "hydra.core.packaging"},
{"module": "hydra.core.reflect"},
{"module": "hydra.core.rewriting"},
{"module": "hydra.core.scoping"},
{"module": "hydra.core.strip"},
{"module": "hydra.core.typing"},
{"module": "hydra.core.variants"}],
"definitions": [
{
"term": {
"name": "hydra.core.dsls.collectForallVars",
"signature": {
"typeParameters": [],
"parameters": [{"name": "arg0", "type": {"variable": "hydra.core.model.Type"}, "isLazy": false}],
"result": {"type": {"list": {"variable": "hydra.core.model.Name"}}}},
"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.model.Name"}}},
"cases": [
{
"name": "annotated",
"handler": {
"lambda": {
"parameter": "at",
"domain": {"variable": "hydra.core.model.AnnotatedType"},
"body": {
"application": {
"function": {"variable": "hydra.core.dsls.collectForallVars"},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.AnnotatedType", "fieldName": "body"}},
"argument": {"variable": "at"}}}}}}}},
{
"name": "forall",
"handler": {
"lambda": {
"parameter": "ft",
"domain": {"variable": "hydra.core.model.ForallType"},
"body": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.cons"}, "type": {"variable": "hydra.core.model.Name"}}},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.ForallType", "fieldName": "parameter"}},
"argument": {"variable": "ft"}}}}},
"argument": {
"application": {
"function": {"variable": "hydra.core.dsls.collectForallVars"},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.ForallType", "fieldName": "body"}},
"argument": {"variable": "ft"}}}}}}}}}}]}},
"argument": {"variable": "typ"}}}}},
"annotation": {
"map": [
{"key": {"variable": "description"}, "value": {"literal": {"string": "Collect forall type variable names from a type"}}}]}}}}},
{
"term": {
"name": "hydra.core.dsls.deduplicateBindings",
"signature": {
"typeParameters": [],
"parameters": [{"name": "arg0", "type": {"list": {"variable": "hydra.core.model.Binding"}}, "isLazy": false}],
"result": {"type": {"list": {"variable": "hydra.core.model.Binding"}}}},
"body": {
"annotated": {
"body": {
"lambda": {
"parameter": "bindings",
"domain": {"list": {"variable": "hydra.core.model.Binding"}},
"body": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.lists.foldl"}, "type": {"list": {"variable": "hydra.core.model.Binding"}}}},
"type": {"variable": "hydra.core.model.Binding"}}},
"argument": {
"lambda": {
"parameter": "acc",
"domain": {"list": {"variable": "hydra.core.model.Binding"}},
"body": {
"lambda": {
"parameter": "b",
"domain": {"variable": "hydra.core.model.Binding"},
"body": {
"let": {
"bindings": [
{
"name": "usedNames",
"term": {
"application": {
"function": {
"typeApplication": {"body": {"variable": "hydra.core.lib.sets.fromList"}, "type": {"variable": "hydra.core.model.Name"}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.model.Binding"}}},
"type": {"variable": "hydra.core.model.Name"}}},
"argument": {
"lambda": {
"parameter": "a",
"domain": {"variable": "hydra.core.model.Binding"},
"body": {
"application": {"function": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "name"}}, "argument": {"variable": "a"}}}}}}},
"argument": {"variable": "acc"}}}}},
"typeScheme": {"variables": [], "body": {"set": {"variable": "hydra.core.model.Name"}}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "uniqueName",
"term": {
"application": {
"function": {
"application": {"function": {"variable": "hydra.core.lexical.chooseUniqueName"}, "argument": {"variable": "usedNames"}}},
"argument": {
"application": {"function": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "name"}}, "argument": {"variable": "b"}}}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Name"}, "constraints": []}}],
"body": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {"body": {"variable": "hydra.core.lib.lists.concat2"}, "type": {"variable": "hydra.core.model.Binding"}}},
"argument": {"variable": "acc"}}},
"argument": {
"list": [
{
"record": {
"typeName": "hydra.core.model.Binding",
"fields": [
{"name": "name", "term": {"variable": "uniqueName"}},
{
"name": "term",
"term": {
"application": {"function": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "term"}}, "argument": {"variable": "b"}}}},
{
"name": "typeScheme",
"term": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "typeScheme"}},
"argument": {"variable": "b"}}}}]}}]}}}}}}}}}}}}},
"argument": {"typeApplication": {"body": {"list": []}, "type": {"variable": "hydra.core.model.Binding"}}}}},
"argument": {"variable": "bindings"}}}}},
"annotation": {
"map": [
{
"key": {"variable": "description"},
"value": {"literal": {"string": "Deduplicate bindings by appending numeric suffixes to duplicate names"}}}]}}}}},
{
"term": {
"name": "hydra.core.dsls.dslBindingName",
"signature": {
"typeParameters": [],
"parameters": [{"name": "arg0", "type": {"variable": "hydra.core.model.Name"}, "isLazy": false}],
"result": {"type": {"variable": "hydra.core.model.Name"}}},
"body": {
"annotated": {
"body": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.names.derivedBindingName"}, "type": {"literal": "boolean"}}},
"argument": {"list": [{"literal": {"string": "dsl"}}]}}},
"argument": {"literal": {"boolean": false}}}},
"annotation": {
"map": [
{
"key": {"variable": "description"},
"value": {"literal": {"string": "Generate a binding name for a DSL function from a type name"}}}]}}}}},
{
"term": {
"name": "hydra.core.dsls.dslDefinitionName",
"signature": {
"typeParameters": [],
"parameters": [
{"name": "arg0", "type": {"variable": "hydra.core.model.Name"}, "isLazy": false},
{"name": "arg1", "type": {"literal": "string"}, "isLazy": false}],
"result": {"type": {"variable": "hydra.core.model.Name"}}},
"body": {
"annotated": {
"body": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.names.derivedDefinitionName"}, "type": {"literal": "boolean"}}},
"argument": {"list": [{"literal": {"string": "dsl"}}]}}},
"argument": {"literal": {"boolean": false}}}},
"argument": {"literal": {"boolean": true}}}},
"annotation": {
"map": [
{
"key": {"variable": "description"},
"value": {"literal": {"string": "Generate a qualified DSL element name from a type name and local element name"}}}]}}}}},
{
"term": {
"name": "hydra.core.dsls.dslModule",
"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.packaging.Module"}, "isLazy": false}],
"result": {
"type": {
"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"optional": {"variable": "hydra.core.packaging.Module"}}}}}},
"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": "mod",
"domain": {"variable": "hydra.core.packaging.Module"},
"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.Binding"}}}},
"type": {"optional": {"variable": "hydra.core.packaging.Module"}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.dsls.filterTypeBindings"}, "type": {"variable": "t0"}}},
"type": {"variable": "hydra.core.graph.Graph"}}},
"type": {"variable": "hydra.core.errors.Error"}}},
"argument": {"variable": "cx"}}},
"argument": {"variable": "graph"}}},
"argument": {
"application": {
"function": {
"typeApplication": {"body": {"variable": "hydra.core.lib.optionals.givens"}, "type": {"variable": "hydra.core.model.Binding"}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.packaging.Definition"}}},
"type": {"optional": {"variable": "hydra.core.model.Binding"}}}},
"argument": {
"lambda": {
"parameter": "d",
"domain": {"variable": "hydra.core.packaging.Definition"},
"body": {
"application": {
"function": {
"cases": {
"typeName": "hydra.core.packaging.Definition",
"default": {"typeApplication": {"body": {"optional": null}, "type": {"variable": "hydra.core.model.Binding"}}},
"cases": [
{
"name": "type",
"handler": {
"lambda": {
"parameter": "td",
"domain": {"variable": "hydra.core.packaging.TypeDefinition"},
"body": {
"optional": {
"application": {
"function": {
"application": {
"function": {
"lambda": {
"parameter": "name",
"domain": {"variable": "hydra.core.model.Name"},
"body": {
"lambda": {
"parameter": "typ",
"domain": {"variable": "hydra.core.model.Type"},
"body": {
"let": {
"bindings": [
{
"name": "schemaTerm",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "variable",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.model.Type"}}}}}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "dataTerm",
"term": {
"application": {
"function": {"variable": "hydra.core.annotations.normalizeTermAnnotations"},
"argument": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "annotated",
"term": {
"record": {
"typeName": "hydra.core.model.AnnotatedTerm",
"fields": [
{
"name": "body",
"term": {"application": {"function": {"variable": "hydra.core.encode.model.type"}, "argument": {"variable": "typ"}}}},
{
"name": "annotation",
"term": {
"application": {
"function": {"variable": "hydra.core.annotations.wrapAnnotationMap"},
"argument": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.maps.fromList"}, "type": {"variable": "hydra.core.model.Name"}}},
"type": {"variable": "hydra.core.model.Term"}}},
"argument": {
"list": [
{
"typeApplication": {
"body": {
"typeApplication": {
"body": {"pair": {"first": {"variable": "hydra.core.constants.keyType"}, "second": {"variable": "schemaTerm"}}},
"type": {"variable": "hydra.core.model.Name"}}},
"type": {"variable": "hydra.core.model.Term"}}}]}}}}}}]}}}}}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
"body": {
"record": {
"typeName": "hydra.core.model.Binding",
"fields": [
{"name": "name", "term": {"variable": "name"}},
{"name": "term", "term": {"variable": "dataTerm"}},
{
"name": "typeScheme",
"term": {
"optional": {
"record": {
"typeName": "hydra.core.model.TypeScheme",
"fields": [
{
"name": "variables",
"term": {"typeApplication": {"body": {"list": []}, "type": {"variable": "hydra.core.model.Name"}}}},
{
"name": "body",
"term": {
"inject": {
"typeName": "hydra.core.model.Type",
"field": {
"name": "variable",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.model.Type"}}}}}}}},
{
"name": "constraints",
"term": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.empty"}, "type": {"variable": "hydra.core.model.Name"}}},
"type": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}]}}}}]}}}}}}}}}},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.packaging.TypeDefinition", "fieldName": "name"}},
"argument": {"variable": "td"}}}}},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.TypeScheme", "fieldName": "body"}},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.packaging.TypeDefinition", "fieldName": "body"}},
"argument": {"variable": "td"}}}}}}}}}}}]}},
"argument": {"variable": "d"}}}}}}},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.packaging.Module", "fieldName": "definitions"}},
"argument": {"variable": "mod"}}}}}}}}}}},
"argument": {
"lambda": {
"parameter": "typeBindings",
"domain": {"list": {"variable": "hydra.core.model.Binding"}},
"body": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.eithers.bind"}, "type": {"variable": "hydra.core.errors.Error"}}},
"type": {"list": {"list": {"variable": "hydra.core.model.Binding"}}}}},
"type": {"optional": {"variable": "hydra.core.packaging.Module"}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.eithers.mapList"}, "type": {"variable": "hydra.core.model.Binding"}}},
"type": {"list": {"variable": "hydra.core.model.Binding"}}}},
"type": {"variable": "hydra.core.errors.Error"}}},
"argument": {
"lambda": {
"parameter": "b",
"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": {"list": {"variable": "hydra.core.model.Binding"}}}},
"type": {"variable": "hydra.core.errors.Error"}}},
"type": {"list": {"variable": "hydra.core.model.Binding"}}}},
"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": "x", "domain": {"list": {"variable": "hydra.core.model.Binding"}}, "body": {"variable": "x"}}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.dsls.generateBindingsForType"}, "type": {"variable": "t0"}}},
"argument": {"variable": "cx"}}},
"argument": {"variable": "graph"}}},
"argument": {"variable": "b"}}}}}}}}},
"argument": {"variable": "typeBindings"}}}}},
"argument": {
"lambda": {
"parameter": "typeDslBindings",
"domain": {"list": {"list": {"variable": "hydra.core.model.Binding"}}},
"body": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.eithers.bind"}, "type": {"variable": "hydra.core.errors.Error"}}},
"type": {"list": {"list": {"variable": "hydra.core.model.Binding"}}}}},
"type": {"optional": {"variable": "hydra.core.packaging.Module"}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.eithers.mapList"}, "type": {"variable": "hydra.core.packaging.Definition"}}},
"type": {"list": {"variable": "hydra.core.model.Binding"}}}},
"type": {"variable": "hydra.core.errors.Error"}}},
"argument": {
"lambda": {
"parameter": "d",
"domain": {"variable": "hydra.core.packaging.Definition"},
"body": {
"application": {
"function": {
"typeApplication": {"body": {"variable": "hydra.core.dsls.generateRefBindings"}, "type": {"variable": "hydra.core.errors.Error"}}},
"argument": {"variable": "d"}}}}}}},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.packaging.Module", "fieldName": "definitions"}},
"argument": {"variable": "mod"}}}}}}},
"argument": {
"lambda": {
"parameter": "refDslBindings",
"domain": {"list": {"list": {"variable": "hydra.core.model.Binding"}}},
"body": {
"let": {
"bindings": [
{
"name": "allBindings",
"term": {
"application": {
"function": {"variable": "hydra.core.dsls.deduplicateBindings"},
"argument": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {"body": {"variable": "hydra.core.lib.lists.concat2"}, "type": {"variable": "hydra.core.model.Binding"}}},
"argument": {
"application": {
"function": {
"typeApplication": {"body": {"variable": "hydra.core.lib.lists.concat"}, "type": {"variable": "hydra.core.model.Binding"}}},
"argument": {"variable": "typeDslBindings"}}}}},
"argument": {
"application": {
"function": {
"typeApplication": {"body": {"variable": "hydra.core.lib.lists.concat"}, "type": {"variable": "hydra.core.model.Binding"}}},
"argument": {"variable": "refDslBindings"}}}}}}},
"typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Binding"}}, "constraints": []}}],
"body": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {"variable": "hydra.core.lib.logic.ifElse"},
"type": {
"either": {"left": {"variable": "hydra.core.errors.Error"}, "right": {"optional": {"variable": "hydra.core.packaging.Module"}}}}}},
"argument": {
"application": {
"function": {
"typeApplication": {"body": {"variable": "hydra.core.lib.lists.isEmpty"}, "type": {"variable": "hydra.core.model.Binding"}}},
"argument": {"variable": "allBindings"}}}}},
"argument": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {
"either": {"right": {"typeApplication": {"body": {"optional": null}, "type": {"variable": "hydra.core.packaging.Module"}}}}},
"type": {"variable": "hydra.core.errors.Error"}}},
"type": {"optional": {"variable": "hydra.core.packaging.Module"}}}}}},
"argument": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {
"either": {
"right": {
"optional": {
"record": {
"typeName": "hydra.core.packaging.Module",
"fields": [
{
"name": "name",
"term": {
"application": {
"function": {"variable": "hydra.core.dsls.dslModuleName"},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.packaging.Module", "fieldName": "name"}},
"argument": {"variable": "mod"}}}}}},
{
"name": "metadata",
"term": {
"optional": {
"record": {
"typeName": "hydra.core.packaging.EntityMetadata",
"fields": [
{
"name": "description",
"term": {
"optional": {
"application": {
"function": {"variable": "hydra.core.lib.strings.concat"},
"argument": {
"list": [
{"literal": {"string": "DSL functions for "}},
{
"application": {
"function": {"unwrap": "hydra.core.packaging.ModuleName"},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.packaging.Module", "fieldName": "name"}},
"argument": {"variable": "mod"}}}}}]}}}}},
{"name": "comments", "term": {"typeApplication": {"body": {"list": []}, "type": {"literal": "string"}}}},
{
"name": "seeAlso",
"term": {"typeApplication": {"body": {"list": []}, "type": {"variable": "hydra.core.packaging.EntityReference"}}}},
{
"name": "lifecycle",
"term": {"typeApplication": {"body": {"optional": null}, "type": {"variable": "hydra.core.packaging.LifecycleInfo"}}}},
{
"name": "provisions",
"term": {"typeApplication": {"body": {"list": []}, "type": {"variable": "hydra.core.packaging.Provision"}}}}]}}}},
{
"name": "dependencies",
"term": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.packaging.ModuleName"}}},
"type": {"variable": "hydra.core.packaging.ModuleDependency"}}},
"argument": {
"lambda": {
"parameter": "ns",
"domain": {"variable": "hydra.core.packaging.ModuleName"},
"body": {
"record": {
"typeName": "hydra.core.packaging.ModuleDependency",
"fields": [
{"name": "module", "term": {"variable": "ns"}},
{
"name": "package",
"term": {"typeApplication": {"body": {"optional": null}, "type": {"variable": "hydra.core.packaging.PackageName"}}}}]}}}}}},
"argument": {
"application": {
"function": {
"typeApplication": {"body": {"variable": "hydra.core.lib.lists.distinct"}, "type": {"variable": "hydra.core.packaging.ModuleName"}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {"body": {"variable": "hydra.core.lib.lists.concat2"}, "type": {"variable": "hydra.core.packaging.ModuleName"}}},
"argument": {
"list": [
{
"application": {
"function": {"project": {"typeName": "hydra.core.packaging.Module", "fieldName": "name"}},
"argument": {"variable": "mod"}}},
{"wrap": {"typeName": "hydra.core.packaging.ModuleName", "body": {"literal": {"string": "hydra.core.typed"}}}},
{
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.names.derivedModuleName"}, "type": {"literal": "boolean"}}},
"argument": {"list": [{"literal": {"string": "encode"}}]}}},
"argument": {"literal": {"boolean": true}}}},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.packaging.Module", "fieldName": "name"}},
"argument": {"variable": "mod"}}}}},
{
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.names.derivedModuleName"}, "type": {"literal": "boolean"}}},
"argument": {"list": [{"literal": {"string": "decode"}}]}}},
"argument": {"literal": {"boolean": true}}}},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.packaging.Module", "fieldName": "name"}},
"argument": {"variable": "mod"}}}}}]}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {"body": {"variable": "hydra.core.lib.lists.concat2"}, "type": {"variable": "hydra.core.packaging.ModuleName"}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.packaging.ModuleDependency"}}},
"type": {"variable": "hydra.core.packaging.ModuleName"}}},
"argument": {
"lambda": {
"parameter": "dep",
"domain": {"variable": "hydra.core.packaging.ModuleDependency"},
"body": {
"application": {
"function": {"project": {"typeName": "hydra.core.packaging.ModuleDependency", "fieldName": "module"}},
"argument": {"variable": "dep"}}}}}}},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.packaging.Module", "fieldName": "dependencies"}},
"argument": {"variable": "mod"}}}}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.packaging.ModuleName"}}},
"type": {"variable": "hydra.core.packaging.ModuleName"}}},
"argument": {"variable": "hydra.core.dsls.dslModuleName"}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.packaging.ModuleDependency"}}},
"type": {"variable": "hydra.core.packaging.ModuleName"}}},
"argument": {
"lambda": {
"parameter": "dep",
"domain": {"variable": "hydra.core.packaging.ModuleDependency"},
"body": {
"application": {
"function": {"project": {"typeName": "hydra.core.packaging.ModuleDependency", "fieldName": "module"}},
"argument": {"variable": "dep"}}}}}}},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.packaging.Module", "fieldName": "dependencies"}},
"argument": {"variable": "mod"}}}}}}}}}}}}}}}},
{
"name": "definitions",
"term": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.model.Binding"}}},
"type": {"variable": "hydra.core.packaging.Definition"}}},
"argument": {
"lambda": {
"parameter": "b",
"domain": {"variable": "hydra.core.model.Binding"},
"body": {
"inject": {
"typeName": "hydra.core.packaging.Definition",
"field": {
"name": "term",
"term": {
"record": {
"typeName": "hydra.core.packaging.TermDefinition",
"fields": [
{
"name": "name",
"term": {
"application": {"function": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "name"}}, "argument": {"variable": "b"}}}},
{
"name": "metadata",
"term": {"typeApplication": {"body": {"optional": null}, "type": {"variable": "hydra.core.packaging.EntityMetadata"}}}},
{
"name": "signature",
"term": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.optionals.map"}, "type": {"variable": "hydra.core.model.TypeScheme"}}},
"type": {"variable": "hydra.core.typing.TermSignature"}}},
"argument": {"variable": "hydra.core.scoping.typeSchemeToTermSignature"}}},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "typeScheme"}},
"argument": {"variable": "b"}}}}}},
{
"name": "body",
"term": {
"application": {"function": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "term"}}, "argument": {"variable": "b"}}}}]}}}}}}}}},
"argument": {"variable": "allBindings"}}}}]}}}}},
"type": {"variable": "hydra.core.errors.Error"}}},
"type": {"optional": {"variable": "hydra.core.packaging.Module"}}}}}}}}}}}}}}}}}}}}}}}}}},
"annotation": {
"map": [{"key": {"variable": "description"}, "value": {"literal": {"string": "Transform a source module into a DSL module"}}}]}}}}}}},
{
"term": {
"name": "hydra.core.dsls.dslModuleName",
"signature": {
"typeParameters": [],
"parameters": [{"name": "arg0", "type": {"variable": "hydra.core.packaging.ModuleName"}, "isLazy": false}],
"result": {"type": {"variable": "hydra.core.packaging.ModuleName"}}},
"body": {
"annotated": {
"body": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.names.derivedModuleName"}, "type": {"literal": "boolean"}}},
"argument": {"list": [{"literal": {"string": "dsl"}}]}}},
"argument": {"literal": {"boolean": false}}}},
"annotation": {
"map": [
{
"key": {"variable": "description"},
"value": {"literal": {"string": "Generate a DSL module name from a source module name"}}}]}}}}},
{
"term": {
"name": "hydra.core.dsls.dslSignatureTypeScheme",
"signature": {
"typeParameters": [],
"parameters": [{"name": "arg0", "type": {"variable": "hydra.core.typing.TermSignature"}, "isLazy": false}],
"result": {"type": {"variable": "hydra.core.model.TypeScheme"}}},
"body": {
"annotated": {
"body": {
"lambda": {
"parameter": "sig",
"domain": {"variable": "hydra.core.typing.TermSignature"},
"body": {
"let": {
"bindings": [
{
"name": "typeVars",
"term": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.typing.TypeParameter"}}},
"type": {"variable": "hydra.core.model.Name"}}},
"argument": {
"lambda": {
"parameter": "tp",
"domain": {"variable": "hydra.core.typing.TypeParameter"},
"body": {
"application": {
"function": {"project": {"typeName": "hydra.core.typing.TypeParameter", "fieldName": "name"}},
"argument": {"variable": "tp"}}}}}}},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.typing.TermSignature", "fieldName": "typeParameters"}},
"argument": {"variable": "sig"}}}}},
"typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Name"}}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "paramTypes",
"term": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.typing.Parameter"}}},
"type": {"variable": "hydra.core.model.Type"}}},
"argument": {
"lambda": {
"parameter": "p",
"domain": {"variable": "hydra.core.typing.Parameter"},
"body": {
"application": {
"function": {"project": {"typeName": "hydra.core.typing.Parameter", "fieldName": "type"}},
"argument": {"variable": "p"}}}}}}},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.typing.TermSignature", "fieldName": "parameters"}},
"argument": {"variable": "sig"}}}}},
"typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Type"}}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "resultType",
"term": {
"application": {
"function": {"project": {"typeName": "hydra.core.typing.Result", "fieldName": "type"}},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.typing.TermSignature", "fieldName": "result"}},
"argument": {"variable": "sig"}}}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "wrappedResult",
"term": {
"inject": {
"typeName": "hydra.core.model.Type",
"field": {
"name": "application",
"term": {
"record": {
"typeName": "hydra.core.model.ApplicationType",
"fields": [
{
"name": "function",
"term": {
"inject": {
"typeName": "hydra.core.model.Type",
"field": {
"name": "variable",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.typed.TypedTerm"}}}}}}}},
{"name": "argument", "term": {"variable": "resultType"}}]}}}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "funType",
"term": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.foldr"}, "type": {"variable": "hydra.core.model.Type"}}},
"type": {"variable": "hydra.core.model.Type"}}},
"argument": {
"lambda": {
"parameter": "paramType",
"domain": {"variable": "hydra.core.model.Type"},
"body": {
"lambda": {
"parameter": "acc",
"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": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {"body": {"variable": "hydra.core.lib.logic.ifElse"}, "type": {"variable": "hydra.core.model.Type"}}},
"argument": {
"application": {
"function": {
"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": {
"cases": {
"typeName": "hydra.core.model.Type",
"default": {"literal": {"boolean": false}},
"cases": [
{
"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.typed.TypedName"}}}}}}}}}]}},
"argument": {
"application": {
"function": {"variable": "hydra.core.strip.deannotateType"},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.ApplicationType", "fieldName": "function"}},
"argument": {"variable": "a"}}}}}}}}}}]}},
"argument": {"application": {"function": {"variable": "hydra.core.strip.deannotateType"}, "argument": {"variable": "t"}}}}}}},
"argument": {"application": {"function": {"variable": "hydra.core.strip.deannotateType"}, "argument": {"variable": "paramType"}}}}}}},
"argument": {"variable": "paramType"}}},
"argument": {
"inject": {
"typeName": "hydra.core.model.Type",
"field": {
"name": "application",
"term": {
"record": {
"typeName": "hydra.core.model.ApplicationType",
"fields": [
{
"name": "function",
"term": {
"inject": {
"typeName": "hydra.core.model.Type",
"field": {
"name": "variable",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.typed.TypedTerm"}}}}}}}},
{"name": "argument", "term": {"variable": "paramType"}}]}}}}}}}},
{"name": "codomain", "term": {"variable": "acc"}}]}}}}}}}}}}},
"argument": {"variable": "wrappedResult"}}},
"argument": {"variable": "paramTypes"}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
"body": {
"record": {
"typeName": "hydra.core.model.TypeScheme",
"fields": [
{"name": "variables", "term": {"variable": "typeVars"}},
{"name": "body", "term": {"variable": "funType"}},
{
"name": "constraints",
"term": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.empty"}, "type": {"variable": "hydra.core.model.Name"}}},
"type": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}]}}}}}}}}}}}}}},
"annotation": {
"map": [
{
"key": {"variable": "description"},
"value": {"literal": {"string": "Build a TypedTerm-wrapped TypeScheme (functions of phantom terms) from a TermSignature"}}}]}}}}},
{
"term": {
"name": "hydra.core.dsls.dslTypeScheme",
"signature": {
"typeParameters": [],
"parameters": [
{"name": "arg0", "type": {"variable": "hydra.core.model.Type"}, "isLazy": false},
{"name": "arg1", "type": {"list": {"variable": "hydra.core.model.Type"}}, "isLazy": false},
{"name": "arg2", "type": {"variable": "hydra.core.model.Type"}, "isLazy": false}],
"result": {"type": {"variable": "hydra.core.model.TypeScheme"}}},
"body": {
"annotated": {
"body": {
"lambda": {
"parameter": "origType",
"domain": {"variable": "hydra.core.model.Type"},
"body": {
"lambda": {
"parameter": "paramTypes",
"domain": {"list": {"variable": "hydra.core.model.Type"}},
"body": {
"lambda": {
"parameter": "resultType",
"domain": {"variable": "hydra.core.model.Type"},
"body": {
"let": {
"bindings": [
{
"name": "typeVars",
"term": {"application": {"function": {"variable": "hydra.core.dsls.collectForallVars"}, "argument": {"variable": "origType"}}},
"typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Name"}}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "wrappedResult",
"term": {
"inject": {
"typeName": "hydra.core.model.Type",
"field": {
"name": "application",
"term": {
"record": {
"typeName": "hydra.core.model.ApplicationType",
"fields": [
{
"name": "function",
"term": {
"inject": {
"typeName": "hydra.core.model.Type",
"field": {
"name": "variable",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.typed.TypedTerm"}}}}}}}},
{"name": "argument", "term": {"variable": "resultType"}}]}}}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "funType",
"term": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.foldr"}, "type": {"variable": "hydra.core.model.Type"}}},
"type": {"variable": "hydra.core.model.Type"}}},
"argument": {
"lambda": {
"parameter": "paramType",
"domain": {"variable": "hydra.core.model.Type"},
"body": {
"lambda": {
"parameter": "acc",
"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": "application",
"term": {
"record": {
"typeName": "hydra.core.model.ApplicationType",
"fields": [
{
"name": "function",
"term": {
"inject": {
"typeName": "hydra.core.model.Type",
"field": {
"name": "variable",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.typed.TypedTerm"}}}}}}}},
{"name": "argument", "term": {"variable": "paramType"}}]}}}}}},
{"name": "codomain", "term": {"variable": "acc"}}]}}}}}}}}}}},
"argument": {"variable": "wrappedResult"}}},
"argument": {"variable": "paramTypes"}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
"body": {
"record": {
"typeName": "hydra.core.model.TypeScheme",
"fields": [
{"name": "variables", "term": {"variable": "typeVars"}},
{"name": "body", "term": {"variable": "funType"}},
{
"name": "constraints",
"term": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.empty"}, "type": {"variable": "hydra.core.model.Name"}}},
"type": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}]}}}}}}}}}}}}}},
"annotation": {
"map": [
{
"key": {"variable": "description"},
"value": {"literal": {"string": "Build a TypeScheme with TypedTerm-wrapped parameter and result types"}}}]}}}}},
{
"term": {
"name": "hydra.core.dsls.filterTypeBindings",
"signature": {
"typeParameters": [{"name": "t0", "constraints": []}, {"name": "t1", "constraints": []}, {"name": "t2", "constraints": []}],
"parameters": [
{"name": "arg0", "type": {"variable": "t0"}, "isLazy": false},
{"name": "arg1", "type": {"variable": "t1"}, "isLazy": false},
{"name": "arg2", "type": {"list": {"variable": "hydra.core.model.Binding"}}, "isLazy": false}],
"result": {"type": {"either": {"left": {"variable": "t2"}, "right": {"list": {"variable": "hydra.core.model.Binding"}}}}}},
"body": {
"typeLambda": {
"parameter": "t0",
"body": {
"typeLambda": {
"parameter": "t1",
"body": {
"typeLambda": {
"parameter": "t2",
"body": {
"annotated": {
"body": {
"lambda": {
"parameter": "cx",
"domain": {"variable": "t0"},
"body": {
"lambda": {
"parameter": "graph",
"domain": {"variable": "t1"},
"body": {
"lambda": {
"parameter": "bindings",
"domain": {"list": {"variable": "hydra.core.model.Binding"}},
"body": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {"variable": "hydra.core.lib.eithers.map"},
"type": {"list": {"optional": {"variable": "hydra.core.model.Binding"}}}}},
"type": {"list": {"variable": "hydra.core.model.Binding"}}}},
"type": {"variable": "t2"}}},
"argument": {
"typeApplication": {"body": {"variable": "hydra.core.lib.optionals.givens"}, "type": {"variable": "hydra.core.model.Binding"}}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.eithers.mapList"}, "type": {"variable": "hydra.core.model.Binding"}}},
"type": {"optional": {"variable": "hydra.core.model.Binding"}}}},
"type": {"variable": "t2"}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.dsls.isDslEligibleBinding"}, "type": {"variable": "t0"}}},
"type": {"variable": "t1"}}},
"type": {"variable": "t2"}}},
"argument": {"variable": "cx"}}},
"argument": {"variable": "graph"}}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {"body": {"variable": "hydra.core.lib.lists.filter"}, "type": {"variable": "hydra.core.model.Binding"}}},
"argument": {"variable": "hydra.core.annotations.isNativeType"}}},
"argument": {"variable": "bindings"}}}}}}}}}}}}},
"annotation": {
"map": [
{
"key": {"variable": "description"},
"value": {"literal": {"string": "Filter bindings to only DSL-eligible type definitions"}}}]}}}}}}}}}}},
{
"term": {
"name": "hydra.core.dsls.generateBindingsForType",
"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.DecodingError"}, "right": {"list": {"variable": "hydra.core.model.Binding"}}}}}},
"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": "b",
"domain": {"variable": "hydra.core.model.Binding"},
"body": {
"let": {
"bindings": [
{
"name": "typeName",
"term": {
"application": {"function": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "name"}}, "argument": {"variable": "b"}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Name"}, "constraints": []}}],
"body": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.eithers.bind"}, "type": {"variable": "hydra.core.errors.DecodingError"}}},
"type": {"variable": "hydra.core.model.Type"}}},
"type": {"list": {"variable": "hydra.core.model.Binding"}}}},
"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": "b"}}}}}}},
"argument": {
"lambda": {
"parameter": "rawType",
"domain": {"variable": "hydra.core.model.Type"},
"body": {
"let": {
"bindings": [
{
"name": "typ",
"term": {
"application": {
"function": {"variable": "hydra.core.strip.deannotateTypeParameters"},
"argument": {"application": {"function": {"variable": "hydra.core.strip.deannotateType"}, "argument": {"variable": "rawType"}}}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
"body": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {
"either": {
"right": {
"application": {
"function": {
"cases": {
"typeName": "hydra.core.model.Type",
"default": {"typeApplication": {"body": {"list": []}, "type": {"variable": "hydra.core.model.Binding"}}},
"cases": [
{
"name": "record",
"handler": {
"lambda": {
"parameter": "fts",
"domain": {"list": {"variable": "hydra.core.model.FieldType"}},
"body": {
"application": {
"function": {
"typeApplication": {"body": {"variable": "hydra.core.lib.lists.concat"}, "type": {"variable": "hydra.core.model.Binding"}}},
"argument": {
"list": [
{
"list": [
{
"application": {
"function": {
"application": {"function": {"variable": "hydra.core.dsls.generateTypeNameToken"}, "argument": {"variable": "rawType"}}},
"argument": {"variable": "typeName"}}}]},
{
"application": {
"function": {
"application": {"function": {"variable": "hydra.core.dsls.generateParametricRefBuilders"}, "argument": {"variable": "rawType"}}},
"argument": {"variable": "typeName"}}},
{
"application": {
"function": {
"application": {
"function": {
"application": {"function": {"variable": "hydra.core.dsls.generateRecordConstructor"}, "argument": {"variable": "rawType"}}},
"argument": {"variable": "typeName"}}},
"argument": {"variable": "fts"}}},
{
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.model.FieldType"}}},
"type": {"variable": "hydra.core.model.Binding"}}},
"argument": {
"application": {
"function": {
"application": {"function": {"variable": "hydra.core.dsls.generateRecordAccessor"}, "argument": {"variable": "rawType"}}},
"argument": {"variable": "typeName"}}}}},
"argument": {"variable": "fts"}}},
{
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.model.FieldType"}}},
"type": {"variable": "hydra.core.model.Binding"}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"application": {"function": {"variable": "hydra.core.dsls.generateRecordWithUpdater"}, "argument": {"variable": "rawType"}}},
"argument": {"variable": "typeName"}}},
"argument": {"variable": "fts"}}}}},
"argument": {"variable": "fts"}}}]}}}}}},
{
"name": "union",
"handler": {
"lambda": {
"parameter": "fts",
"domain": {"list": {"variable": "hydra.core.model.FieldType"}},
"body": {
"application": {
"function": {
"typeApplication": {"body": {"variable": "hydra.core.lib.lists.concat"}, "type": {"variable": "hydra.core.model.Binding"}}},
"argument": {
"list": [
{
"list": [
{
"application": {
"function": {
"application": {"function": {"variable": "hydra.core.dsls.generateTypeNameToken"}, "argument": {"variable": "rawType"}}},
"argument": {"variable": "typeName"}}}]},
{
"application": {
"function": {
"application": {"function": {"variable": "hydra.core.dsls.generateParametricRefBuilders"}, "argument": {"variable": "rawType"}}},
"argument": {"variable": "typeName"}}},
{
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.model.FieldType"}}},
"type": {"variable": "hydra.core.model.Binding"}}},
"argument": {
"application": {
"function": {
"application": {"function": {"variable": "hydra.core.dsls.generateUnionInjector"}, "argument": {"variable": "rawType"}}},
"argument": {"variable": "typeName"}}}}},
"argument": {"variable": "fts"}}}]}}}}}},
{
"name": "wrap",
"handler": {
"lambda": {
"parameter": "innerType",
"domain": {"variable": "hydra.core.model.Type"},
"body": {
"application": {
"function": {
"typeApplication": {"body": {"variable": "hydra.core.lib.lists.concat"}, "type": {"variable": "hydra.core.model.Binding"}}},
"argument": {
"list": [
{
"list": [
{
"application": {
"function": {
"application": {"function": {"variable": "hydra.core.dsls.generateTypeNameToken"}, "argument": {"variable": "rawType"}}},
"argument": {"variable": "typeName"}}}]},
{
"application": {
"function": {
"application": {"function": {"variable": "hydra.core.dsls.generateParametricRefBuilders"}, "argument": {"variable": "rawType"}}},
"argument": {"variable": "typeName"}}},
{
"application": {
"function": {
"application": {
"function": {
"application": {"function": {"variable": "hydra.core.dsls.generateWrappedTypeAccessors"}, "argument": {"variable": "rawType"}}},
"argument": {"variable": "typeName"}}},
"argument": {"variable": "innerType"}}}]}}}}}}]}},
"argument": {"variable": "typ"}}}}},
"type": {"variable": "hydra.core.errors.DecodingError"}}},
"type": {"list": {"variable": "hydra.core.model.Binding"}}}}}}}}}}}}}}}}}},
"annotation": {
"map": [{"key": {"variable": "description"}, "value": {"literal": {"string": "Generate all DSL bindings for a type binding"}}}]}}}}}}},
{
"term": {
"name": "hydra.core.dsls.generateParametricRefBuilders",
"signature": {
"typeParameters": [],
"parameters": [
{"name": "arg0", "type": {"variable": "hydra.core.model.Type"}, "isLazy": false},
{"name": "arg1", "type": {"variable": "hydra.core.model.Name"}, "isLazy": false}],
"result": {"type": {"list": {"variable": "hydra.core.model.Binding"}}}},
"body": {
"annotated": {
"body": {
"lambda": {
"parameter": "origType",
"domain": {"variable": "hydra.core.model.Type"},
"body": {
"lambda": {
"parameter": "typeName",
"domain": {"variable": "hydra.core.model.Name"},
"body": {
"let": {
"bindings": [
{
"name": "vars",
"term": {"application": {"function": {"variable": "hydra.core.dsls.collectForallVars"}, "argument": {"variable": "origType"}}},
"typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Name"}}, "constraints": []}}],
"body": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {"body": {"variable": "hydra.core.lib.logic.ifElse"}, "type": {"list": {"variable": "hydra.core.model.Binding"}}}},
"argument": {
"application": {
"function": {
"typeApplication": {"body": {"variable": "hydra.core.lib.lists.isEmpty"}, "type": {"variable": "hydra.core.model.Name"}}},
"argument": {"variable": "vars"}}}}},
"argument": {"typeApplication": {"body": {"list": []}, "type": {"variable": "hydra.core.model.Binding"}}}}},
"argument": {
"list": [
{
"let": {
"bindings": [
{
"name": "vars",
"term": {"application": {"function": {"variable": "hydra.core.dsls.collectForallVars"}, "argument": {"variable": "origType"}}},
"typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Name"}}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "localName",
"term": {"application": {"function": {"variable": "hydra.core.names.localNameOf"}, "argument": {"variable": "typeName"}}},
"typeScheme": {"variables": [], "body": {"literal": "string"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "builderLocalName",
"term": {
"application": {
"function": {"variable": "hydra.core.lib.strings.concat"},
"argument": {"list": [{"literal": {"string": "encode"}}, {"variable": "localName"}]}}},
"typeScheme": {"variables": [], "body": {"literal": "string"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "builderName",
"term": {
"application": {
"function": {"application": {"function": {"variable": "hydra.core.dsls.dslDefinitionName"}, "argument": {"variable": "typeName"}}},
"argument": {"variable": "builderLocalName"}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Name"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "refName",
"term": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.names.derivedBindingName"}, "type": {"literal": "boolean"}}},
"argument": {"list": [{"literal": {"string": "encode"}}]}}},
"argument": {"literal": {"boolean": true}}}},
"argument": {"variable": "typeName"}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Name"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "paramPairs",
"term": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.model.Name"}}},
"type": {"pair": {"first": {"literal": "string"}, "second": {"variable": "hydra.core.model.Type"}}}}},
"argument": {
"lambda": {
"parameter": "v",
"domain": {"variable": "hydra.core.model.Name"},
"body": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {
"pair": {
"first": {"application": {"function": {"unwrap": "hydra.core.model.Name"}, "argument": {"variable": "v"}}},
"second": {
"inject": {
"typeName": "hydra.core.model.Type",
"field": {
"name": "application",
"term": {
"record": {
"typeName": "hydra.core.model.ApplicationType",
"fields": [
{
"name": "function",
"term": {
"inject": {
"typeName": "hydra.core.model.Type",
"field": {
"name": "variable",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.typed.TypedTerm"}}}}}}}},
{
"name": "argument",
"term": {
"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": "v"}}}}},
{
"name": "codomain",
"term": {
"inject": {
"typeName": "hydra.core.model.Type",
"field": {
"name": "variable",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.model.Term"}}}}}}}}]}}}}}}]}}}}}}},
"type": {"literal": "string"}}},
"type": {"variable": "hydra.core.model.Type"}}}}}}},
"argument": {"variable": "vars"}}},
"typeScheme": {
"variables": [],
"body": {"list": {"pair": {"first": {"literal": "string"}, "second": {"variable": "hydra.core.model.Type"}}}},
"constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "appBody",
"term": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.foldl"}, "type": {"variable": "hydra.core.model.Term"}}},
"type": {"pair": {"first": {"literal": "string"}, "second": {"variable": "hydra.core.model.Type"}}}}},
"argument": {
"lambda": {
"parameter": "acc",
"domain": {"variable": "hydra.core.model.Term"},
"body": {
"lambda": {
"parameter": "pp",
"domain": {"pair": {"first": {"literal": "string"}, "second": {"variable": "hydra.core.model.Type"}}},
"body": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "inject",
"term": {
"record": {
"typeName": "hydra.core.model.Injection",
"fields": [
{
"name": "typeName",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.model.Term"}}}}},
{
"name": "field",
"term": {
"record": {
"typeName": "hydra.core.model.Field",
"fields": [
{
"name": "name",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "application"}}}}},
{
"name": "term",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "record",
"term": {
"record": {
"typeName": "hydra.core.model.Record",
"fields": [
{
"name": "typeName",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.model.Application"}}}}},
{
"name": "fields",
"term": {
"list": [
{
"record": {
"typeName": "hydra.core.model.Field",
"fields": [
{"name": "name", "term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "function"}}}}},
{"name": "term", "term": {"variable": "acc"}}]}},
{
"record": {
"typeName": "hydra.core.model.Field",
"fields": [
{"name": "name", "term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "argument"}}}}},
{
"name": "term",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "application",
"term": {
"record": {
"typeName": "hydra.core.model.Application",
"fields": [
{
"name": "function",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "unwrap",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.typed.TypedTerm"}}}}}}}},
{
"name": "argument",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "variable",
"term": {
"wrap": {
"typeName": "hydra.core.model.Name",
"body": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"literal": "string"}}},
"type": {"variable": "hydra.core.model.Type"}}},
"argument": {"variable": "pp"}}}}}}}}}]}}}}}}]}}]}}]}}}}}}]}}}]}}}}}}}}}}},
"argument": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "inject",
"term": {
"record": {
"typeName": "hydra.core.model.Injection",
"fields": [
{
"name": "typeName",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.model.Term"}}}}},
{
"name": "field",
"term": {
"record": {
"typeName": "hydra.core.model.Field",
"fields": [
{"name": "name", "term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "variable"}}}}},
{
"name": "term",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "wrap",
"term": {
"record": {
"typeName": "hydra.core.model.WrappedTerm",
"fields": [
{
"name": "typeName",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.model.Name"}}}}},
{
"name": "body",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "literal",
"term": {
"inject": {
"typeName": "hydra.core.model.Literal",
"field": {
"name": "string",
"term": {"application": {"function": {"unwrap": "hydra.core.model.Name"}, "argument": {"variable": "refName"}}}}}}}}}}]}}}}}}]}}}]}}}}}}},
"argument": {"variable": "paramPairs"}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "builderTerm",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "wrap",
"term": {
"record": {
"typeName": "hydra.core.model.WrappedTerm",
"fields": [
{
"name": "typeName",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.typed.TypedTerm"}}}}},
{"name": "body", "term": {"variable": "appBody"}}]}}}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "rawBody",
"term": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.foldl"}, "type": {"variable": "hydra.core.model.Term"}}},
"type": {"pair": {"first": {"literal": "string"}, "second": {"variable": "hydra.core.model.Type"}}}}},
"argument": {
"lambda": {
"parameter": "acc",
"domain": {"variable": "hydra.core.model.Term"},
"body": {
"lambda": {
"parameter": "pp",
"domain": {"pair": {"first": {"literal": "string"}, "second": {"variable": "hydra.core.model.Type"}}},
"body": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "lambda",
"term": {
"record": {
"typeName": "hydra.core.model.Lambda",
"fields": [
{
"name": "parameter",
"term": {
"wrap": {
"typeName": "hydra.core.model.Name",
"body": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"literal": "string"}}},
"type": {"variable": "hydra.core.model.Type"}}},
"argument": {"variable": "pp"}}}}}},
{
"name": "domain",
"term": {
"optional": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"literal": "string"}}},
"type": {"variable": "hydra.core.model.Type"}}},
"argument": {"variable": "pp"}}}}},
{"name": "body", "term": {"variable": "acc"}}]}}}}}}}}}}},
"argument": {"variable": "builderTerm"}}},
"argument": {
"application": {
"function": {
"typeApplication": {
"body": {"variable": "hydra.core.lib.lists.reverse"},
"type": {"pair": {"first": {"literal": "string"}, "second": {"variable": "hydra.core.model.Type"}}}}},
"argument": {"variable": "paramPairs"}}}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "description",
"term": {
"application": {
"function": {"variable": "hydra.core.lib.strings.concat"},
"argument": {
"list": [
{"literal": {"string": "DSL composition builder for the "}},
{"literal": {"string": "encode"}},
{"literal": {"string": "r of "}},
{"application": {"function": {"unwrap": "hydra.core.model.Name"}, "argument": {"variable": "typeName"}}}]}}},
"typeScheme": {"variables": [], "body": {"literal": "string"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "body",
"term": {
"application": {
"function": {
"application": {
"function": {"variable": "hydra.core.annotations.setTermDescription"},
"argument": {"optional": {"variable": "description"}}}},
"argument": {"variable": "rawBody"}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "resultType",
"term": {
"application": {
"function": {"application": {"function": {"variable": "hydra.core.dsls.nominalResultType"}, "argument": {"variable": "typeName"}}},
"argument": {"variable": "origType"}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "paramTypes",
"term": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.model.Name"}}},
"type": {"variable": "hydra.core.model.Type"}}},
"argument": {
"lambda": {
"parameter": "v",
"domain": {"variable": "hydra.core.model.Name"},
"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": "v"}}}}},
{
"name": "codomain",
"term": {
"inject": {
"typeName": "hydra.core.model.Type",
"field": {
"name": "variable",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.model.Term"}}}}}}}}]}}}}}}}}},
"argument": {"variable": "vars"}}},
"typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Type"}}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "ts",
"term": {
"application": {
"function": {
"application": {
"function": {"application": {"function": {"variable": "hydra.core.dsls.dslTypeScheme"}, "argument": {"variable": "origType"}}},
"argument": {"variable": "paramTypes"}}},
"argument": {
"inject": {
"typeName": "hydra.core.model.Type",
"field": {
"name": "function",
"term": {
"record": {
"typeName": "hydra.core.model.FunctionType",
"fields": [
{"name": "domain", "term": {"variable": "resultType"}},
{
"name": "codomain",
"term": {
"inject": {
"typeName": "hydra.core.model.Type",
"field": {
"name": "variable",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.model.Term"}}}}}}}}]}}}}}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.TypeScheme"}, "constraints": []}}],
"body": {
"record": {
"typeName": "hydra.core.model.Binding",
"fields": [
{"name": "name", "term": {"variable": "builderName"}},
{"name": "term", "term": {"variable": "body"}},
{"name": "typeScheme", "term": {"optional": {"variable": "ts"}}}]}}}}}}}}}}}}}}}}}}}}}}}}}}}}}},
{
"let": {
"bindings": [
{
"name": "vars",
"term": {"application": {"function": {"variable": "hydra.core.dsls.collectForallVars"}, "argument": {"variable": "origType"}}},
"typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Name"}}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "localName",
"term": {"application": {"function": {"variable": "hydra.core.names.localNameOf"}, "argument": {"variable": "typeName"}}},
"typeScheme": {"variables": [], "body": {"literal": "string"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "builderLocalName",
"term": {
"application": {
"function": {"variable": "hydra.core.lib.strings.concat"},
"argument": {"list": [{"literal": {"string": "decode"}}, {"variable": "localName"}]}}},
"typeScheme": {"variables": [], "body": {"literal": "string"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "builderName",
"term": {
"application": {
"function": {"application": {"function": {"variable": "hydra.core.dsls.dslDefinitionName"}, "argument": {"variable": "typeName"}}},
"argument": {"variable": "builderLocalName"}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Name"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "refName",
"term": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.names.derivedBindingName"}, "type": {"literal": "boolean"}}},
"argument": {"list": [{"literal": {"string": "decode"}}]}}},
"argument": {"literal": {"boolean": true}}}},
"argument": {"variable": "typeName"}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Name"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "paramPairs",
"term": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.model.Name"}}},
"type": {"pair": {"first": {"literal": "string"}, "second": {"variable": "hydra.core.model.Type"}}}}},
"argument": {
"lambda": {
"parameter": "v",
"domain": {"variable": "hydra.core.model.Name"},
"body": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {
"pair": {
"first": {"application": {"function": {"unwrap": "hydra.core.model.Name"}, "argument": {"variable": "v"}}},
"second": {
"inject": {
"typeName": "hydra.core.model.Type",
"field": {
"name": "application",
"term": {
"record": {
"typeName": "hydra.core.model.ApplicationType",
"fields": [
{
"name": "function",
"term": {
"inject": {
"typeName": "hydra.core.model.Type",
"field": {
"name": "variable",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.typed.TypedTerm"}}}}}}}},
{
"name": "argument",
"term": {
"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": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.graph.Graph"}}}}}}}},
{
"name": "codomain",
"term": {
"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": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.model.Term"}}}}}}}},
{
"name": "codomain",
"term": {
"inject": {
"typeName": "hydra.core.model.Type",
"field": {
"name": "either",
"term": {
"record": {
"typeName": "hydra.core.model.EitherType",
"fields": [
{
"name": "left",
"term": {
"inject": {
"typeName": "hydra.core.model.Type",
"field": {
"name": "variable",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.errors.DecodingError"}}}}}}}},
{
"name": "right",
"term": {"inject": {"typeName": "hydra.core.model.Type", "field": {"name": "variable", "term": {"variable": "v"}}}}}]}}}}}}]}}}}}}]}}}}}}]}}}}}}},
"type": {"literal": "string"}}},
"type": {"variable": "hydra.core.model.Type"}}}}}}},
"argument": {"variable": "vars"}}},
"typeScheme": {
"variables": [],
"body": {"list": {"pair": {"first": {"literal": "string"}, "second": {"variable": "hydra.core.model.Type"}}}},
"constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "appBody",
"term": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.foldl"}, "type": {"variable": "hydra.core.model.Term"}}},
"type": {"pair": {"first": {"literal": "string"}, "second": {"variable": "hydra.core.model.Type"}}}}},
"argument": {
"lambda": {
"parameter": "acc",
"domain": {"variable": "hydra.core.model.Term"},
"body": {
"lambda": {
"parameter": "pp",
"domain": {"pair": {"first": {"literal": "string"}, "second": {"variable": "hydra.core.model.Type"}}},
"body": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "inject",
"term": {
"record": {
"typeName": "hydra.core.model.Injection",
"fields": [
{
"name": "typeName",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.model.Term"}}}}},
{
"name": "field",
"term": {
"record": {
"typeName": "hydra.core.model.Field",
"fields": [
{
"name": "name",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "application"}}}}},
{
"name": "term",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "record",
"term": {
"record": {
"typeName": "hydra.core.model.Record",
"fields": [
{
"name": "typeName",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.model.Application"}}}}},
{
"name": "fields",
"term": {
"list": [
{
"record": {
"typeName": "hydra.core.model.Field",
"fields": [
{"name": "name", "term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "function"}}}}},
{"name": "term", "term": {"variable": "acc"}}]}},
{
"record": {
"typeName": "hydra.core.model.Field",
"fields": [
{"name": "name", "term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "argument"}}}}},
{
"name": "term",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "application",
"term": {
"record": {
"typeName": "hydra.core.model.Application",
"fields": [
{
"name": "function",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "unwrap",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.typed.TypedTerm"}}}}}}}},
{
"name": "argument",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "variable",
"term": {
"wrap": {
"typeName": "hydra.core.model.Name",
"body": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"literal": "string"}}},
"type": {"variable": "hydra.core.model.Type"}}},
"argument": {"variable": "pp"}}}}}}}}}]}}}}}}]}}]}}]}}}}}}]}}}]}}}}}}}}}}},
"argument": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "inject",
"term": {
"record": {
"typeName": "hydra.core.model.Injection",
"fields": [
{
"name": "typeName",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.model.Term"}}}}},
{
"name": "field",
"term": {
"record": {
"typeName": "hydra.core.model.Field",
"fields": [
{"name": "name", "term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "variable"}}}}},
{
"name": "term",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "wrap",
"term": {
"record": {
"typeName": "hydra.core.model.WrappedTerm",
"fields": [
{
"name": "typeName",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.model.Name"}}}}},
{
"name": "body",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "literal",
"term": {
"inject": {
"typeName": "hydra.core.model.Literal",
"field": {
"name": "string",
"term": {"application": {"function": {"unwrap": "hydra.core.model.Name"}, "argument": {"variable": "refName"}}}}}}}}}}]}}}}}}]}}}]}}}}}}},
"argument": {"variable": "paramPairs"}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "builderTerm",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "wrap",
"term": {
"record": {
"typeName": "hydra.core.model.WrappedTerm",
"fields": [
{
"name": "typeName",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.typed.TypedTerm"}}}}},
{"name": "body", "term": {"variable": "appBody"}}]}}}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "rawBody",
"term": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.foldl"}, "type": {"variable": "hydra.core.model.Term"}}},
"type": {"pair": {"first": {"literal": "string"}, "second": {"variable": "hydra.core.model.Type"}}}}},
"argument": {
"lambda": {
"parameter": "acc",
"domain": {"variable": "hydra.core.model.Term"},
"body": {
"lambda": {
"parameter": "pp",
"domain": {"pair": {"first": {"literal": "string"}, "second": {"variable": "hydra.core.model.Type"}}},
"body": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "lambda",
"term": {
"record": {
"typeName": "hydra.core.model.Lambda",
"fields": [
{
"name": "parameter",
"term": {
"wrap": {
"typeName": "hydra.core.model.Name",
"body": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"literal": "string"}}},
"type": {"variable": "hydra.core.model.Type"}}},
"argument": {"variable": "pp"}}}}}},
{
"name": "domain",
"term": {
"optional": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"literal": "string"}}},
"type": {"variable": "hydra.core.model.Type"}}},
"argument": {"variable": "pp"}}}}},
{"name": "body", "term": {"variable": "acc"}}]}}}}}}}}}}},
"argument": {"variable": "builderTerm"}}},
"argument": {
"application": {
"function": {
"typeApplication": {
"body": {"variable": "hydra.core.lib.lists.reverse"},
"type": {"pair": {"first": {"literal": "string"}, "second": {"variable": "hydra.core.model.Type"}}}}},
"argument": {"variable": "paramPairs"}}}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "description",
"term": {
"application": {
"function": {"variable": "hydra.core.lib.strings.concat"},
"argument": {
"list": [
{"literal": {"string": "DSL composition builder for the "}},
{"literal": {"string": "decode"}},
{"literal": {"string": "r of "}},
{"application": {"function": {"unwrap": "hydra.core.model.Name"}, "argument": {"variable": "typeName"}}}]}}},
"typeScheme": {"variables": [], "body": {"literal": "string"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "body",
"term": {
"application": {
"function": {
"application": {
"function": {"variable": "hydra.core.annotations.setTermDescription"},
"argument": {"optional": {"variable": "description"}}}},
"argument": {"variable": "rawBody"}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "resultType",
"term": {
"application": {
"function": {"application": {"function": {"variable": "hydra.core.dsls.nominalResultType"}, "argument": {"variable": "typeName"}}},
"argument": {"variable": "origType"}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "paramTypes",
"term": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.model.Name"}}},
"type": {"variable": "hydra.core.model.Type"}}},
"argument": {
"lambda": {
"parameter": "v",
"domain": {"variable": "hydra.core.model.Name"},
"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": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.graph.Graph"}}}}}}}},
{
"name": "codomain",
"term": {
"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": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.model.Term"}}}}}}}},
{
"name": "codomain",
"term": {
"inject": {
"typeName": "hydra.core.model.Type",
"field": {
"name": "either",
"term": {
"record": {
"typeName": "hydra.core.model.EitherType",
"fields": [
{
"name": "left",
"term": {
"inject": {
"typeName": "hydra.core.model.Type",
"field": {
"name": "variable",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.errors.DecodingError"}}}}}}}},
{
"name": "right",
"term": {"inject": {"typeName": "hydra.core.model.Type", "field": {"name": "variable", "term": {"variable": "v"}}}}}]}}}}}}]}}}}}}]}}}}}}}}},
"argument": {"variable": "vars"}}},
"typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Type"}}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "ts",
"term": {
"application": {
"function": {
"application": {
"function": {"application": {"function": {"variable": "hydra.core.dsls.dslTypeScheme"}, "argument": {"variable": "origType"}}},
"argument": {"variable": "paramTypes"}}},
"argument": {
"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": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.graph.Graph"}}}}}}}},
{
"name": "codomain",
"term": {
"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": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.model.Term"}}}}}}}},
{
"name": "codomain",
"term": {
"inject": {
"typeName": "hydra.core.model.Type",
"field": {
"name": "either",
"term": {
"record": {
"typeName": "hydra.core.model.EitherType",
"fields": [
{
"name": "left",
"term": {
"inject": {
"typeName": "hydra.core.model.Type",
"field": {
"name": "variable",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.errors.DecodingError"}}}}}}}},
{"name": "right", "term": {"variable": "resultType"}}]}}}}}}]}}}}}}]}}}}}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.TypeScheme"}, "constraints": []}}],
"body": {
"record": {
"typeName": "hydra.core.model.Binding",
"fields": [
{"name": "name", "term": {"variable": "builderName"}},
{"name": "term", "term": {"variable": "body"}},
{"name": "typeScheme", "term": {"optional": {"variable": "ts"}}}]}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}]}}}}}}}}},
"annotation": {
"map": [
{
"key": {"variable": "description"},
"value": {"literal": {"string": "Generate encode/decode composition builders for a parametric type definition"}}}]}}}}},
{
"term": {
"name": "hydra.core.dsls.generateRecordAccessor",
"signature": {
"typeParameters": [],
"parameters": [
{"name": "arg0", "type": {"variable": "hydra.core.model.Type"}, "isLazy": false},
{"name": "arg1", "type": {"variable": "hydra.core.model.Name"}, "isLazy": false},
{"name": "arg2", "type": {"variable": "hydra.core.model.FieldType"}, "isLazy": false}],
"result": {"type": {"variable": "hydra.core.model.Binding"}}},
"body": {
"annotated": {
"body": {
"lambda": {
"parameter": "origType",
"domain": {"variable": "hydra.core.model.Type"},
"body": {
"lambda": {
"parameter": "typeName",
"domain": {"variable": "hydra.core.model.Name"},
"body": {
"lambda": {
"parameter": "ft",
"domain": {"variable": "hydra.core.model.FieldType"},
"body": {
"let": {
"bindings": [
{
"name": "fieldName",
"term": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.FieldType", "fieldName": "name"}},
"argument": {"variable": "ft"}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Name"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "accessorLocalName",
"term": {
"application": {
"function": {"variable": "hydra.core.lib.strings.concat"},
"argument": {
"list": [
{
"application": {
"function": {"variable": "hydra.core.formatting.decapitalize"},
"argument": {"application": {"function": {"variable": "hydra.core.names.localNameOf"}, "argument": {"variable": "typeName"}}}}},
{
"application": {
"function": {"application": {"function": {"variable": "hydra.core.lib.strings.join"}, "argument": {"literal": {"string": ""}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"literal": "string"}}},
"type": {"literal": "string"}}},
"argument": {
"lambda": {
"parameter": "s",
"domain": {"literal": "string"},
"body": {"application": {"function": {"variable": "hydra.core.formatting.capitalize"}, "argument": {"variable": "s"}}}}}}},
"argument": {
"application": {
"function": {"application": {"function": {"variable": "hydra.core.lib.strings.splitOn"}, "argument": {"literal": {"string": "."}}}},
"argument": {"application": {"function": {"unwrap": "hydra.core.model.Name"}, "argument": {"variable": "fieldName"}}}}}}}}}]}}},
"typeScheme": {"variables": [], "body": {"literal": "string"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "accessorName",
"term": {
"application": {
"function": {"application": {"function": {"variable": "hydra.core.dsls.dslDefinitionName"}, "argument": {"variable": "typeName"}}},
"argument": {"variable": "accessorLocalName"}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Name"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "paramDomain",
"term": {
"inject": {
"typeName": "hydra.core.model.Type",
"field": {
"name": "application",
"term": {
"record": {
"typeName": "hydra.core.model.ApplicationType",
"fields": [
{
"name": "function",
"term": {
"inject": {
"typeName": "hydra.core.model.Type",
"field": {
"name": "variable",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.typed.TypedTerm"}}}}}}}},
{
"name": "argument",
"term": {
"application": {
"function": {"application": {"function": {"variable": "hydra.core.dsls.nominalResultType"}, "argument": {"variable": "typeName"}}},
"argument": {"variable": "origType"}}}}]}}}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "rawBody",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "lambda",
"term": {
"record": {
"typeName": "hydra.core.model.Lambda",
"fields": [
{"name": "parameter", "term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "x"}}}}},
{"name": "domain", "term": {"optional": {"variable": "paramDomain"}}},
{
"name": "body",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "wrap",
"term": {
"record": {
"typeName": "hydra.core.model.WrappedTerm",
"fields": [
{
"name": "typeName",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.typed.TypedTerm"}}}}},
{
"name": "body",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "inject",
"term": {
"record": {
"typeName": "hydra.core.model.Injection",
"fields": [
{
"name": "typeName",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.model.Term"}}}}},
{
"name": "field",
"term": {
"record": {
"typeName": "hydra.core.model.Field",
"fields": [
{
"name": "name",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "application"}}}}},
{
"name": "term",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "record",
"term": {
"record": {
"typeName": "hydra.core.model.Record",
"fields": [
{
"name": "typeName",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.model.Application"}}}}},
{
"name": "fields",
"term": {
"list": [
{
"record": {
"typeName": "hydra.core.model.Field",
"fields": [
{"name": "name", "term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "function"}}}}},
{
"name": "term",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "inject",
"term": {
"record": {
"typeName": "hydra.core.model.Injection",
"fields": [
{
"name": "typeName",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.model.Term"}}}}},
{
"name": "field",
"term": {
"record": {
"typeName": "hydra.core.model.Field",
"fields": [
{"name": "name", "term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "project"}}}}},
{
"name": "term",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "record",
"term": {
"record": {
"typeName": "hydra.core.model.Record",
"fields": [
{
"name": "typeName",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.model.Projection"}}}}},
{
"name": "fields",
"term": {
"list": [
{
"record": {
"typeName": "hydra.core.model.Field",
"fields": [
{"name": "name", "term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "typeName"}}}}},
{
"name": "term",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "wrap",
"term": {
"record": {
"typeName": "hydra.core.model.WrappedTerm",
"fields": [
{
"name": "typeName",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.model.Name"}}}}},
{
"name": "body",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "literal",
"term": {
"inject": {
"typeName": "hydra.core.model.Literal",
"field": {
"name": "string",
"term": {"application": {"function": {"unwrap": "hydra.core.model.Name"}, "argument": {"variable": "typeName"}}}}}}}}}}]}}}}}}]}},
{
"record": {
"typeName": "hydra.core.model.Field",
"fields": [
{"name": "name", "term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "fieldName"}}}}},
{
"name": "term",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "wrap",
"term": {
"record": {
"typeName": "hydra.core.model.WrappedTerm",
"fields": [
{
"name": "typeName",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.model.Name"}}}}},
{
"name": "body",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "literal",
"term": {
"inject": {
"typeName": "hydra.core.model.Literal",
"field": {
"name": "string",
"term": {"application": {"function": {"unwrap": "hydra.core.model.Name"}, "argument": {"variable": "fieldName"}}}}}}}}}}]}}}}}}]}}]}}]}}}}}}]}}}]}}}}}}]}},
{
"record": {
"typeName": "hydra.core.model.Field",
"fields": [
{"name": "name", "term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "argument"}}}}},
{
"name": "term",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "application",
"term": {
"record": {
"typeName": "hydra.core.model.Application",
"fields": [
{
"name": "function",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "unwrap",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.typed.TypedTerm"}}}}}}}},
{
"name": "argument",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {"name": "variable", "term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "x"}}}}}}}}]}}}}}}]}}]}}]}}}}}}]}}}]}}}}}}]}}}}}}]}}}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "description",
"term": {
"application": {
"function": {"variable": "hydra.core.lib.strings.concat"},
"argument": {
"list": [
{"literal": {"string": "DSL accessor for the "}},
{"application": {"function": {"unwrap": "hydra.core.model.Name"}, "argument": {"variable": "fieldName"}}},
{"literal": {"string": " field of "}},
{"application": {"function": {"unwrap": "hydra.core.model.Name"}, "argument": {"variable": "typeName"}}}]}}},
"typeScheme": {"variables": [], "body": {"literal": "string"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "body",
"term": {
"application": {
"function": {
"application": {
"function": {"variable": "hydra.core.annotations.setTermDescription"},
"argument": {"optional": {"variable": "description"}}}},
"argument": {"variable": "rawBody"}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "ts",
"term": {
"application": {
"function": {
"application": {
"function": {"application": {"function": {"variable": "hydra.core.dsls.dslTypeScheme"}, "argument": {"variable": "origType"}}},
"argument": {
"list": [
{
"application": {
"function": {"application": {"function": {"variable": "hydra.core.dsls.nominalResultType"}, "argument": {"variable": "typeName"}}},
"argument": {"variable": "origType"}}}]}}},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.FieldType", "fieldName": "type"}},
"argument": {"variable": "ft"}}}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.TypeScheme"}, "constraints": []}}],
"body": {
"record": {
"typeName": "hydra.core.model.Binding",
"fields": [
{"name": "name", "term": {"variable": "accessorName"}},
{"name": "term", "term": {"variable": "body"}},
{"name": "typeScheme", "term": {"optional": {"variable": "ts"}}}]}}}}}}}}}}}}}}}}}}}}}}}},
"annotation": {
"map": [{"key": {"variable": "description"}, "value": {"literal": {"string": "Generate a record field accessor function"}}}]}}}}},
{
"term": {
"name": "hydra.core.dsls.generateRecordConstructor",
"signature": {
"typeParameters": [],
"parameters": [
{"name": "arg0", "type": {"variable": "hydra.core.model.Type"}, "isLazy": false},
{"name": "arg1", "type": {"variable": "hydra.core.model.Name"}, "isLazy": false},
{"name": "arg2", "type": {"list": {"variable": "hydra.core.model.FieldType"}}, "isLazy": false}],
"result": {"type": {"list": {"variable": "hydra.core.model.Binding"}}}},
"body": {
"annotated": {
"body": {
"lambda": {
"parameter": "origType",
"domain": {"variable": "hydra.core.model.Type"},
"body": {
"lambda": {
"parameter": "typeName",
"domain": {"variable": "hydra.core.model.Name"},
"body": {
"lambda": {
"parameter": "fieldTypes",
"domain": {"list": {"variable": "hydra.core.model.FieldType"}},
"body": {
"let": {
"bindings": [
{
"name": "dFields",
"term": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.model.FieldType"}}},
"type": {"variable": "hydra.core.model.Term"}}},
"argument": {
"lambda": {
"parameter": "ft",
"domain": {"variable": "hydra.core.model.FieldType"},
"body": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "record",
"term": {
"record": {
"typeName": "hydra.core.model.Record",
"fields": [
{
"name": "typeName",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.model.Field"}}}}},
{
"name": "fields",
"term": {
"list": [
{
"record": {
"typeName": "hydra.core.model.Field",
"fields": [
{"name": "name", "term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "name"}}}}},
{
"name": "term",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "wrap",
"term": {
"record": {
"typeName": "hydra.core.model.WrappedTerm",
"fields": [
{
"name": "typeName",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.model.Name"}}}}},
{
"name": "body",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "literal",
"term": {
"inject": {
"typeName": "hydra.core.model.Literal",
"field": {
"name": "string",
"term": {
"application": {
"function": {"unwrap": "hydra.core.model.Name"},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.FieldType", "fieldName": "name"}},
"argument": {"variable": "ft"}}}}}}}}}}}}]}}}}}}]}},
{
"record": {
"typeName": "hydra.core.model.Field",
"fields": [
{"name": "name", "term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "term"}}}}},
{
"name": "term",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "application",
"term": {
"record": {
"typeName": "hydra.core.model.Application",
"fields": [
{
"name": "function",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "unwrap",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.typed.TypedTerm"}}}}}}}},
{
"name": "argument",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "variable",
"term": {
"wrap": {
"typeName": "hydra.core.model.Name",
"body": {
"application": {
"function": {"variable": "hydra.core.formatting.decapitalize"},
"argument": {
"application": {
"function": {"variable": "hydra.core.names.localNameOf"},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.FieldType", "fieldName": "name"}},
"argument": {"variable": "ft"}}}}}}}}}}}}}]}}}}}}]}}]}}]}}}}}}}}},
"argument": {"variable": "fieldTypes"}}},
"typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Term"}}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "recordTerm",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "wrap",
"term": {
"record": {
"typeName": "hydra.core.model.WrappedTerm",
"fields": [
{
"name": "typeName",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.typed.TypedTerm"}}}}},
{
"name": "body",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "inject",
"term": {
"record": {
"typeName": "hydra.core.model.Injection",
"fields": [
{
"name": "typeName",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.model.Term"}}}}},
{
"name": "field",
"term": {
"record": {
"typeName": "hydra.core.model.Field",
"fields": [
{"name": "name", "term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "record"}}}}},
{
"name": "term",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "record",
"term": {
"record": {
"typeName": "hydra.core.model.Record",
"fields": [
{
"name": "typeName",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.model.Record"}}}}},
{
"name": "fields",
"term": {
"list": [
{
"record": {
"typeName": "hydra.core.model.Field",
"fields": [
{"name": "name", "term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "typeName"}}}}},
{
"name": "term",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "wrap",
"term": {
"record": {
"typeName": "hydra.core.model.WrappedTerm",
"fields": [
{
"name": "typeName",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.model.Name"}}}}},
{
"name": "body",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "literal",
"term": {
"inject": {
"typeName": "hydra.core.model.Literal",
"field": {
"name": "string",
"term": {"application": {"function": {"unwrap": "hydra.core.model.Name"}, "argument": {"variable": "typeName"}}}}}}}}}}]}}}}}}]}},
{
"record": {
"typeName": "hydra.core.model.Field",
"fields": [
{"name": "name", "term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "fields"}}}}},
{
"name": "term",
"term": {"inject": {"typeName": "hydra.core.model.Term", "field": {"name": "list", "term": {"variable": "dFields"}}}}}]}}]}}]}}}}}}]}}}]}}}}}}]}}}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "paramPairs",
"term": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.model.FieldType"}}},
"type": {"pair": {"first": {"literal": "string"}, "second": {"variable": "hydra.core.model.Type"}}}}},
"argument": {
"lambda": {
"parameter": "ft",
"domain": {"variable": "hydra.core.model.FieldType"},
"body": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {
"pair": {
"first": {
"application": {
"function": {"variable": "hydra.core.formatting.decapitalize"},
"argument": {
"application": {
"function": {"variable": "hydra.core.names.localNameOf"},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.FieldType", "fieldName": "name"}},
"argument": {"variable": "ft"}}}}}}},
"second": {
"inject": {
"typeName": "hydra.core.model.Type",
"field": {
"name": "application",
"term": {
"record": {
"typeName": "hydra.core.model.ApplicationType",
"fields": [
{
"name": "function",
"term": {
"inject": {
"typeName": "hydra.core.model.Type",
"field": {
"name": "variable",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.typed.TypedTerm"}}}}}}}},
{
"name": "argument",
"term": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.FieldType", "fieldName": "type"}},
"argument": {"variable": "ft"}}}}]}}}}}}},
"type": {"literal": "string"}}},
"type": {"variable": "hydra.core.model.Type"}}}}}}},
"argument": {"variable": "fieldTypes"}}},
"typeScheme": {
"variables": [],
"body": {"list": {"pair": {"first": {"literal": "string"}, "second": {"variable": "hydra.core.model.Type"}}}},
"constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "rawBody",
"term": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.foldl"}, "type": {"variable": "hydra.core.model.Term"}}},
"type": {"pair": {"first": {"literal": "string"}, "second": {"variable": "hydra.core.model.Type"}}}}},
"argument": {
"lambda": {
"parameter": "acc",
"domain": {"variable": "hydra.core.model.Term"},
"body": {
"lambda": {
"parameter": "pp",
"domain": {"pair": {"first": {"literal": "string"}, "second": {"variable": "hydra.core.model.Type"}}},
"body": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "lambda",
"term": {
"record": {
"typeName": "hydra.core.model.Lambda",
"fields": [
{
"name": "parameter",
"term": {
"wrap": {
"typeName": "hydra.core.model.Name",
"body": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"literal": "string"}}},
"type": {"variable": "hydra.core.model.Type"}}},
"argument": {"variable": "pp"}}}}}},
{
"name": "domain",
"term": {
"optional": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"literal": "string"}}},
"type": {"variable": "hydra.core.model.Type"}}},
"argument": {"variable": "pp"}}}}},
{"name": "body", "term": {"variable": "acc"}}]}}}}}}}}}}},
"argument": {"variable": "recordTerm"}}},
"argument": {
"application": {
"function": {
"typeApplication": {
"body": {"variable": "hydra.core.lib.lists.reverse"},
"type": {"pair": {"first": {"literal": "string"}, "second": {"variable": "hydra.core.model.Type"}}}}},
"argument": {"variable": "paramPairs"}}}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "description",
"term": {
"application": {
"function": {"variable": "hydra.core.lib.strings.concat"},
"argument": {
"list": [
{"literal": {"string": "DSL constructor for "}},
{"application": {"function": {"unwrap": "hydra.core.model.Name"}, "argument": {"variable": "typeName"}}}]}}},
"typeScheme": {"variables": [], "body": {"literal": "string"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "body",
"term": {
"application": {
"function": {
"application": {
"function": {"variable": "hydra.core.annotations.setTermDescription"},
"argument": {"optional": {"variable": "description"}}}},
"argument": {"variable": "rawBody"}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "paramTypes",
"term": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.model.FieldType"}}},
"type": {"variable": "hydra.core.model.Type"}}},
"argument": {
"lambda": {
"parameter": "ft",
"domain": {"variable": "hydra.core.model.FieldType"},
"body": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.FieldType", "fieldName": "type"}},
"argument": {"variable": "ft"}}}}}}},
"argument": {"variable": "fieldTypes"}}},
"typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Type"}}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "resultType",
"term": {
"application": {
"function": {"application": {"function": {"variable": "hydra.core.dsls.nominalResultType"}, "argument": {"variable": "typeName"}}},
"argument": {"variable": "origType"}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "ts",
"term": {
"application": {
"function": {
"application": {
"function": {"application": {"function": {"variable": "hydra.core.dsls.dslTypeScheme"}, "argument": {"variable": "origType"}}},
"argument": {"variable": "paramTypes"}}},
"argument": {"variable": "resultType"}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.TypeScheme"}, "constraints": []}}],
"body": {
"list": [
{
"record": {
"typeName": "hydra.core.model.Binding",
"fields": [
{
"name": "name",
"term": {"application": {"function": {"variable": "hydra.core.dsls.dslBindingName"}, "argument": {"variable": "typeName"}}}},
{"name": "term", "term": {"variable": "body"}},
{"name": "typeScheme", "term": {"optional": {"variable": "ts"}}}]}}]}}}}}}}}}}}}}}}}}}}}}}}}},
"annotation": {
"map": [{"key": {"variable": "description"}, "value": {"literal": {"string": "Generate a record constructor function"}}}]}}}}},
{
"term": {
"name": "hydra.core.dsls.generateRecordWithUpdater",
"signature": {
"typeParameters": [],
"parameters": [
{"name": "arg0", "type": {"variable": "hydra.core.model.Type"}, "isLazy": false},
{"name": "arg1", "type": {"variable": "hydra.core.model.Name"}, "isLazy": false},
{"name": "arg2", "type": {"list": {"variable": "hydra.core.model.FieldType"}}, "isLazy": false},
{"name": "arg3", "type": {"variable": "hydra.core.model.FieldType"}, "isLazy": false}],
"result": {"type": {"variable": "hydra.core.model.Binding"}}},
"body": {
"annotated": {
"body": {
"lambda": {
"parameter": "origType",
"domain": {"variable": "hydra.core.model.Type"},
"body": {
"lambda": {
"parameter": "typeName",
"domain": {"variable": "hydra.core.model.Name"},
"body": {
"lambda": {
"parameter": "allFields",
"domain": {"list": {"variable": "hydra.core.model.FieldType"}},
"body": {
"lambda": {
"parameter": "targetField",
"domain": {"variable": "hydra.core.model.FieldType"},
"body": {
"let": {
"bindings": [
{
"name": "targetFieldName",
"term": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.FieldType", "fieldName": "name"}},
"argument": {"variable": "targetField"}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Name"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "updaterLocalName",
"term": {
"application": {
"function": {"variable": "hydra.core.lib.strings.concat"},
"argument": {
"list": [
{
"application": {
"function": {"variable": "hydra.core.formatting.decapitalize"},
"argument": {"application": {"function": {"variable": "hydra.core.names.localNameOf"}, "argument": {"variable": "typeName"}}}}},
{"literal": {"string": "With"}},
{
"application": {
"function": {"application": {"function": {"variable": "hydra.core.lib.strings.join"}, "argument": {"literal": {"string": ""}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"literal": "string"}}},
"type": {"literal": "string"}}},
"argument": {
"lambda": {
"parameter": "s",
"domain": {"literal": "string"},
"body": {"application": {"function": {"variable": "hydra.core.formatting.capitalize"}, "argument": {"variable": "s"}}}}}}},
"argument": {
"application": {
"function": {"application": {"function": {"variable": "hydra.core.lib.strings.splitOn"}, "argument": {"literal": {"string": "."}}}},
"argument": {"application": {"function": {"unwrap": "hydra.core.model.Name"}, "argument": {"variable": "targetFieldName"}}}}}}}}}]}}},
"typeScheme": {"variables": [], "body": {"literal": "string"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "updaterName",
"term": {
"application": {
"function": {"application": {"function": {"variable": "hydra.core.dsls.dslDefinitionName"}, "argument": {"variable": "typeName"}}},
"argument": {"variable": "updaterLocalName"}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Name"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "dFields",
"term": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.model.FieldType"}}},
"type": {"variable": "hydra.core.model.Term"}}},
"argument": {
"lambda": {
"parameter": "ft",
"domain": {"variable": "hydra.core.model.FieldType"},
"body": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "record",
"term": {
"record": {
"typeName": "hydra.core.model.Record",
"fields": [
{
"name": "typeName",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.model.Field"}}}}},
{
"name": "fields",
"term": {
"list": [
{
"record": {
"typeName": "hydra.core.model.Field",
"fields": [
{"name": "name", "term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "name"}}}}},
{
"name": "term",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "wrap",
"term": {
"record": {
"typeName": "hydra.core.model.WrappedTerm",
"fields": [
{
"name": "typeName",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.model.Name"}}}}},
{
"name": "body",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "literal",
"term": {
"inject": {
"typeName": "hydra.core.model.Literal",
"field": {
"name": "string",
"term": {
"application": {
"function": {"unwrap": "hydra.core.model.Name"},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.FieldType", "fieldName": "name"}},
"argument": {"variable": "ft"}}}}}}}}}}}}]}}}}}}]}},
{
"record": {
"typeName": "hydra.core.model.Field",
"fields": [
{"name": "name", "term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "term"}}}}},
{
"name": "term",
"term": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {"body": {"variable": "hydra.core.lib.logic.ifElse"}, "type": {"variable": "hydra.core.model.Term"}}},
"argument": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.lib.equality.equal"}, "type": {"literal": "string"}}},
"argument": {
"application": {
"function": {"unwrap": "hydra.core.model.Name"},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.FieldType", "fieldName": "name"}},
"argument": {"variable": "ft"}}}}}}},
"argument": {"application": {"function": {"unwrap": "hydra.core.model.Name"}, "argument": {"variable": "targetFieldName"}}}}}}},
"argument": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "application",
"term": {
"record": {
"typeName": "hydra.core.model.Application",
"fields": [
{
"name": "function",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "unwrap",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.typed.TypedTerm"}}}}}}}},
{
"name": "argument",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {"name": "variable", "term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "newVal"}}}}}}}}]}}}}}}},
"argument": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "inject",
"term": {
"record": {
"typeName": "hydra.core.model.Injection",
"fields": [
{
"name": "typeName",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.model.Term"}}}}},
{
"name": "field",
"term": {
"record": {
"typeName": "hydra.core.model.Field",
"fields": [
{
"name": "name",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "application"}}}}},
{
"name": "term",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "record",
"term": {
"record": {
"typeName": "hydra.core.model.Record",
"fields": [
{
"name": "typeName",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.model.Application"}}}}},
{
"name": "fields",
"term": {
"list": [
{
"record": {
"typeName": "hydra.core.model.Field",
"fields": [
{"name": "name", "term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "function"}}}}},
{
"name": "term",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "inject",
"term": {
"record": {
"typeName": "hydra.core.model.Injection",
"fields": [
{
"name": "typeName",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.model.Term"}}}}},
{
"name": "field",
"term": {
"record": {
"typeName": "hydra.core.model.Field",
"fields": [
{"name": "name", "term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "project"}}}}},
{
"name": "term",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "record",
"term": {
"record": {
"typeName": "hydra.core.model.Record",
"fields": [
{
"name": "typeName",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.model.Projection"}}}}},
{
"name": "fields",
"term": {
"list": [
{
"record": {
"typeName": "hydra.core.model.Field",
"fields": [
{"name": "name", "term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "typeName"}}}}},
{
"name": "term",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "wrap",
"term": {
"record": {
"typeName": "hydra.core.model.WrappedTerm",
"fields": [
{
"name": "typeName",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.model.Name"}}}}},
{
"name": "body",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "literal",
"term": {
"inject": {
"typeName": "hydra.core.model.Literal",
"field": {
"name": "string",
"term": {"application": {"function": {"unwrap": "hydra.core.model.Name"}, "argument": {"variable": "typeName"}}}}}}}}}}]}}}}}}]}},
{
"record": {
"typeName": "hydra.core.model.Field",
"fields": [
{"name": "name", "term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "fieldName"}}}}},
{
"name": "term",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "wrap",
"term": {
"record": {
"typeName": "hydra.core.model.WrappedTerm",
"fields": [
{
"name": "typeName",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.model.Name"}}}}},
{
"name": "body",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "literal",
"term": {
"inject": {
"typeName": "hydra.core.model.Literal",
"field": {
"name": "string",
"term": {
"application": {
"function": {"unwrap": "hydra.core.model.Name"},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.FieldType", "fieldName": "name"}},
"argument": {"variable": "ft"}}}}}}}}}}}}]}}}}}}]}}]}}]}}}}}}]}}}]}}}}}}]}},
{
"record": {
"typeName": "hydra.core.model.Field",
"fields": [
{"name": "name", "term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "argument"}}}}},
{
"name": "term",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "application",
"term": {
"record": {
"typeName": "hydra.core.model.Application",
"fields": [
{
"name": "function",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "unwrap",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.typed.TypedTerm"}}}}}}}},
{
"name": "argument",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "variable",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "original"}}}}}}}}]}}}}}}]}}]}}]}}}}}}]}}}]}}}}}}}}]}}]}}]}}}}}}}}},
"argument": {"variable": "allFields"}}},
"typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Term"}}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "recDomain",
"term": {
"inject": {
"typeName": "hydra.core.model.Type",
"field": {
"name": "application",
"term": {
"record": {
"typeName": "hydra.core.model.ApplicationType",
"fields": [
{
"name": "function",
"term": {
"inject": {
"typeName": "hydra.core.model.Type",
"field": {
"name": "variable",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.typed.TypedTerm"}}}}}}}},
{
"name": "argument",
"term": {
"application": {
"function": {"application": {"function": {"variable": "hydra.core.dsls.nominalResultType"}, "argument": {"variable": "typeName"}}},
"argument": {"variable": "origType"}}}}]}}}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "fieldDomain",
"term": {
"inject": {
"typeName": "hydra.core.model.Type",
"field": {
"name": "application",
"term": {
"record": {
"typeName": "hydra.core.model.ApplicationType",
"fields": [
{
"name": "function",
"term": {
"inject": {
"typeName": "hydra.core.model.Type",
"field": {
"name": "variable",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.typed.TypedTerm"}}}}}}}},
{
"name": "argument",
"term": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.FieldType", "fieldName": "type"}},
"argument": {"variable": "targetField"}}}}]}}}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "rawBody",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "lambda",
"term": {
"record": {
"typeName": "hydra.core.model.Lambda",
"fields": [
{
"name": "parameter",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "original"}}}}},
{"name": "domain", "term": {"optional": {"variable": "recDomain"}}},
{
"name": "body",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "lambda",
"term": {
"record": {
"typeName": "hydra.core.model.Lambda",
"fields": [
{
"name": "parameter",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "newVal"}}}}},
{"name": "domain", "term": {"optional": {"variable": "fieldDomain"}}},
{
"name": "body",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "wrap",
"term": {
"record": {
"typeName": "hydra.core.model.WrappedTerm",
"fields": [
{
"name": "typeName",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.typed.TypedTerm"}}}}},
{
"name": "body",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "inject",
"term": {
"record": {
"typeName": "hydra.core.model.Injection",
"fields": [
{
"name": "typeName",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.model.Term"}}}}},
{
"name": "field",
"term": {
"record": {
"typeName": "hydra.core.model.Field",
"fields": [
{"name": "name", "term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "record"}}}}},
{
"name": "term",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "record",
"term": {
"record": {
"typeName": "hydra.core.model.Record",
"fields": [
{
"name": "typeName",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.model.Record"}}}}},
{
"name": "fields",
"term": {
"list": [
{
"record": {
"typeName": "hydra.core.model.Field",
"fields": [
{"name": "name", "term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "typeName"}}}}},
{
"name": "term",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "wrap",
"term": {
"record": {
"typeName": "hydra.core.model.WrappedTerm",
"fields": [
{
"name": "typeName",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.model.Name"}}}}},
{
"name": "body",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "literal",
"term": {
"inject": {
"typeName": "hydra.core.model.Literal",
"field": {
"name": "string",
"term": {"application": {"function": {"unwrap": "hydra.core.model.Name"}, "argument": {"variable": "typeName"}}}}}}}}}}]}}}}}}]}},
{
"record": {
"typeName": "hydra.core.model.Field",
"fields": [
{"name": "name", "term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "fields"}}}}},
{
"name": "term",
"term": {"inject": {"typeName": "hydra.core.model.Term", "field": {"name": "list", "term": {"variable": "dFields"}}}}}]}}]}}]}}}}}}]}}}]}}}}}}]}}}}}}]}}}}}}]}}}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "description",
"term": {
"application": {
"function": {"variable": "hydra.core.lib.strings.concat"},
"argument": {
"list": [
{"literal": {"string": "DSL updater for the "}},
{"application": {"function": {"unwrap": "hydra.core.model.Name"}, "argument": {"variable": "targetFieldName"}}},
{"literal": {"string": " field of "}},
{"application": {"function": {"unwrap": "hydra.core.model.Name"}, "argument": {"variable": "typeName"}}}]}}},
"typeScheme": {"variables": [], "body": {"literal": "string"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "body",
"term": {
"application": {
"function": {
"application": {
"function": {"variable": "hydra.core.annotations.setTermDescription"},
"argument": {"optional": {"variable": "description"}}}},
"argument": {"variable": "rawBody"}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "recType",
"term": {
"application": {
"function": {"application": {"function": {"variable": "hydra.core.dsls.nominalResultType"}, "argument": {"variable": "typeName"}}},
"argument": {"variable": "origType"}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "ts",
"term": {
"application": {
"function": {
"application": {
"function": {"application": {"function": {"variable": "hydra.core.dsls.dslTypeScheme"}, "argument": {"variable": "origType"}}},
"argument": {
"list": [
{"variable": "recType"},
{
"application": {
"function": {"project": {"typeName": "hydra.core.model.FieldType", "fieldName": "type"}},
"argument": {"variable": "targetField"}}}]}}},
"argument": {"variable": "recType"}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.TypeScheme"}, "constraints": []}}],
"body": {
"record": {
"typeName": "hydra.core.model.Binding",
"fields": [
{"name": "name", "term": {"variable": "updaterName"}},
{"name": "term", "term": {"variable": "body"}},
{"name": "typeScheme", "term": {"optional": {"variable": "ts"}}}]}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}},
"annotation": {
"map": [
{
"key": {"variable": "description"},
"value": {"literal": {"string": "Generate a withXxx record field updater function"}}}]}}}}},
{
"term": {
"name": "hydra.core.dsls.generateRefBindings",
"signature": {
"typeParameters": [{"name": "t0", "constraints": []}],
"parameters": [{"name": "arg0", "type": {"variable": "hydra.core.packaging.Definition"}, "isLazy": false}],
"result": {"type": {"either": {"left": {"variable": "t0"}, "right": {"list": {"variable": "hydra.core.model.Binding"}}}}}},
"body": {
"typeLambda": {
"parameter": "t0",
"body": {
"annotated": {
"body": {
"lambda": {
"parameter": "d",
"domain": {"variable": "hydra.core.packaging.Definition"},
"body": {
"application": {
"function": {
"cases": {
"typeName": "hydra.core.packaging.Definition",
"default": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {"either": {"right": {"typeApplication": {"body": {"list": []}, "type": {"variable": "hydra.core.model.Binding"}}}}},
"type": {"variable": "t0"}}},
"type": {"list": {"variable": "hydra.core.model.Binding"}}}},
"cases": [
{
"name": "type",
"handler": {
"lambda": {
"parameter": "_",
"domain": {"variable": "hydra.core.packaging.TypeDefinition"},
"body": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {"either": {"right": {"typeApplication": {"body": {"list": []}, "type": {"variable": "hydra.core.model.Binding"}}}}},
"type": {"variable": "t0"}}},
"type": {"list": {"variable": "hydra.core.model.Binding"}}}}}}},
{
"name": "term",
"handler": {
"lambda": {
"parameter": "td",
"domain": {"variable": "hydra.core.packaging.TermDefinition"},
"body": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.optionals.match"}, "type": {"variable": "hydra.core.typing.TermSignature"}}},
"type": {"either": {"left": {"variable": "t0"}, "right": {"list": {"variable": "hydra.core.model.Binding"}}}}}},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.packaging.TermDefinition", "fieldName": "signature"}},
"argument": {"variable": "td"}}}}},
"argument": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {"either": {"right": {"typeApplication": {"body": {"list": []}, "type": {"variable": "hydra.core.model.Binding"}}}}},
"type": {"variable": "t0"}}},
"type": {"list": {"variable": "hydra.core.model.Binding"}}}}}},
"argument": {
"lambda": {
"parameter": "sig",
"domain": {"variable": "hydra.core.typing.TermSignature"},
"body": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {"variable": "hydra.core.lib.logic.ifElse"},
"type": {"either": {"left": {"variable": "t0"}, "right": {"list": {"variable": "hydra.core.model.Binding"}}}}}},
"argument": {"application": {"function": {"variable": "hydra.core.dsls.signatureIsVoidFree"}, "argument": {"variable": "sig"}}}}},
"argument": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {
"either": {
"right": {
"list": [
{
"application": {
"function": {
"application": {
"function": {"variable": "hydra.core.dsls.generateSignatureRef"},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.packaging.TermDefinition", "fieldName": "name"}},
"argument": {"variable": "td"}}}}},
"argument": {"variable": "sig"}}}]}}},
"type": {"variable": "t0"}}},
"type": {"list": {"variable": "hydra.core.model.Binding"}}}}}},
"argument": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {"either": {"right": {"typeApplication": {"body": {"list": []}, "type": {"variable": "hydra.core.model.Binding"}}}}},
"type": {"variable": "t0"}}},
"type": {"list": {"variable": "hydra.core.model.Binding"}}}}}}}}}}}}},
{
"name": "primitive",
"handler": {
"lambda": {
"parameter": "pd",
"domain": {"variable": "hydra.core.packaging.PrimitiveDefinition"},
"body": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {"variable": "hydra.core.lib.logic.ifElse"},
"type": {"either": {"left": {"variable": "t0"}, "right": {"list": {"variable": "hydra.core.model.Binding"}}}}}},
"argument": {
"application": {
"function": {"variable": "hydra.core.dsls.signatureIsVoidFree"},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.packaging.PrimitiveDefinition", "fieldName": "signature"}},
"argument": {"variable": "pd"}}}}}}},
"argument": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {
"either": {
"right": {
"list": [
{
"application": {
"function": {
"application": {
"function": {"variable": "hydra.core.dsls.generateSignatureRef"},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.packaging.PrimitiveDefinition", "fieldName": "name"}},
"argument": {"variable": "pd"}}}}},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.packaging.PrimitiveDefinition", "fieldName": "signature"}},
"argument": {"variable": "pd"}}}}}]}}},
"type": {"variable": "t0"}}},
"type": {"list": {"variable": "hydra.core.model.Binding"}}}}}},
"argument": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {"either": {"right": {"typeApplication": {"body": {"list": []}, "type": {"variable": "hydra.core.model.Binding"}}}}},
"type": {"variable": "t0"}}},
"type": {"list": {"variable": "hydra.core.model.Binding"}}}}}}}}}]}},
"argument": {"variable": "d"}}}}},
"annotation": {
"map": [
{
"key": {"variable": "description"},
"value": {"literal": {"string": "Generate typed reference DSL bindings for a primitive (or signature-carrying term) definition"}}}]}}}}}}},
{
"term": {
"name": "hydra.core.dsls.generateSignatureRef",
"signature": {
"typeParameters": [],
"parameters": [
{"name": "arg0", "type": {"variable": "hydra.core.model.Name"}, "isLazy": false},
{"name": "arg1", "type": {"variable": "hydra.core.typing.TermSignature"}, "isLazy": false}],
"result": {"type": {"variable": "hydra.core.model.Binding"}}},
"body": {
"annotated": {
"body": {
"lambda": {
"parameter": "refName",
"domain": {"variable": "hydra.core.model.Name"},
"body": {
"lambda": {
"parameter": "sig",
"domain": {"variable": "hydra.core.typing.TermSignature"},
"body": {
"let": {
"bindings": [
{
"name": "params",
"term": {
"application": {
"function": {"project": {"typeName": "hydra.core.typing.TermSignature", "fieldName": "parameters"}},
"argument": {"variable": "sig"}}},
"typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.typing.Parameter"}}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "paramFlags",
"term": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.typing.Parameter"}}},
"type": {"pair": {"first": {"literal": "string"}, "second": {"literal": "boolean"}}}}},
"argument": {
"lambda": {
"parameter": "p",
"domain": {"variable": "hydra.core.typing.Parameter"},
"body": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {
"pair": {
"first": {
"application": {
"function": {"unwrap": "hydra.core.model.Name"},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.typing.Parameter", "fieldName": "name"}},
"argument": {"variable": "p"}}}}},
"second": {
"application": {
"function": {
"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": {
"cases": {
"typeName": "hydra.core.model.Type",
"default": {"literal": {"boolean": false}},
"cases": [
{
"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.typed.TypedName"}}}}}}}}}]}},
"argument": {
"application": {
"function": {"variable": "hydra.core.strip.deannotateType"},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.ApplicationType", "fieldName": "function"}},
"argument": {"variable": "a"}}}}}}}}}}]}},
"argument": {"application": {"function": {"variable": "hydra.core.strip.deannotateType"}, "argument": {"variable": "t"}}}}}}},
"argument": {
"application": {
"function": {"variable": "hydra.core.strip.deannotateType"},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.typing.Parameter", "fieldName": "type"}},
"argument": {"variable": "p"}}}}}}}}},
"type": {"literal": "string"}}},
"type": {"literal": "boolean"}}}}}}},
"argument": {"variable": "params"}}},
"typeScheme": {
"variables": [],
"body": {"list": {"pair": {"first": {"literal": "string"}, "second": {"literal": "boolean"}}}},
"constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "paramPairs",
"term": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.typing.Parameter"}}},
"type": {"pair": {"first": {"literal": "string"}, "second": {"variable": "hydra.core.model.Type"}}}}},
"argument": {
"lambda": {
"parameter": "p",
"domain": {"variable": "hydra.core.typing.Parameter"},
"body": {
"let": {
"bindings": [
{
"name": "pt",
"term": {
"application": {
"function": {"project": {"typeName": "hydra.core.typing.Parameter", "fieldName": "type"}},
"argument": {"variable": "p"}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
"body": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {
"pair": {
"first": {
"application": {
"function": {"unwrap": "hydra.core.model.Name"},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.typing.Parameter", "fieldName": "name"}},
"argument": {"variable": "p"}}}}},
"second": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {"body": {"variable": "hydra.core.lib.logic.ifElse"}, "type": {"variable": "hydra.core.model.Type"}}},
"argument": {
"application": {
"function": {
"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": {
"cases": {
"typeName": "hydra.core.model.Type",
"default": {"literal": {"boolean": false}},
"cases": [
{
"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.typed.TypedName"}}}}}}}}}]}},
"argument": {
"application": {
"function": {"variable": "hydra.core.strip.deannotateType"},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.ApplicationType", "fieldName": "function"}},
"argument": {"variable": "a"}}}}}}}}}}]}},
"argument": {"application": {"function": {"variable": "hydra.core.strip.deannotateType"}, "argument": {"variable": "t"}}}}}}},
"argument": {"application": {"function": {"variable": "hydra.core.strip.deannotateType"}, "argument": {"variable": "pt"}}}}}}},
"argument": {"variable": "pt"}}},
"argument": {
"inject": {
"typeName": "hydra.core.model.Type",
"field": {
"name": "application",
"term": {
"record": {
"typeName": "hydra.core.model.ApplicationType",
"fields": [
{
"name": "function",
"term": {
"inject": {
"typeName": "hydra.core.model.Type",
"field": {
"name": "variable",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.typed.TypedTerm"}}}}}}}},
{"name": "argument", "term": {"variable": "pt"}}]}}}}}}}}},
"type": {"literal": "string"}}},
"type": {"variable": "hydra.core.model.Type"}}}}}}}}},
"argument": {"variable": "params"}}},
"typeScheme": {
"variables": [],
"body": {"list": {"pair": {"first": {"literal": "string"}, "second": {"variable": "hydra.core.model.Type"}}}},
"constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "appBody",
"term": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.foldl"}, "type": {"variable": "hydra.core.model.Term"}}},
"type": {"pair": {"first": {"literal": "string"}, "second": {"literal": "boolean"}}}}},
"argument": {
"lambda": {
"parameter": "acc",
"domain": {"variable": "hydra.core.model.Term"},
"body": {
"lambda": {
"parameter": "pf",
"domain": {"pair": {"first": {"literal": "string"}, "second": {"literal": "boolean"}}},
"body": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "inject",
"term": {
"record": {
"typeName": "hydra.core.model.Injection",
"fields": [
{
"name": "typeName",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.model.Term"}}}}},
{
"name": "field",
"term": {
"record": {
"typeName": "hydra.core.model.Field",
"fields": [
{
"name": "name",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "application"}}}}},
{
"name": "term",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "record",
"term": {
"record": {
"typeName": "hydra.core.model.Record",
"fields": [
{
"name": "typeName",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.model.Application"}}}}},
{
"name": "fields",
"term": {
"list": [
{
"record": {
"typeName": "hydra.core.model.Field",
"fields": [
{"name": "name", "term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "function"}}}}},
{"name": "term", "term": {"variable": "acc"}}]}},
{
"record": {
"typeName": "hydra.core.model.Field",
"fields": [
{"name": "name", "term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "argument"}}}}},
{
"name": "term",
"term": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {"body": {"variable": "hydra.core.lib.logic.ifElse"}, "type": {"variable": "hydra.core.model.Term"}}},
"argument": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"literal": "string"}}},
"type": {"literal": "boolean"}}},
"argument": {"variable": "pf"}}}}},
"argument": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "inject",
"term": {
"record": {
"typeName": "hydra.core.model.Injection",
"fields": [
{
"name": "typeName",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.model.Term"}}}}},
{
"name": "field",
"term": {
"record": {
"typeName": "hydra.core.model.Field",
"fields": [
{"name": "name", "term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "variable"}}}}},
{
"name": "term",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "application",
"term": {
"record": {
"typeName": "hydra.core.model.Application",
"fields": [
{
"name": "function",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "unwrap",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.typed.TypedName"}}}}}}}},
{
"name": "argument",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "variable",
"term": {
"wrap": {
"typeName": "hydra.core.model.Name",
"body": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"literal": "string"}}},
"type": {"literal": "boolean"}}},
"argument": {"variable": "pf"}}}}}}}}}]}}}}}}]}}}]}}}}}}},
"argument": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "application",
"term": {
"record": {
"typeName": "hydra.core.model.Application",
"fields": [
{
"name": "function",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "unwrap",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.typed.TypedTerm"}}}}}}}},
{
"name": "argument",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "variable",
"term": {
"wrap": {
"typeName": "hydra.core.model.Name",
"body": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"literal": "string"}}},
"type": {"literal": "boolean"}}},
"argument": {"variable": "pf"}}}}}}}}}]}}}}}}}}]}}]}}]}}}}}}]}}}]}}}}}}}}}}},
"argument": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "inject",
"term": {
"record": {
"typeName": "hydra.core.model.Injection",
"fields": [
{
"name": "typeName",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.model.Term"}}}}},
{
"name": "field",
"term": {
"record": {
"typeName": "hydra.core.model.Field",
"fields": [
{"name": "name", "term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "variable"}}}}},
{
"name": "term",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "wrap",
"term": {
"record": {
"typeName": "hydra.core.model.WrappedTerm",
"fields": [
{
"name": "typeName",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.model.Name"}}}}},
{
"name": "body",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "literal",
"term": {
"inject": {
"typeName": "hydra.core.model.Literal",
"field": {
"name": "string",
"term": {"application": {"function": {"unwrap": "hydra.core.model.Name"}, "argument": {"variable": "refName"}}}}}}}}}}]}}}}}}]}}}]}}}}}}},
"argument": {"variable": "paramFlags"}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "refTerm",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "wrap",
"term": {
"record": {
"typeName": "hydra.core.model.WrappedTerm",
"fields": [
{
"name": "typeName",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.typed.TypedTerm"}}}}},
{"name": "body", "term": {"variable": "appBody"}}]}}}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "rawBody",
"term": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.foldl"}, "type": {"variable": "hydra.core.model.Term"}}},
"type": {"pair": {"first": {"literal": "string"}, "second": {"variable": "hydra.core.model.Type"}}}}},
"argument": {
"lambda": {
"parameter": "acc",
"domain": {"variable": "hydra.core.model.Term"},
"body": {
"lambda": {
"parameter": "pp",
"domain": {"pair": {"first": {"literal": "string"}, "second": {"variable": "hydra.core.model.Type"}}},
"body": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "lambda",
"term": {
"record": {
"typeName": "hydra.core.model.Lambda",
"fields": [
{
"name": "parameter",
"term": {
"wrap": {
"typeName": "hydra.core.model.Name",
"body": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"literal": "string"}}},
"type": {"variable": "hydra.core.model.Type"}}},
"argument": {"variable": "pp"}}}}}},
{
"name": "domain",
"term": {
"optional": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"literal": "string"}}},
"type": {"variable": "hydra.core.model.Type"}}},
"argument": {"variable": "pp"}}}}},
{"name": "body", "term": {"variable": "acc"}}]}}}}}}}}}}},
"argument": {"variable": "refTerm"}}},
"argument": {
"application": {
"function": {
"typeApplication": {
"body": {"variable": "hydra.core.lib.lists.reverse"},
"type": {"pair": {"first": {"literal": "string"}, "second": {"variable": "hydra.core.model.Type"}}}}},
"argument": {"variable": "paramPairs"}}}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "description",
"term": {
"application": {
"function": {"variable": "hydra.core.lib.strings.concat"},
"argument": {
"list": [
{"literal": {"string": "DSL reference to "}},
{"application": {"function": {"unwrap": "hydra.core.model.Name"}, "argument": {"variable": "refName"}}}]}}},
"typeScheme": {"variables": [], "body": {"literal": "string"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "body",
"term": {
"application": {
"function": {
"application": {
"function": {"variable": "hydra.core.annotations.setTermDescription"},
"argument": {"optional": {"variable": "description"}}}},
"argument": {"variable": "rawBody"}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "ts",
"term": {"application": {"function": {"variable": "hydra.core.dsls.dslSignatureTypeScheme"}, "argument": {"variable": "sig"}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.TypeScheme"}, "constraints": []}}],
"body": {
"record": {
"typeName": "hydra.core.model.Binding",
"fields": [
{
"name": "name",
"term": {
"application": {
"function": {"application": {"function": {"variable": "hydra.core.dsls.dslDefinitionName"}, "argument": {"variable": "refName"}}},
"argument": {"application": {"function": {"variable": "hydra.core.names.localNameOf"}, "argument": {"variable": "refName"}}}}}},
{"name": "term", "term": {"variable": "body"}},
{"name": "typeScheme", "term": {"optional": {"variable": "ts"}}}]}}}}}}}}}}}}}}}}}}}}}}}},
"annotation": {
"map": [
{
"key": {"variable": "description"},
"value": {"literal": {"string": "Generate a typed-reference DSL wrapper from a term/primitive name and signature"}}}]}}}}},
{
"term": {
"name": "hydra.core.dsls.generateTypeNameToken",
"signature": {
"typeParameters": [],
"parameters": [
{"name": "arg0", "type": {"variable": "hydra.core.model.Type"}, "isLazy": false},
{"name": "arg1", "type": {"variable": "hydra.core.model.Name"}, "isLazy": false}],
"result": {"type": {"variable": "hydra.core.model.Binding"}}},
"body": {
"annotated": {
"body": {
"lambda": {
"parameter": "origType",
"domain": {"variable": "hydra.core.model.Type"},
"body": {
"lambda": {
"parameter": "typeName",
"domain": {"variable": "hydra.core.model.Name"},
"body": {
"let": {
"bindings": [
{
"name": "localName",
"term": {"application": {"function": {"variable": "hydra.core.names.localNameOf"}, "argument": {"variable": "typeName"}}},
"typeScheme": {"variables": [], "body": {"literal": "string"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "tokenLocalName",
"term": {
"application": {
"function": {"variable": "hydra.core.lib.strings.concat"},
"argument": {
"list": [
{"application": {"function": {"variable": "hydra.core.formatting.decapitalize"}, "argument": {"variable": "localName"}}},
{"variable": "localName"}]}}},
"typeScheme": {"variables": [], "body": {"literal": "string"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "tokenName",
"term": {
"application": {
"function": {"application": {"function": {"variable": "hydra.core.dsls.dslDefinitionName"}, "argument": {"variable": "typeName"}}},
"argument": {"variable": "tokenLocalName"}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Name"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "description",
"term": {
"application": {
"function": {"variable": "hydra.core.lib.strings.concat"},
"argument": {
"list": [
{"literal": {"string": "DSL name token for "}},
{"application": {"function": {"unwrap": "hydra.core.model.Name"}, "argument": {"variable": "typeName"}}}]}}},
"typeScheme": {"variables": [], "body": {"literal": "string"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "body",
"term": {
"application": {
"function": {
"application": {
"function": {"variable": "hydra.core.annotations.setTermDescription"},
"argument": {"optional": {"variable": "description"}}}},
"argument": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "wrap",
"term": {
"record": {
"typeName": "hydra.core.model.WrappedTerm",
"fields": [
{
"name": "typeName",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.typed.TypedName"}}}}},
{
"name": "body",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "wrap",
"term": {
"record": {
"typeName": "hydra.core.model.WrappedTerm",
"fields": [
{
"name": "typeName",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.model.Name"}}}}},
{
"name": "body",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "literal",
"term": {
"inject": {
"typeName": "hydra.core.model.Literal",
"field": {
"name": "string",
"term": {"application": {"function": {"unwrap": "hydra.core.model.Name"}, "argument": {"variable": "typeName"}}}}}}}}}}]}}}}}}]}}}}}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "ts",
"term": {
"record": {
"typeName": "hydra.core.model.TypeScheme",
"fields": [
{
"name": "variables",
"term": {"application": {"function": {"variable": "hydra.core.dsls.collectForallVars"}, "argument": {"variable": "origType"}}}},
{
"name": "body",
"term": {
"inject": {
"typeName": "hydra.core.model.Type",
"field": {
"name": "application",
"term": {
"record": {
"typeName": "hydra.core.model.ApplicationType",
"fields": [
{
"name": "function",
"term": {
"inject": {
"typeName": "hydra.core.model.Type",
"field": {
"name": "variable",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.typed.TypedName"}}}}}}}},
{
"name": "argument",
"term": {
"application": {
"function": {"application": {"function": {"variable": "hydra.core.dsls.nominalResultType"}, "argument": {"variable": "typeName"}}},
"argument": {"variable": "origType"}}}}]}}}}}},
{
"name": "constraints",
"term": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.empty"}, "type": {"variable": "hydra.core.model.Name"}}},
"type": {"variable": "hydra.core.model.TypeVariableConstraints"}}}}]}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.TypeScheme"}, "constraints": []}}],
"body": {
"record": {
"typeName": "hydra.core.model.Binding",
"fields": [
{"name": "name", "term": {"variable": "tokenName"}},
{"name": "term", "term": {"variable": "body"}},
{"name": "typeScheme", "term": {"optional": {"variable": "ts"}}}]}}}}}}}}}}}}}}}}}},
"annotation": {
"map": [
{
"key": {"variable": "description"},
"value": {"literal": {"string": "Generate a TypedName token constant for a type definition"}}}]}}}}},
{
"term": {
"name": "hydra.core.dsls.generateUnionInjector",
"signature": {
"typeParameters": [],
"parameters": [
{"name": "arg0", "type": {"variable": "hydra.core.model.Type"}, "isLazy": false},
{"name": "arg1", "type": {"variable": "hydra.core.model.Name"}, "isLazy": false},
{"name": "arg2", "type": {"variable": "hydra.core.model.FieldType"}, "isLazy": false}],
"result": {"type": {"variable": "hydra.core.model.Binding"}}},
"body": {
"annotated": {
"body": {
"lambda": {
"parameter": "origType",
"domain": {"variable": "hydra.core.model.Type"},
"body": {
"lambda": {
"parameter": "typeName",
"domain": {"variable": "hydra.core.model.Name"},
"body": {
"lambda": {
"parameter": "ft",
"domain": {"variable": "hydra.core.model.FieldType"},
"body": {
"let": {
"bindings": [
{
"name": "fieldName",
"term": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.FieldType", "fieldName": "name"}},
"argument": {"variable": "ft"}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Name"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "fieldType",
"term": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.FieldType", "fieldName": "type"}},
"argument": {"variable": "ft"}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "injectorLocalName",
"term": {
"application": {
"function": {"variable": "hydra.core.lib.strings.concat"},
"argument": {
"list": [
{
"application": {
"function": {"variable": "hydra.core.formatting.decapitalize"},
"argument": {"application": {"function": {"variable": "hydra.core.names.localNameOf"}, "argument": {"variable": "typeName"}}}}},
{
"application": {
"function": {"application": {"function": {"variable": "hydra.core.lib.strings.join"}, "argument": {"literal": {"string": ""}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"literal": "string"}}},
"type": {"literal": "string"}}},
"argument": {
"lambda": {
"parameter": "s",
"domain": {"literal": "string"},
"body": {"application": {"function": {"variable": "hydra.core.formatting.capitalize"}, "argument": {"variable": "s"}}}}}}},
"argument": {
"application": {
"function": {"application": {"function": {"variable": "hydra.core.lib.strings.splitOn"}, "argument": {"literal": {"string": "."}}}},
"argument": {"application": {"function": {"unwrap": "hydra.core.model.Name"}, "argument": {"variable": "fieldName"}}}}}}}}}]}}},
"typeScheme": {"variables": [], "body": {"literal": "string"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "injectorName",
"term": {
"application": {
"function": {"application": {"function": {"variable": "hydra.core.dsls.dslDefinitionName"}, "argument": {"variable": "typeName"}}},
"argument": {"variable": "injectorLocalName"}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Name"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "isUnit",
"term": {
"application": {
"function": {
"lambda": {
"parameter": "t",
"domain": {"variable": "hydra.core.model.Type"},
"body": {
"application": {
"function": {
"cases": {
"typeName": "hydra.core.model.Type",
"default": {"literal": {"boolean": false}},
"cases": [{"name": "unit", "handler": {"lambda": {"parameter": "_", "domain": "unit", "body": {"literal": {"boolean": true}}}}}]}},
"argument": {"application": {"function": {"variable": "hydra.core.strip.deannotateType"}, "argument": {"variable": "t"}}}}}}},
"argument": {"variable": "fieldType"}}},
"typeScheme": {"variables": [], "body": {"literal": "boolean"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "dFieldValue",
"term": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {"body": {"variable": "hydra.core.lib.logic.ifElse"}, "type": {"variable": "hydra.core.model.Term"}}},
"argument": {"variable": "isUnit"}}},
"argument": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "inject",
"term": {
"record": {
"typeName": "hydra.core.model.Injection",
"fields": [
{
"name": "typeName",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.model.Term"}}}}},
{
"name": "field",
"term": {
"record": {
"typeName": "hydra.core.model.Field",
"fields": [
{"name": "name", "term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "unit"}}}}},
{"name": "term", "term": {"inject": {"typeName": "hydra.core.model.Term", "field": {"name": "unit", "term": "unit"}}}}]}}}]}}}}}}},
"argument": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "application",
"term": {
"record": {
"typeName": "hydra.core.model.Application",
"fields": [
{
"name": "function",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "unwrap",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.typed.TypedTerm"}}}}}}}},
{
"name": "argument",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {"name": "variable", "term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "x"}}}}}}}}]}}}}}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "injectionTerm",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "wrap",
"term": {
"record": {
"typeName": "hydra.core.model.WrappedTerm",
"fields": [
{
"name": "typeName",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.typed.TypedTerm"}}}}},
{
"name": "body",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "inject",
"term": {
"record": {
"typeName": "hydra.core.model.Injection",
"fields": [
{
"name": "typeName",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.model.Term"}}}}},
{
"name": "field",
"term": {
"record": {
"typeName": "hydra.core.model.Field",
"fields": [
{"name": "name", "term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "inject"}}}}},
{
"name": "term",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "record",
"term": {
"record": {
"typeName": "hydra.core.model.Record",
"fields": [
{
"name": "typeName",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.model.Injection"}}}}},
{
"name": "fields",
"term": {
"list": [
{
"record": {
"typeName": "hydra.core.model.Field",
"fields": [
{"name": "name", "term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "typeName"}}}}},
{
"name": "term",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "wrap",
"term": {
"record": {
"typeName": "hydra.core.model.WrappedTerm",
"fields": [
{
"name": "typeName",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.model.Name"}}}}},
{
"name": "body",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "literal",
"term": {
"inject": {
"typeName": "hydra.core.model.Literal",
"field": {
"name": "string",
"term": {"application": {"function": {"unwrap": "hydra.core.model.Name"}, "argument": {"variable": "typeName"}}}}}}}}}}]}}}}}}]}},
{
"record": {
"typeName": "hydra.core.model.Field",
"fields": [
{"name": "name", "term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "field"}}}}},
{
"name": "term",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "record",
"term": {
"record": {
"typeName": "hydra.core.model.Record",
"fields": [
{
"name": "typeName",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.model.Field"}}}}},
{
"name": "fields",
"term": {
"list": [
{
"record": {
"typeName": "hydra.core.model.Field",
"fields": [
{"name": "name", "term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "name"}}}}},
{
"name": "term",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "wrap",
"term": {
"record": {
"typeName": "hydra.core.model.WrappedTerm",
"fields": [
{
"name": "typeName",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.model.Name"}}}}},
{
"name": "body",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "literal",
"term": {
"inject": {
"typeName": "hydra.core.model.Literal",
"field": {
"name": "string",
"term": {"application": {"function": {"unwrap": "hydra.core.model.Name"}, "argument": {"variable": "fieldName"}}}}}}}}}}]}}}}}}]}},
{
"record": {
"typeName": "hydra.core.model.Field",
"fields": [
{"name": "name", "term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "term"}}}}},
{"name": "term", "term": {"variable": "dFieldValue"}}]}}]}}]}}}}}}]}}]}}]}}}}}}]}}}]}}}}}}]}}}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "variantDomain",
"term": {
"inject": {
"typeName": "hydra.core.model.Type",
"field": {
"name": "application",
"term": {
"record": {
"typeName": "hydra.core.model.ApplicationType",
"fields": [
{
"name": "function",
"term": {
"inject": {
"typeName": "hydra.core.model.Type",
"field": {
"name": "variable",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.typed.TypedTerm"}}}}}}}},
{
"name": "argument",
"term": {
"application": {
"function": {"project": {"typeName": "hydra.core.model.FieldType", "fieldName": "type"}},
"argument": {"variable": "ft"}}}}]}}}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "rawBody",
"term": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {"body": {"variable": "hydra.core.lib.logic.ifElse"}, "type": {"variable": "hydra.core.model.Term"}}},
"argument": {"variable": "isUnit"}}},
"argument": {"variable": "injectionTerm"}}},
"argument": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "lambda",
"term": {
"record": {
"typeName": "hydra.core.model.Lambda",
"fields": [
{"name": "parameter", "term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "x"}}}}},
{"name": "domain", "term": {"optional": {"variable": "variantDomain"}}},
{"name": "body", "term": {"variable": "injectionTerm"}}]}}}}}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "description",
"term": {
"application": {
"function": {"variable": "hydra.core.lib.strings.concat"},
"argument": {
"list": [
{"literal": {"string": "DSL injection for the "}},
{"application": {"function": {"unwrap": "hydra.core.model.Name"}, "argument": {"variable": "fieldName"}}},
{"literal": {"string": " variant of "}},
{"application": {"function": {"unwrap": "hydra.core.model.Name"}, "argument": {"variable": "typeName"}}}]}}},
"typeScheme": {"variables": [], "body": {"literal": "string"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "body",
"term": {
"application": {
"function": {
"application": {
"function": {"variable": "hydra.core.annotations.setTermDescription"},
"argument": {"optional": {"variable": "description"}}}},
"argument": {"variable": "rawBody"}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "unionType",
"term": {
"application": {
"function": {"application": {"function": {"variable": "hydra.core.dsls.nominalResultType"}, "argument": {"variable": "typeName"}}},
"argument": {"variable": "origType"}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "ts",
"term": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {"body": {"variable": "hydra.core.lib.logic.ifElse"}, "type": {"variable": "hydra.core.model.TypeScheme"}}},
"argument": {"variable": "isUnit"}}},
"argument": {
"application": {
"function": {
"application": {
"function": {"application": {"function": {"variable": "hydra.core.dsls.dslTypeScheme"}, "argument": {"variable": "origType"}}},
"argument": {"typeApplication": {"body": {"list": []}, "type": {"variable": "hydra.core.model.Type"}}}}},
"argument": {"variable": "unionType"}}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {"application": {"function": {"variable": "hydra.core.dsls.dslTypeScheme"}, "argument": {"variable": "origType"}}},
"argument": {
"list": [
{
"application": {
"function": {"project": {"typeName": "hydra.core.model.FieldType", "fieldName": "type"}},
"argument": {"variable": "ft"}}}]}}},
"argument": {"variable": "unionType"}}}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.TypeScheme"}, "constraints": []}}],
"body": {
"record": {
"typeName": "hydra.core.model.Binding",
"fields": [
{"name": "name", "term": {"variable": "injectorName"}},
{"name": "term", "term": {"variable": "body"}},
{"name": "typeScheme", "term": {"optional": {"variable": "ts"}}}]}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}},
"annotation": {"map": [{"key": {"variable": "description"}, "value": {"literal": {"string": "Generate a union injection helper"}}}]}}}}},
{
"term": {
"name": "hydra.core.dsls.generateWrappedTypeAccessors",
"signature": {
"typeParameters": [],
"parameters": [
{"name": "arg0", "type": {"variable": "hydra.core.model.Type"}, "isLazy": false},
{"name": "arg1", "type": {"variable": "hydra.core.model.Name"}, "isLazy": false},
{"name": "arg2", "type": {"variable": "hydra.core.model.Type"}, "isLazy": false}],
"result": {"type": {"list": {"variable": "hydra.core.model.Binding"}}}},
"body": {
"annotated": {
"body": {
"lambda": {
"parameter": "origType",
"domain": {"variable": "hydra.core.model.Type"},
"body": {
"lambda": {
"parameter": "typeName",
"domain": {"variable": "hydra.core.model.Name"},
"body": {
"lambda": {
"parameter": "innerType",
"domain": {"variable": "hydra.core.model.Type"},
"body": {
"let": {
"bindings": [
{
"name": "localName",
"term": {"application": {"function": {"variable": "hydra.core.names.localNameOf"}, "argument": {"variable": "typeName"}}},
"typeScheme": {"variables": [], "body": {"literal": "string"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "wrapName",
"term": {
"application": {
"function": {"application": {"function": {"variable": "hydra.core.dsls.dslDefinitionName"}, "argument": {"variable": "typeName"}}},
"argument": {"application": {"function": {"variable": "hydra.core.formatting.decapitalize"}, "argument": {"variable": "localName"}}}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Name"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "unwrapLocalName",
"term": {
"application": {
"function": {"variable": "hydra.core.lib.strings.concat"},
"argument": {"list": [{"literal": {"string": "un"}}, {"variable": "localName"}]}}},
"typeScheme": {"variables": [], "body": {"literal": "string"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "unwrapName",
"term": {
"application": {
"function": {"application": {"function": {"variable": "hydra.core.dsls.dslDefinitionName"}, "argument": {"variable": "typeName"}}},
"argument": {"variable": "unwrapLocalName"}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Name"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "wrapperType",
"term": {
"application": {
"function": {"application": {"function": {"variable": "hydra.core.dsls.nominalResultType"}, "argument": {"variable": "typeName"}}},
"argument": {"variable": "origType"}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "wrapDomain",
"term": {
"inject": {
"typeName": "hydra.core.model.Type",
"field": {
"name": "application",
"term": {
"record": {
"typeName": "hydra.core.model.ApplicationType",
"fields": [
{
"name": "function",
"term": {
"inject": {
"typeName": "hydra.core.model.Type",
"field": {
"name": "variable",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.typed.TypedTerm"}}}}}}}},
{"name": "argument", "term": {"variable": "innerType"}}]}}}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "rawWrapBody",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "lambda",
"term": {
"record": {
"typeName": "hydra.core.model.Lambda",
"fields": [
{"name": "parameter", "term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "x"}}}}},
{"name": "domain", "term": {"optional": {"variable": "wrapDomain"}}},
{
"name": "body",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "wrap",
"term": {
"record": {
"typeName": "hydra.core.model.WrappedTerm",
"fields": [
{
"name": "typeName",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.typed.TypedTerm"}}}}},
{
"name": "body",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "inject",
"term": {
"record": {
"typeName": "hydra.core.model.Injection",
"fields": [
{
"name": "typeName",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.model.Term"}}}}},
{
"name": "field",
"term": {
"record": {
"typeName": "hydra.core.model.Field",
"fields": [
{"name": "name", "term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "wrap"}}}}},
{
"name": "term",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "record",
"term": {
"record": {
"typeName": "hydra.core.model.Record",
"fields": [
{
"name": "typeName",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.model.WrappedTerm"}}}}},
{
"name": "fields",
"term": {
"list": [
{
"record": {
"typeName": "hydra.core.model.Field",
"fields": [
{"name": "name", "term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "typeName"}}}}},
{
"name": "term",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "wrap",
"term": {
"record": {
"typeName": "hydra.core.model.WrappedTerm",
"fields": [
{
"name": "typeName",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.model.Name"}}}}},
{
"name": "body",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "literal",
"term": {
"inject": {
"typeName": "hydra.core.model.Literal",
"field": {
"name": "string",
"term": {"application": {"function": {"unwrap": "hydra.core.model.Name"}, "argument": {"variable": "typeName"}}}}}}}}}}]}}}}}}]}},
{
"record": {
"typeName": "hydra.core.model.Field",
"fields": [
{"name": "name", "term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "body"}}}}},
{
"name": "term",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "application",
"term": {
"record": {
"typeName": "hydra.core.model.Application",
"fields": [
{
"name": "function",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "unwrap",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.typed.TypedTerm"}}}}}}}},
{
"name": "argument",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {"name": "variable", "term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "x"}}}}}}}}]}}}}}}]}}]}}]}}}}}}]}}}]}}}}}}]}}}}}}]}}}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "wrapDescription",
"term": {
"application": {
"function": {"variable": "hydra.core.lib.strings.concat"},
"argument": {
"list": [
{"literal": {"string": "DSL constructor for the "}},
{"application": {"function": {"unwrap": "hydra.core.model.Name"}, "argument": {"variable": "typeName"}}},
{"literal": {"string": " wrapper"}}]}}},
"typeScheme": {"variables": [], "body": {"literal": "string"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "wrapBody",
"term": {
"application": {
"function": {
"application": {
"function": {"variable": "hydra.core.annotations.setTermDescription"},
"argument": {"optional": {"variable": "wrapDescription"}}}},
"argument": {"variable": "rawWrapBody"}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "unwrapDomain",
"term": {
"inject": {
"typeName": "hydra.core.model.Type",
"field": {
"name": "application",
"term": {
"record": {
"typeName": "hydra.core.model.ApplicationType",
"fields": [
{
"name": "function",
"term": {
"inject": {
"typeName": "hydra.core.model.Type",
"field": {
"name": "variable",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.typed.TypedTerm"}}}}}}}},
{"name": "argument", "term": {"variable": "wrapperType"}}]}}}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "rawUnwrapBody",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "lambda",
"term": {
"record": {
"typeName": "hydra.core.model.Lambda",
"fields": [
{"name": "parameter", "term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "x"}}}}},
{"name": "domain", "term": {"optional": {"variable": "unwrapDomain"}}},
{
"name": "body",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "wrap",
"term": {
"record": {
"typeName": "hydra.core.model.WrappedTerm",
"fields": [
{
"name": "typeName",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.typed.TypedTerm"}}}}},
{
"name": "body",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "inject",
"term": {
"record": {
"typeName": "hydra.core.model.Injection",
"fields": [
{
"name": "typeName",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.model.Term"}}}}},
{
"name": "field",
"term": {
"record": {
"typeName": "hydra.core.model.Field",
"fields": [
{
"name": "name",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "application"}}}}},
{
"name": "term",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "record",
"term": {
"record": {
"typeName": "hydra.core.model.Record",
"fields": [
{
"name": "typeName",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.model.Application"}}}}},
{
"name": "fields",
"term": {
"list": [
{
"record": {
"typeName": "hydra.core.model.Field",
"fields": [
{"name": "name", "term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "function"}}}}},
{
"name": "term",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "inject",
"term": {
"record": {
"typeName": "hydra.core.model.Injection",
"fields": [
{
"name": "typeName",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.model.Term"}}}}},
{
"name": "field",
"term": {
"record": {
"typeName": "hydra.core.model.Field",
"fields": [
{"name": "name", "term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "unwrap"}}}}},
{
"name": "term",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "wrap",
"term": {
"record": {
"typeName": "hydra.core.model.WrappedTerm",
"fields": [
{
"name": "typeName",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.model.Name"}}}}},
{
"name": "body",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "literal",
"term": {
"inject": {
"typeName": "hydra.core.model.Literal",
"field": {
"name": "string",
"term": {"application": {"function": {"unwrap": "hydra.core.model.Name"}, "argument": {"variable": "typeName"}}}}}}}}}}]}}}}}}]}}}]}}}}}}]}},
{
"record": {
"typeName": "hydra.core.model.Field",
"fields": [
{"name": "name", "term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "argument"}}}}},
{
"name": "term",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "application",
"term": {
"record": {
"typeName": "hydra.core.model.Application",
"fields": [
{
"name": "function",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {
"name": "unwrap",
"term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "hydra.core.typed.TypedTerm"}}}}}}}},
{
"name": "argument",
"term": {
"inject": {
"typeName": "hydra.core.model.Term",
"field": {"name": "variable", "term": {"wrap": {"typeName": "hydra.core.model.Name", "body": {"literal": {"string": "x"}}}}}}}}]}}}}}}]}}]}}]}}}}}}]}}}]}}}}}}]}}}}}}]}}}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "unwrapDescription",
"term": {
"application": {
"function": {"variable": "hydra.core.lib.strings.concat"},
"argument": {
"list": [
{"literal": {"string": "DSL accessor for the body of "}},
{"application": {"function": {"unwrap": "hydra.core.model.Name"}, "argument": {"variable": "typeName"}}}]}}},
"typeScheme": {"variables": [], "body": {"literal": "string"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "unwrapBody",
"term": {
"application": {
"function": {
"application": {
"function": {"variable": "hydra.core.annotations.setTermDescription"},
"argument": {"optional": {"variable": "unwrapDescription"}}}},
"argument": {"variable": "rawUnwrapBody"}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Term"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "wrapTs",
"term": {
"application": {
"function": {
"application": {
"function": {"application": {"function": {"variable": "hydra.core.dsls.dslTypeScheme"}, "argument": {"variable": "origType"}}},
"argument": {"list": [{"variable": "innerType"}]}}},
"argument": {"variable": "wrapperType"}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.TypeScheme"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "unwrapTs",
"term": {
"application": {
"function": {
"application": {
"function": {"application": {"function": {"variable": "hydra.core.dsls.dslTypeScheme"}, "argument": {"variable": "origType"}}},
"argument": {"list": [{"variable": "wrapperType"}]}}},
"argument": {"variable": "innerType"}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.TypeScheme"}, "constraints": []}}],
"body": {
"list": [
{
"record": {
"typeName": "hydra.core.model.Binding",
"fields": [
{"name": "name", "term": {"variable": "wrapName"}},
{"name": "term", "term": {"variable": "wrapBody"}},
{"name": "typeScheme", "term": {"optional": {"variable": "wrapTs"}}}]}},
{
"record": {
"typeName": "hydra.core.model.Binding",
"fields": [
{"name": "name", "term": {"variable": "unwrapName"}},
{"name": "term", "term": {"variable": "unwrapBody"}},
{"name": "typeScheme", "term": {"optional": {"variable": "unwrapTs"}}}]}}]}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}},
"annotation": {
"map": [
{
"key": {"variable": "description"},
"value": {"literal": {"string": "Generate wrap/unwrap accessors for a wrapped type"}}}]}}}}},
{
"term": {
"name": "hydra.core.dsls.isDslEligibleBinding",
"signature": {
"typeParameters": [{"name": "t0", "constraints": []}, {"name": "t1", "constraints": []}, {"name": "t2", "constraints": []}],
"parameters": [
{"name": "arg0", "type": {"variable": "t0"}, "isLazy": false},
{"name": "arg1", "type": {"variable": "t1"}, "isLazy": false},
{"name": "arg2", "type": {"variable": "hydra.core.model.Binding"}, "isLazy": false}],
"result": {"type": {"either": {"left": {"variable": "t2"}, "right": {"optional": {"variable": "hydra.core.model.Binding"}}}}}},
"body": {
"typeLambda": {
"parameter": "t0",
"body": {
"typeLambda": {
"parameter": "t1",
"body": {
"typeLambda": {
"parameter": "t2",
"body": {
"annotated": {
"body": {
"lambda": {
"parameter": "cx",
"domain": {"variable": "t0"},
"body": {
"lambda": {
"parameter": "graph",
"domain": {"variable": "t1"},
"body": {
"lambda": {
"parameter": "b",
"domain": {"variable": "hydra.core.model.Binding"},
"body": {
"let": {
"bindings": [
{
"name": "ns",
"term": {
"application": {
"function": {"variable": "hydra.core.names.moduleNameOf"},
"argument": {
"application": {"function": {"project": {"typeName": "hydra.core.model.Binding", "fieldName": "name"}}, "argument": {"variable": "b"}}}}},
"typeScheme": {"variables": [], "body": {"optional": {"variable": "hydra.core.packaging.ModuleName"}}, "constraints": []}}],
"body": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {"variable": "hydra.core.lib.logic.ifElse"},
"type": {"either": {"left": {"variable": "t2"}, "right": {"optional": {"variable": "hydra.core.model.Binding"}}}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.lib.equality.equal"}, "type": {"literal": "string"}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.optionals.match"}, "type": {"variable": "hydra.core.packaging.ModuleName"}}},
"type": {"literal": "string"}}},
"argument": {"variable": "ns"}}},
"argument": {"literal": {"string": ""}}}},
"argument": {"unwrap": "hydra.core.packaging.ModuleName"}}}}},
"argument": {"literal": {"string": "hydra.core.typed"}}}}}},
"argument": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {
"either": {"right": {"typeApplication": {"body": {"optional": null}, "type": {"variable": "hydra.core.model.Binding"}}}}},
"type": {"variable": "t2"}}},
"type": {"optional": {"variable": "hydra.core.model.Binding"}}}}}},
"argument": {
"typeApplication": {
"body": {"typeApplication": {"body": {"either": {"right": {"optional": {"variable": "b"}}}}, "type": {"variable": "t2"}}},
"type": {"optional": {"variable": "hydra.core.model.Binding"}}}}}}}}}}}}}},
"annotation": {
"map": [
{
"key": {"variable": "description"},
"value": {"literal": {"string": "Check if a binding is eligible for DSL generation"}}}]}}}}}}}}}}},
{
"term": {
"name": "hydra.core.dsls.nominalResultType",
"signature": {
"typeParameters": [],
"parameters": [
{"name": "arg0", "type": {"variable": "hydra.core.model.Name"}, "isLazy": false},
{"name": "arg1", "type": {"variable": "hydra.core.model.Type"}, "isLazy": false}],
"result": {"type": {"variable": "hydra.core.model.Type"}}},
"body": {
"annotated": {
"body": {
"lambda": {
"parameter": "typeName",
"domain": {"variable": "hydra.core.model.Name"},
"body": {
"lambda": {
"parameter": "origType",
"domain": {"variable": "hydra.core.model.Type"},
"body": {
"let": {
"bindings": [
{
"name": "vars",
"term": {"application": {"function": {"variable": "hydra.core.dsls.collectForallVars"}, "argument": {"variable": "origType"}}},
"typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Name"}}, "constraints": []}}],
"body": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.foldl"}, "type": {"variable": "hydra.core.model.Type"}}},
"type": {"variable": "hydra.core.model.Name"}}},
"argument": {
"lambda": {
"parameter": "acc",
"domain": {"variable": "hydra.core.model.Type"},
"body": {
"lambda": {
"parameter": "v",
"domain": {"variable": "hydra.core.model.Name"},
"body": {
"inject": {
"typeName": "hydra.core.model.Type",
"field": {
"name": "application",
"term": {
"record": {
"typeName": "hydra.core.model.ApplicationType",
"fields": [
{"name": "function", "term": {"variable": "acc"}},
{
"name": "argument",
"term": {"inject": {"typeName": "hydra.core.model.Type", "field": {"name": "variable", "term": {"variable": "v"}}}}}]}}}}}}}}}}},
"argument": {"inject": {"typeName": "hydra.core.model.Type", "field": {"name": "variable", "term": {"variable": "typeName"}}}}}},
"argument": {"variable": "vars"}}}}}}}}},
"annotation": {
"map": [
{
"key": {"variable": "description"},
"value": {"literal": {"string": "Build the nominal result type with type applications for forall variables"}}}]}}}}},
{
"term": {
"name": "hydra.core.dsls.signatureIsVoidFree",
"signature": {
"typeParameters": [],
"parameters": [{"name": "arg0", "type": {"variable": "hydra.core.typing.TermSignature"}, "isLazy": false}],
"result": {"type": {"literal": "boolean"}}},
"body": {
"annotated": {
"body": {
"lambda": {
"parameter": "sig",
"domain": {"variable": "hydra.core.typing.TermSignature"},
"body": {
"let": {
"bindings": [
{
"name": "paramTypes",
"term": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.typing.Parameter"}}},
"type": {"variable": "hydra.core.model.Type"}}},
"argument": {
"lambda": {
"parameter": "p",
"domain": {"variable": "hydra.core.typing.Parameter"},
"body": {
"application": {
"function": {"project": {"typeName": "hydra.core.typing.Parameter", "fieldName": "type"}},
"argument": {"variable": "p"}}}}}}},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.typing.TermSignature", "fieldName": "parameters"}},
"argument": {"variable": "sig"}}}}},
"typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.model.Type"}}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "resultType",
"term": {
"application": {
"function": {"project": {"typeName": "hydra.core.typing.Result", "fieldName": "type"}},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.typing.TermSignature", "fieldName": "result"}},
"argument": {"variable": "sig"}}}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.model.Type"}, "constraints": []}}],
"body": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.foldl"}, "type": {"literal": "boolean"}}},
"type": {"variable": "hydra.core.model.Type"}}},
"argument": {
"lambda": {
"parameter": "acc",
"domain": {"literal": "boolean"},
"body": {
"lambda": {
"parameter": "t",
"domain": {"variable": "hydra.core.model.Type"},
"body": {
"application": {
"function": {"application": {"function": {"variable": "hydra.core.lib.logic.and"}, "argument": {"variable": "acc"}}},
"argument": {"application": {"function": {"variable": "hydra.core.dsls.typeIsVoidFree"}, "argument": {"variable": "t"}}}}}}}}}}},
"argument": {"application": {"function": {"variable": "hydra.core.dsls.typeIsVoidFree"}, "argument": {"variable": "resultType"}}}}},
"argument": {"variable": "paramTypes"}}}}}}}}},
"annotation": {
"map": [
{
"key": {"variable": "description"},
"value": {"literal": {"string": "Check whether a term signature's parameter and result types are all void-free"}}}]}}}}},
{
"term": {
"name": "hydra.core.dsls.typeIsVoidFree",
"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": {
"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 whether a type contains no occurrence of the void type at any depth"}}}]}}}}}]}