hydra-kernel-0.18.1: hydra-kernel-json/hydra/core/json/writer.json
{
"name": "hydra.core.json.writer",
"metadata": {"description": "JSON serialization functions using the Hydra AST", "comments": [], "seeAlso": [], "provisions": []},
"dependencies": [
{"module": "hydra.core.ast"},
{"module": "hydra.core.json.model"},
{"module": "hydra.core.lib.equality"},
{"module": "hydra.core.lib.lists"},
{"module": "hydra.core.lib.literals"},
{"module": "hydra.core.lib.logic"},
{"module": "hydra.core.lib.math"},
{"module": "hydra.core.lib.optionals"},
{"module": "hydra.core.lib.ordering"},
{"module": "hydra.core.lib.pairs"},
{"module": "hydra.core.lib.strings"},
{"module": "hydra.core.serialization"}],
"definitions": [
{
"term": {
"name": "hydra.core.json.writer.colonOp",
"signature": {"typeParameters": [], "parameters": [], "result": {"type": {"variable": "hydra.core.ast.Op"}}},
"body": {
"annotated": {
"body": {
"record": {
"typeName": "hydra.core.ast.Op",
"fields": [
{"name": "symbol", "term": {"wrap": {"typeName": "hydra.core.ast.Symbol", "body": {"literal": {"string": ":"}}}}},
{
"name": "padding",
"term": {
"record": {
"typeName": "hydra.core.ast.Padding",
"fields": [
{"name": "left", "term": {"inject": {"typeName": "hydra.core.ast.Ws", "field": {"name": "none", "term": "unit"}}}},
{"name": "right", "term": {"inject": {"typeName": "hydra.core.ast.Ws", "field": {"name": "space", "term": "unit"}}}}]}}},
{
"name": "precedence",
"term": {"wrap": {"typeName": "hydra.core.ast.Precedence", "body": {"literal": {"integer": {"int32": 0}}}}}},
{
"name": "associativity",
"term": {"inject": {"typeName": "hydra.core.ast.Associativity", "field": {"name": "none", "term": "unit"}}}}]}},
"annotation": {
"map": [
{
"key": {"variable": "description"},
"value": {"literal": {"string": "The colon operator used to separate keys and values in JSON objects"}}}]}}}}},
{
"term": {
"name": "hydra.core.json.writer.compactColonOp",
"signature": {"typeParameters": [], "parameters": [], "result": {"type": {"variable": "hydra.core.ast.Op"}}},
"body": {
"annotated": {
"body": {
"record": {
"typeName": "hydra.core.ast.Op",
"fields": [
{"name": "symbol", "term": {"wrap": {"typeName": "hydra.core.ast.Symbol", "body": {"literal": {"string": ":"}}}}},
{
"name": "padding",
"term": {
"record": {
"typeName": "hydra.core.ast.Padding",
"fields": [
{"name": "left", "term": {"inject": {"typeName": "hydra.core.ast.Ws", "field": {"name": "none", "term": "unit"}}}},
{"name": "right", "term": {"inject": {"typeName": "hydra.core.ast.Ws", "field": {"name": "none", "term": "unit"}}}}]}}},
{
"name": "precedence",
"term": {"wrap": {"typeName": "hydra.core.ast.Precedence", "body": {"literal": {"integer": {"int32": 0}}}}}},
{
"name": "associativity",
"term": {"inject": {"typeName": "hydra.core.ast.Associativity", "field": {"name": "none", "term": "unit"}}}}]}},
"annotation": {
"map": [
{
"key": {"variable": "description"},
"value": {"literal": {"string": "Like colonOp, but with no padding on either side, for compact-mode output"}}}]}}}}},
{
"term": {
"name": "hydra.core.json.writer.compactCommaOp",
"signature": {"typeParameters": [], "parameters": [], "result": {"type": {"variable": "hydra.core.ast.Op"}}},
"body": {
"annotated": {
"body": {
"record": {
"typeName": "hydra.core.ast.Op",
"fields": [
{"name": "symbol", "term": {"wrap": {"typeName": "hydra.core.ast.Symbol", "body": {"literal": {"string": ","}}}}},
{
"name": "padding",
"term": {
"record": {
"typeName": "hydra.core.ast.Padding",
"fields": [
{"name": "left", "term": {"inject": {"typeName": "hydra.core.ast.Ws", "field": {"name": "none", "term": "unit"}}}},
{"name": "right", "term": {"inject": {"typeName": "hydra.core.ast.Ws", "field": {"name": "none", "term": "unit"}}}}]}}},
{
"name": "precedence",
"term": {"wrap": {"typeName": "hydra.core.ast.Precedence", "body": {"literal": {"integer": {"int32": 0}}}}}},
{
"name": "associativity",
"term": {"inject": {"typeName": "hydra.core.ast.Associativity", "field": {"name": "none", "term": "unit"}}}}]}},
"annotation": {
"map": [
{
"key": {"variable": "description"},
"value": {"literal": {"string": "A comma separator with no padding on either side, for compact-mode output"}}}]}}}}},
{
"term": {
"name": "hydra.core.json.writer.compactList",
"signature": {
"typeParameters": [],
"parameters": [
{"name": "arg0", "type": {"variable": "hydra.core.ast.Brackets"}, "isLazy": false},
{"name": "arg1", "type": {"list": {"variable": "hydra.core.ast.Expr"}}, "isLazy": false}],
"result": {"type": {"variable": "hydra.core.ast.Expr"}}},
"body": {
"annotated": {
"body": {
"lambda": {
"parameter": "br",
"domain": {"variable": "hydra.core.ast.Brackets"},
"body": {
"lambda": {
"parameter": "els",
"domain": {"list": {"variable": "hydra.core.ast.Expr"}},
"body": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.lib.logic.ifElse"}, "type": {"variable": "hydra.core.ast.Expr"}}},
"argument": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.isEmpty"}, "type": {"variable": "hydra.core.ast.Expr"}}},
"argument": {"variable": "els"}}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {"application": {"function": {"variable": "hydra.core.serialization.brackets"}, "argument": {"variable": "br"}}},
"argument": {"variable": "hydra.core.serialization.inlineStyle"}}},
"argument": {"application": {"function": {"variable": "hydra.core.serialization.cst"}, "argument": {"literal": {"string": ""}}}}}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {"application": {"function": {"variable": "hydra.core.serialization.brackets"}, "argument": {"variable": "br"}}},
"argument": {"variable": "hydra.core.serialization.inlineStyle"}}},
"argument": {
"application": {
"function": {
"application": {
"function": {"variable": "hydra.core.serialization.sep"},
"argument": {"variable": "hydra.core.json.writer.compactCommaOp"}}},
"argument": {"variable": "els"}}}}}}}}}}},
"annotation": {
"map": [
{
"key": {"variable": "description"},
"value": {
"literal": {"string": "Comma-separate the elements inside the given bracket pair with no insignificant whitespace at all."}}}]}}}}},
{
"term": {
"name": "hydra.core.json.writer.defaultJsonWriterOptions",
"signature": {"typeParameters": [], "parameters": [], "result": {"type": {"variable": "hydra.core.json.model.JsonWriterOptions"}}},
"body": {
"annotated": {
"body": {
"record": {
"typeName": "hydra.core.json.model.JsonWriterOptions",
"fields": [
{"name": "compact", "term": {"literal": {"boolean": false}}},
{"name": "indent", "term": {"literal": {"string": " "}}},
{"name": "maxLineWidth", "term": {"literal": {"integer": {"int32": 120}}}},
{
"name": "maxIndentDepth",
"term": {"typeApplication": {"body": {"optional": null}, "type": {"literal": {"integer": "int32"}}}}}]}},
"annotation": {
"map": [
{
"key": {"variable": "description"},
"value": {
"literal": {
"string": "The default layout options, reproducing the historical, non-configurable behavior of printJson byte-for-byte: pretty-printed, two-space indent, 120-column adaptive width, no indent-depth limit."}}}]}}}}},
{
"term": {
"name": "hydra.core.json.writer.halfBlockStyleWith",
"signature": {
"typeParameters": [],
"parameters": [{"name": "arg0", "type": {"variable": "hydra.core.json.model.JsonWriterOptions"}, "isLazy": false}],
"result": {"type": {"variable": "hydra.core.ast.BlockStyle"}}},
"body": {
"annotated": {
"body": {
"lambda": {
"parameter": "options",
"domain": {"variable": "hydra.core.json.model.JsonWriterOptions"},
"body": {
"record": {
"typeName": "hydra.core.ast.BlockStyle",
"fields": [
{
"name": "indent",
"term": {
"optional": {
"application": {
"function": {"project": {"typeName": "hydra.core.json.model.JsonWriterOptions", "fieldName": "indent"}},
"argument": {"variable": "options"}}}}},
{"name": "newlineBeforeContent", "term": {"literal": {"boolean": true}}},
{"name": "newlineAfterContent", "term": {"literal": {"boolean": false}}}]}}}},
"annotation": {
"map": [
{
"key": {"variable": "description"},
"value": {"literal": {"string": "A half-block style (newline before content, none after) using the options' indent string."}}}]}}}}},
{
"term": {
"name": "hydra.core.json.writer.hexByte",
"signature": {
"typeParameters": [],
"parameters": [{"name": "arg0", "type": {"literal": {"integer": "int32"}}, "isLazy": false}],
"result": {"type": {"literal": "string"}}},
"body": {
"annotated": {
"body": {
"lambda": {
"parameter": "c",
"domain": {"literal": {"integer": "int32"}},
"body": {
"let": {
"bindings": [
{
"name": "nibble",
"term": {
"lambda": {
"parameter": "i",
"domain": {"literal": {"integer": "int32"}},
"body": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.lib.optionals.withDefault"}, "type": {"literal": "string"}}},
"argument": {"literal": {"string": "?"}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.optionals.map"}, "type": {"literal": {"integer": "int32"}}}},
"type": {"literal": "string"}}},
"argument": {
"lambda": {
"parameter": "ch",
"domain": {"literal": {"integer": "int32"}},
"body": {
"application": {
"function": {"variable": "hydra.core.lib.strings.fromList"},
"argument": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.singleton"}, "type": {"literal": {"integer": "int32"}}}},
"argument": {"variable": "ch"}}}}}}}}},
"argument": {
"application": {
"function": {"application": {"function": {"variable": "hydra.core.lib.strings.charAt"}, "argument": {"variable": "i"}}},
"argument": {"literal": {"string": "0123456789abcdef"}}}}}}}}}},
"typeScheme": {
"variables": [],
"body": {"function": {"domain": {"literal": {"integer": "int32"}}, "codomain": {"literal": "string"}}},
"constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "hi",
"term": {
"application": {
"function": {"variable": "nibble"},
"argument": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {"body": {"variable": "hydra.core.lib.optionals.withDefault"}, "type": {"literal": {"integer": "int32"}}}},
"argument": {"literal": {"integer": {"int32": 0}}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.lib.math.div"}, "type": {"literal": {"integer": "int32"}}}},
"argument": {"variable": "c"}}},
"argument": {"literal": {"integer": {"int32": 16}}}}}}}}},
"typeScheme": {"variables": [], "body": {"literal": "string"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "lo",
"term": {
"application": {
"function": {"variable": "nibble"},
"argument": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {"body": {"variable": "hydra.core.lib.optionals.withDefault"}, "type": {"literal": {"integer": "int32"}}}},
"argument": {"literal": {"integer": {"int32": 0}}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.lib.math.mod"}, "type": {"literal": {"integer": "int32"}}}},
"argument": {"variable": "c"}}},
"argument": {"literal": {"integer": {"int32": 16}}}}}}}}},
"typeScheme": {"variables": [], "body": {"literal": "string"}, "constraints": []}}],
"body": {
"application": {
"function": {"application": {"function": {"variable": "hydra.core.lib.strings.concat2"}, "argument": {"variable": "hi"}}},
"argument": {"variable": "lo"}}}}}}}}}}},
"annotation": {
"map": [
{
"key": {"variable": "description"},
"value": {
"literal": {
"string": "Encode a byte (0..255) as a two-character lowercase hex string. Non-byte inputs yield placeholder '?' characters."}}}]}}}}},
{
"term": {
"name": "hydra.core.json.writer.jsonString",
"signature": {
"typeParameters": [],
"parameters": [{"name": "arg0", "type": {"literal": "string"}, "isLazy": false}],
"result": {"type": {"literal": "string"}}},
"body": {
"annotated": {
"body": {
"lambda": {
"parameter": "s",
"domain": {"literal": "string"},
"body": {
"let": {
"bindings": [
{
"name": "hexEscape",
"term": {
"lambda": {
"parameter": "c",
"domain": {"literal": {"integer": "int32"}},
"body": {
"application": {
"function": {
"application": {"function": {"variable": "hydra.core.lib.strings.concat2"}, "argument": {"literal": {"string": "\\u00"}}}},
"argument": {"application": {"function": {"variable": "hydra.core.json.writer.hexByte"}, "argument": {"variable": "c"}}}}}}},
"typeScheme": {
"variables": [],
"body": {"function": {"domain": {"literal": {"integer": "int32"}}, "codomain": {"literal": "string"}}},
"constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "escape",
"term": {
"lambda": {
"parameter": "c",
"domain": {"literal": {"integer": "int32"}},
"body": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.lib.logic.ifElse"}, "type": {"literal": "string"}}},
"argument": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.lib.equality.equal"}, "type": {"literal": {"integer": "int32"}}}},
"argument": {"variable": "c"}}},
"argument": {"literal": {"integer": {"int32": 34}}}}}}},
"argument": {"literal": {"string": "\\\""}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.lib.logic.ifElse"}, "type": {"literal": "string"}}},
"argument": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.lib.equality.equal"}, "type": {"literal": {"integer": "int32"}}}},
"argument": {"variable": "c"}}},
"argument": {"literal": {"integer": {"int32": 92}}}}}}},
"argument": {"literal": {"string": "\\\\"}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.lib.logic.ifElse"}, "type": {"literal": "string"}}},
"argument": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.lib.equality.equal"}, "type": {"literal": {"integer": "int32"}}}},
"argument": {"variable": "c"}}},
"argument": {"literal": {"integer": {"int32": 8}}}}}}},
"argument": {"literal": {"string": "\\b"}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.lib.logic.ifElse"}, "type": {"literal": "string"}}},
"argument": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.lib.equality.equal"}, "type": {"literal": {"integer": "int32"}}}},
"argument": {"variable": "c"}}},
"argument": {"literal": {"integer": {"int32": 12}}}}}}},
"argument": {"literal": {"string": "\\f"}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.lib.logic.ifElse"}, "type": {"literal": "string"}}},
"argument": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.lib.equality.equal"}, "type": {"literal": {"integer": "int32"}}}},
"argument": {"variable": "c"}}},
"argument": {"literal": {"integer": {"int32": 10}}}}}}},
"argument": {"literal": {"string": "\\n"}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.lib.logic.ifElse"}, "type": {"literal": "string"}}},
"argument": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.lib.equality.equal"}, "type": {"literal": {"integer": "int32"}}}},
"argument": {"variable": "c"}}},
"argument": {"literal": {"integer": {"int32": 13}}}}}}},
"argument": {"literal": {"string": "\\r"}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.lib.logic.ifElse"}, "type": {"literal": "string"}}},
"argument": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.lib.equality.equal"}, "type": {"literal": {"integer": "int32"}}}},
"argument": {"variable": "c"}}},
"argument": {"literal": {"integer": {"int32": 9}}}}}}},
"argument": {"literal": {"string": "\\t"}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.lib.logic.ifElse"}, "type": {"literal": "string"}}},
"argument": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.lib.ordering.lt"}, "type": {"literal": {"integer": "int32"}}}},
"argument": {"variable": "c"}}},
"argument": {"literal": {"integer": {"int32": 32}}}}}}},
"argument": {"application": {"function": {"variable": "hexEscape"}, "argument": {"variable": "c"}}}}},
"argument": {
"application": {
"function": {"variable": "hydra.core.lib.strings.fromList"},
"argument": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.singleton"}, "type": {"literal": {"integer": "int32"}}}},
"argument": {"variable": "c"}}}}}}}}}}}}}}}}}}}}}}},
"typeScheme": {
"variables": [],
"body": {"function": {"domain": {"literal": {"integer": "int32"}}, "codomain": {"literal": "string"}}},
"constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "escaped",
"term": {
"application": {
"function": {"variable": "hydra.core.lib.strings.concat"},
"argument": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"literal": {"integer": "int32"}}}},
"type": {"literal": "string"}}},
"argument": {"variable": "escape"}}},
"argument": {"application": {"function": {"variable": "hydra.core.lib.strings.toList"}, "argument": {"variable": "s"}}}}}}},
"typeScheme": {"variables": [], "body": {"literal": "string"}, "constraints": []}}],
"body": {
"application": {
"function": {
"application": {
"function": {"variable": "hydra.core.lib.strings.concat2"},
"argument": {
"application": {
"function": {"application": {"function": {"variable": "hydra.core.lib.strings.concat2"}, "argument": {"literal": {"string": "\""}}}},
"argument": {"variable": "escaped"}}}}},
"argument": {"literal": {"string": "\""}}}}}}}}}}}},
"annotation": {
"map": [{"key": {"variable": "description"}, "value": {"literal": {"string": "Escape and quote a string for JSON output"}}}]}}}}},
{
"term": {
"name": "hydra.core.json.writer.keyValueToExprWith",
"signature": {
"typeParameters": [],
"parameters": [
{"name": "arg0", "type": {"variable": "hydra.core.json.model.JsonWriterOptions"}, "isLazy": false},
{"name": "arg1", "type": {"literal": {"integer": "int32"}}, "isLazy": false},
{
"name": "arg2",
"type": {"pair": {"first": {"literal": "string"}, "second": {"variable": "hydra.core.json.model.Value"}}},
"isLazy": false}],
"result": {"type": {"variable": "hydra.core.ast.Expr"}}},
"body": {
"annotated": {
"body": {
"lambda": {
"parameter": "options",
"domain": {"variable": "hydra.core.json.model.JsonWriterOptions"},
"body": {
"lambda": {
"parameter": "depth",
"domain": {"literal": {"integer": "int32"}},
"body": {
"lambda": {
"parameter": "pair",
"domain": {"pair": {"first": {"literal": "string"}, "second": {"variable": "hydra.core.json.model.Value"}}},
"body": {
"let": {
"bindings": [
{
"name": "key",
"term": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"literal": "string"}}},
"type": {"variable": "hydra.core.json.model.Value"}}},
"argument": {"variable": "pair"}}},
"typeScheme": {"variables": [], "body": {"literal": "string"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "value",
"term": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"literal": "string"}}},
"type": {"variable": "hydra.core.json.model.Value"}}},
"argument": {"variable": "pair"}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.json.model.Value"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "colon",
"term": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.lib.logic.ifElse"}, "type": {"variable": "hydra.core.ast.Op"}}},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.json.model.JsonWriterOptions", "fieldName": "compact"}},
"argument": {"variable": "options"}}}}},
"argument": {"variable": "hydra.core.json.writer.compactColonOp"}}},
"argument": {"variable": "hydra.core.json.writer.colonOp"}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.ast.Op"}, "constraints": []}}],
"body": {
"application": {
"function": {
"application": {
"function": {"application": {"function": {"variable": "hydra.core.serialization.ifx"}, "argument": {"variable": "colon"}}},
"argument": {
"application": {
"function": {"variable": "hydra.core.serialization.cst"},
"argument": {"application": {"function": {"variable": "hydra.core.json.writer.jsonString"}, "argument": {"variable": "key"}}}}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"application": {"function": {"variable": "hydra.core.json.writer.valueToExprWith"}, "argument": {"variable": "options"}}},
"argument": {"variable": "depth"}}},
"argument": {"variable": "value"}}}}}}}}}}}}}}}}},
"annotation": {
"map": [
{
"key": {"variable": "description"},
"value": {
"literal": {"string": "Convert a key-value pair to an AST expression, honoring the given writer options and nesting depth."}}}]}}}}},
{
"term": {
"name": "hydra.core.json.writer.printJson",
"signature": {
"typeParameters": [],
"parameters": [{"name": "arg0", "type": {"variable": "hydra.core.json.model.Value"}, "isLazy": false}],
"result": {"type": {"literal": "string"}}},
"body": {
"annotated": {
"body": {
"lambda": {
"parameter": "value",
"domain": {"variable": "hydra.core.json.model.Value"},
"body": {
"application": {
"function": {
"application": {
"function": {"variable": "hydra.core.json.writer.printJsonWith"},
"argument": {"variable": "hydra.core.json.writer.defaultJsonWriterOptions"}}},
"argument": {"variable": "value"}}}}},
"annotation": {
"map": [
{
"key": {"variable": "description"},
"value": {"literal": {"string": "Serialize a JSON value to a string, using the default (pretty-printed) layout options."}}}]}}}}},
{
"term": {
"name": "hydra.core.json.writer.printJsonWith",
"signature": {
"typeParameters": [],
"parameters": [
{"name": "arg0", "type": {"variable": "hydra.core.json.model.JsonWriterOptions"}, "isLazy": false},
{"name": "arg1", "type": {"variable": "hydra.core.json.model.Value"}, "isLazy": false}],
"result": {"type": {"literal": "string"}}},
"body": {
"annotated": {
"body": {
"lambda": {
"parameter": "options",
"domain": {"variable": "hydra.core.json.model.JsonWriterOptions"},
"body": {
"lambda": {
"parameter": "value",
"domain": {"variable": "hydra.core.json.model.Value"},
"body": {
"application": {
"function": {"variable": "hydra.core.serialization.printExpr"},
"argument": {
"application": {
"function": {
"application": {
"function": {
"application": {"function": {"variable": "hydra.core.json.writer.valueToExprWith"}, "argument": {"variable": "options"}}},
"argument": {"literal": {"integer": {"int32": 0}}}}},
"argument": {"variable": "value"}}}}}}}}},
"annotation": {
"map": [
{
"key": {"variable": "description"},
"value": {"literal": {"string": "Serialize a JSON value to a string using the given layout options."}}}]}}}}},
{
"term": {
"name": "hydra.core.json.writer.styleForDepth",
"signature": {
"typeParameters": [],
"parameters": [
{"name": "arg0", "type": {"variable": "hydra.core.json.model.JsonWriterOptions"}, "isLazy": false},
{"name": "arg1", "type": {"literal": {"integer": "int32"}}, "isLazy": false},
{"name": "arg2", "type": {"variable": "hydra.core.ast.Expr"}, "isLazy": false},
{"name": "arg3", "type": {"variable": "hydra.core.ast.Expr"}, "isLazy": false}],
"result": {"type": {"variable": "hydra.core.ast.Expr"}}},
"body": {
"annotated": {
"body": {
"lambda": {
"parameter": "options",
"domain": {"variable": "hydra.core.json.model.JsonWriterOptions"},
"body": {
"lambda": {
"parameter": "depth",
"domain": {"literal": {"integer": "int32"}},
"body": {
"lambda": {
"parameter": "inlineExpr",
"domain": {"variable": "hydra.core.ast.Expr"},
"body": {
"lambda": {
"parameter": "blockExpr",
"domain": {"variable": "hydra.core.ast.Expr"},
"body": {
"let": {
"bindings": [
{
"name": "atMaxDepth",
"term": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.optionals.match"}, "type": {"literal": {"integer": "int32"}}}},
"type": {"literal": "boolean"}}},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.json.model.JsonWriterOptions", "fieldName": "maxIndentDepth"}},
"argument": {"variable": "options"}}}}},
"argument": {"literal": {"boolean": false}}}},
"argument": {
"lambda": {
"parameter": "maxDepth",
"domain": {"literal": {"integer": "int32"}},
"body": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.lib.ordering.gte"}, "type": {"literal": {"integer": "int32"}}}},
"argument": {"variable": "depth"}}},
"argument": {"variable": "maxDepth"}}}}}}},
"typeScheme": {"variables": [], "body": {"literal": "boolean"}, "constraints": []}}],
"body": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.lib.logic.ifElse"}, "type": {"variable": "hydra.core.ast.Expr"}}},
"argument": {"variable": "atMaxDepth"}}},
"argument": {"variable": "inlineExpr"}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {"variable": "hydra.core.serialization.chooseLayout"},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.json.model.JsonWriterOptions", "fieldName": "maxLineWidth"}},
"argument": {"variable": "options"}}}}},
"argument": {"variable": "inlineExpr"}}},
"argument": {"variable": "blockExpr"}}}}}}}}}}}}}}},
"annotation": {
"map": [
{
"key": {"variable": "description"},
"value": {
"literal": {
"string": "Choose between an inline and a block rendering of the same logical collection, given the (non-compact) writer options and the current nesting depth. Depths at or beyond maxIndentDepth always render inline; otherwise the width-adaptive choice from chooseLayout applies, using the options' own line width in place of the fixed maxLineWidth constant."}}}]}}}}},
{
"term": {
"name": "hydra.core.json.writer.valueToExpr",
"signature": {
"typeParameters": [],
"parameters": [{"name": "arg0", "type": {"variable": "hydra.core.json.model.Value"}, "isLazy": false}],
"result": {"type": {"variable": "hydra.core.ast.Expr"}}},
"body": {
"annotated": {
"body": {
"lambda": {
"parameter": "value",
"domain": {"variable": "hydra.core.json.model.Value"},
"body": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {"variable": "hydra.core.json.writer.valueToExprWith"},
"argument": {"variable": "hydra.core.json.writer.defaultJsonWriterOptions"}}},
"argument": {"literal": {"integer": {"int32": 0}}}}},
"argument": {"variable": "value"}}}}},
"annotation": {
"map": [
{
"key": {"variable": "description"},
"value": {
"literal": {"string": "Convert a JSON value to an AST expression for serialization, using the default layout options."}}}]}}}}},
{
"term": {
"name": "hydra.core.json.writer.valueToExprWith",
"signature": {
"typeParameters": [],
"parameters": [
{"name": "arg0", "type": {"variable": "hydra.core.json.model.JsonWriterOptions"}, "isLazy": false},
{"name": "arg1", "type": {"literal": {"integer": "int32"}}, "isLazy": false},
{"name": "arg2", "type": {"variable": "hydra.core.json.model.Value"}, "isLazy": false}],
"result": {"type": {"variable": "hydra.core.ast.Expr"}}},
"body": {
"annotated": {
"body": {
"lambda": {
"parameter": "options",
"domain": {"variable": "hydra.core.json.model.JsonWriterOptions"},
"body": {
"lambda": {
"parameter": "depth",
"domain": {"literal": {"integer": "int32"}},
"body": {
"lambda": {
"parameter": "value",
"domain": {"variable": "hydra.core.json.model.Value"},
"body": {
"let": {
"bindings": [
{
"name": "childDepth",
"term": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.lib.math.add"}, "type": {"literal": {"integer": "int32"}}}},
"argument": {"variable": "depth"}}},
"argument": {"literal": {"integer": {"int32": 1}}}}},
"typeScheme": {"variables": [], "body": {"literal": {"integer": "int32"}}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "compact",
"term": {
"application": {
"function": {"project": {"typeName": "hydra.core.json.model.JsonWriterOptions", "fieldName": "compact"}},
"argument": {"variable": "options"}}},
"typeScheme": {"variables": [], "body": {"literal": "boolean"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "style",
"term": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {"body": {"variable": "hydra.core.lib.logic.ifElse"}, "type": {"variable": "hydra.core.ast.BlockStyle"}}},
"argument": {"variable": "compact"}}},
"argument": {"variable": "hydra.core.serialization.inlineStyle"}}},
"argument": {
"application": {"function": {"variable": "hydra.core.json.writer.halfBlockStyleWith"}, "argument": {"variable": "options"}}}}},
"typeScheme": {"variables": [], "body": {"variable": "hydra.core.ast.BlockStyle"}, "constraints": []}}],
"body": {
"application": {
"function": {
"cases": {
"typeName": "hydra.core.json.model.Value",
"cases": [
{
"name": "array",
"handler": {
"lambda": {
"parameter": "arr",
"domain": {"list": {"variable": "hydra.core.json.model.Value"}},
"body": {
"let": {
"bindings": [
{
"name": "els",
"term": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "hydra.core.json.model.Value"}}},
"type": {"variable": "hydra.core.ast.Expr"}}},
"argument": {
"application": {
"function": {
"application": {"function": {"variable": "hydra.core.json.writer.valueToExprWith"}, "argument": {"variable": "options"}}},
"argument": {"variable": "childDepth"}}}}},
"argument": {"variable": "arr"}}},
"typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.ast.Expr"}}, "constraints": []}}],
"body": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.lib.logic.ifElse"}, "type": {"variable": "hydra.core.ast.Expr"}}},
"argument": {"variable": "compact"}}},
"argument": {
"application": {
"function": {
"application": {
"function": {"variable": "hydra.core.json.writer.compactList"},
"argument": {"variable": "hydra.core.serialization.squareBrackets"}}},
"argument": {"variable": "els"}}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {"application": {"function": {"variable": "hydra.core.json.writer.styleForDepth"}, "argument": {"variable": "options"}}},
"argument": {"variable": "depth"}}},
"argument": {
"application": {
"function": {
"application": {
"function": {"variable": "hydra.core.serialization.bracketList"},
"argument": {"variable": "hydra.core.serialization.inlineStyle"}}},
"argument": {"variable": "els"}}}}},
"argument": {
"application": {
"function": {"application": {"function": {"variable": "hydra.core.serialization.bracketList"}, "argument": {"variable": "style"}}},
"argument": {"variable": "els"}}}}}}}}}}}},
{
"name": "boolean",
"handler": {
"lambda": {
"parameter": "b",
"domain": {"literal": "boolean"},
"body": {
"application": {
"function": {"variable": "hydra.core.serialization.cst"},
"argument": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.lib.logic.ifElse"}, "type": {"literal": "string"}}},
"argument": {"variable": "b"}}},
"argument": {"literal": {"string": "true"}}}},
"argument": {"literal": {"string": "false"}}}}}}}}},
{
"name": "null",
"handler": {
"lambda": {
"parameter": "_",
"domain": "unit",
"body": {"application": {"function": {"variable": "hydra.core.serialization.cst"}, "argument": {"literal": {"string": "null"}}}}}}},
{
"name": "number",
"handler": {
"lambda": {
"parameter": "n",
"domain": {"literal": "decimal"},
"body": {
"let": {
"bindings": [
{
"name": "rounded",
"term": {"application": {"function": {"variable": "hydra.core.lib.literals.decimalToBigint"}, "argument": {"variable": "n"}}},
"typeScheme": {"variables": [], "body": {"literal": {"integer": "bigint"}}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "shown",
"term": {"application": {"function": {"variable": "hydra.core.lib.literals.printDecimal"}, "argument": {"variable": "n"}}},
"typeScheme": {"variables": [], "body": {"literal": "string"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "notExponential",
"term": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.lib.ordering.lte"}, "type": {"literal": {"integer": "int32"}}}},
"argument": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.length"}, "type": {"literal": "string"}}},
"argument": {
"application": {
"function": {"application": {"function": {"variable": "hydra.core.lib.strings.splitOn"}, "argument": {"literal": {"string": "e"}}}},
"argument": {"variable": "shown"}}}}}}},
"argument": {"literal": {"integer": {"int32": 1}}}}},
"typeScheme": {"variables": [], "body": {"literal": "boolean"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "fracParts",
"term": {
"application": {
"function": {"application": {"function": {"variable": "hydra.core.lib.strings.splitOn"}, "argument": {"literal": {"string": "."}}}},
"argument": {"variable": "shown"}}},
"typeScheme": {"variables": [], "body": {"list": {"literal": "string"}}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "frac",
"term": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.lib.optionals.withDefault"}, "type": {"literal": "string"}}},
"argument": {"literal": {"string": ""}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.at"}, "type": {"literal": "string"}}},
"argument": {"literal": {"integer": {"int32": 1}}}}},
"argument": {"variable": "fracParts"}}}}},
"typeScheme": {"variables": [], "body": {"literal": "string"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "isWhole",
"term": {
"application": {
"function": {"application": {"function": {"variable": "hydra.core.lib.logic.and"}, "argument": {"variable": "notExponential"}}},
"argument": {
"application": {
"function": {
"application": {
"function": {"variable": "hydra.core.lib.logic.or"},
"argument": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.lib.ordering.lte"}, "type": {"literal": {"integer": "int32"}}}},
"argument": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.length"}, "type": {"literal": "string"}}},
"argument": {"variable": "fracParts"}}}}},
"argument": {"literal": {"integer": {"int32": 1}}}}}}},
"argument": {
"application": {
"function": {"variable": "hydra.core.lib.strings.isEmpty"},
"argument": {
"application": {
"function": {"variable": "hydra.core.lib.strings.concat"},
"argument": {
"application": {
"function": {"application": {"function": {"variable": "hydra.core.lib.strings.splitOn"}, "argument": {"literal": {"string": "0"}}}},
"argument": {"variable": "frac"}}}}}}}}}}},
"typeScheme": {"variables": [], "body": {"literal": "boolean"}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "plain",
"term": {"application": {"function": {"variable": "hydra.core.lib.literals.printBigint"}, "argument": {"variable": "rounded"}}},
"typeScheme": {"variables": [], "body": {"literal": "string"}, "constraints": []}}],
"body": {
"application": {
"function": {"variable": "hydra.core.serialization.cst"},
"argument": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.lib.logic.ifElse"}, "type": {"literal": "string"}}},
"argument": {
"application": {
"function": {"application": {"function": {"variable": "hydra.core.lib.logic.and"}, "argument": {"variable": "isWhole"}}},
"argument": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.lib.ordering.lte"}, "type": {"literal": {"integer": "int32"}}}},
"argument": {"application": {"function": {"variable": "hydra.core.lib.strings.length"}, "argument": {"variable": "plain"}}}}},
"argument": {"application": {"function": {"variable": "hydra.core.lib.strings.length"}, "argument": {"variable": "shown"}}}}}}}}},
"argument": {"variable": "plain"}}},
"argument": {"variable": "shown"}}}}}}}}}}}}}}}}}}}}}},
{
"name": "object",
"handler": {
"lambda": {
"parameter": "obj",
"domain": {"list": {"pair": {"first": {"literal": "string"}, "second": {"variable": "hydra.core.json.model.Value"}}}},
"body": {
"let": {
"bindings": [
{
"name": "els",
"term": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {"variable": "hydra.core.lib.lists.map"},
"type": {"pair": {"first": {"literal": "string"}, "second": {"variable": "hydra.core.json.model.Value"}}}}},
"type": {"variable": "hydra.core.ast.Expr"}}},
"argument": {
"application": {
"function": {
"application": {"function": {"variable": "hydra.core.json.writer.keyValueToExprWith"}, "argument": {"variable": "options"}}},
"argument": {"variable": "childDepth"}}}}},
"argument": {"variable": "obj"}}},
"typeScheme": {"variables": [], "body": {"list": {"variable": "hydra.core.ast.Expr"}}, "constraints": []}}],
"body": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.lib.logic.ifElse"}, "type": {"variable": "hydra.core.ast.Expr"}}},
"argument": {"variable": "compact"}}},
"argument": {
"application": {
"function": {
"application": {
"function": {"variable": "hydra.core.json.writer.compactList"},
"argument": {"variable": "hydra.core.serialization.curlyBraces"}}},
"argument": {"variable": "els"}}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {"application": {"function": {"variable": "hydra.core.json.writer.styleForDepth"}, "argument": {"variable": "options"}}},
"argument": {"variable": "depth"}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {"variable": "hydra.core.serialization.curlyBracesList"},
"argument": {"typeApplication": {"body": {"optional": null}, "type": {"literal": "string"}}}}},
"argument": {"variable": "hydra.core.serialization.inlineStyle"}}},
"argument": {"variable": "els"}}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {"variable": "hydra.core.serialization.curlyBracesList"},
"argument": {"typeApplication": {"body": {"optional": null}, "type": {"literal": "string"}}}}},
"argument": {"variable": "style"}}},
"argument": {"variable": "els"}}}}}}}}}}}},
{
"name": "string",
"handler": {
"lambda": {
"parameter": "s",
"domain": {"literal": "string"},
"body": {
"application": {
"function": {"variable": "hydra.core.serialization.cst"},
"argument": {"application": {"function": {"variable": "hydra.core.json.writer.jsonString"}, "argument": {"variable": "s"}}}}}}}}]}},
"argument": {"variable": "value"}}}}}}}}}}}}}}},
"annotation": {
"map": [
{
"key": {"variable": "description"},
"value": {
"literal": {
"string": "Convert a JSON value to an AST expression for serialization, honoring the given writer options and nesting depth."}}}]}}}}}]}