hydra-kernel-0.18.1: hydra-kernel-json/hydra/core/parsers.json
{
"name": "hydra.core.parsers",
"metadata": {
"description": "General-purpose parser combinators, operating on a Parser type. A helper library, not a set of parse<T> convention functions (see docs/specification/index.md, Conventions).",
"comments": [],
"seeAlso": [],
"provisions": []},
"dependencies": [
{"module": "hydra.core.lib.equality"},
{"module": "hydra.core.lib.lists"},
{"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.parsing"}],
"definitions": [
{
"term": {
"name": "hydra.core.parsers.alt",
"signature": {
"typeParameters": [{"name": "t0", "constraints": []}],
"parameters": [
{
"name": "arg0",
"type": {"application": {"function": {"variable": "hydra.core.parsing.Parser"}, "argument": {"variable": "t0"}}},
"isLazy": false},
{
"name": "arg1",
"type": {"application": {"function": {"variable": "hydra.core.parsing.Parser"}, "argument": {"variable": "t0"}}},
"isLazy": false}],
"result": {"type": {"application": {"function": {"variable": "hydra.core.parsing.Parser"}, "argument": {"variable": "t0"}}}}},
"body": {
"typeLambda": {
"parameter": "t0",
"body": {
"annotated": {
"body": {
"lambda": {
"parameter": "p1",
"domain": {"application": {"function": {"variable": "hydra.core.parsing.Parser"}, "argument": {"variable": "t0"}}},
"body": {
"lambda": {
"parameter": "p2",
"domain": {"application": {"function": {"variable": "hydra.core.parsing.Parser"}, "argument": {"variable": "t0"}}},
"body": {
"let": {
"bindings": [
{
"name": "parse",
"term": {
"lambda": {
"parameter": "input",
"domain": {"variable": "hydra.core.parsing.ParseInput"},
"body": {
"application": {
"function": {
"typeApplication": {
"body": {
"cases": {
"typeName": "hydra.core.parsing.ParseResult",
"cases": [
{
"name": "success",
"handler": {
"lambda": {
"parameter": "s",
"domain": {"application": {"function": {"variable": "hydra.core.parsing.ParseSuccess"}, "argument": {"variable": "t0"}}},
"body": {
"typeApplication": {
"body": {"inject": {"typeName": "hydra.core.parsing.ParseResult", "field": {"name": "success", "term": {"variable": "s"}}}},
"type": {"variable": "t0"}}}}}},
{
"name": "failure",
"handler": {
"lambda": {
"parameter": "e",
"domain": {"variable": "hydra.core.parsing.ParseError"},
"body": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {"variable": "hydra.core.lib.logic.ifElse"},
"type": {"application": {"function": {"variable": "hydra.core.parsing.ParseResult"}, "argument": {"variable": "t0"}}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.lib.equality.equal"}, "type": {"literal": {"integer": "int32"}}}},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.parsing.ParseInput", "fieldName": "offset"}},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.parsing.ParseError", "fieldName": "remainder"}},
"argument": {"variable": "e"}}}}}}},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.parsing.ParseInput", "fieldName": "offset"}},
"argument": {"variable": "input"}}}}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"unwrap": "hydra.core.parsing.Parser"}, "type": {"variable": "t0"}}},
"argument": {"variable": "p2"}}},
"argument": {"variable": "input"}}}}},
"argument": {
"typeApplication": {
"body": {"inject": {"typeName": "hydra.core.parsing.ParseResult", "field": {"name": "failure", "term": {"variable": "e"}}}},
"type": {"variable": "t0"}}}}}}}}]}},
"type": {"variable": "t0"}}},
"argument": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"unwrap": "hydra.core.parsing.Parser"}, "type": {"variable": "t0"}}},
"argument": {"variable": "p1"}}},
"argument": {"variable": "input"}}}}}}},
"typeScheme": {
"variables": [],
"body": {
"function": {
"domain": {"variable": "hydra.core.parsing.ParseInput"},
"codomain": {"application": {"function": {"variable": "hydra.core.parsing.ParseResult"}, "argument": {"variable": "t0"}}}}},
"constraints": []}}],
"body": {
"typeApplication": {"body": {"wrap": {"typeName": "hydra.core.parsing.Parser", "body": {"variable": "parse"}}}, "type": {"variable": "t0"}}}}}}}}},
"annotation": {
"map": [
{
"key": {"variable": "description"},
"value": {"literal": {"string": "Try the first parser; if it fails without consuming input, try the second"}}}]}}}}}}},
{
"term": {
"name": "hydra.core.parsers.anyChar",
"signature": {
"typeParameters": [],
"parameters": [],
"result": {
"type": {"application": {"function": {"variable": "hydra.core.parsing.Parser"}, "argument": {"literal": {"integer": "int32"}}}}}},
"body": {
"annotated": {
"body": {
"application": {
"function": {"variable": "hydra.core.parsers.satisfy"},
"argument": {"lambda": {"parameter": "_", "domain": {"literal": {"integer": "int32"}}, "body": {"literal": {"boolean": true}}}}}},
"annotation": {
"map": [{"key": {"variable": "description"}, "value": {"literal": {"string": "Parse any single character (codepoint)"}}}]}}}}},
{
"term": {
"name": "hydra.core.parsers.apply",
"signature": {
"typeParameters": [{"name": "t0", "constraints": []}, {"name": "t1", "constraints": []}],
"parameters": [
{
"name": "arg0",
"type": {
"application": {
"function": {"variable": "hydra.core.parsing.Parser"},
"argument": {"function": {"domain": {"variable": "t0"}, "codomain": {"variable": "t1"}}}}},
"isLazy": false},
{
"name": "arg1",
"type": {"application": {"function": {"variable": "hydra.core.parsing.Parser"}, "argument": {"variable": "t0"}}},
"isLazy": false}],
"result": {"type": {"application": {"function": {"variable": "hydra.core.parsing.Parser"}, "argument": {"variable": "t1"}}}}},
"body": {
"typeLambda": {
"parameter": "t0",
"body": {
"typeLambda": {
"parameter": "t1",
"body": {
"annotated": {
"body": {
"lambda": {
"parameter": "pf",
"domain": {
"application": {
"function": {"variable": "hydra.core.parsing.Parser"},
"argument": {"function": {"domain": {"variable": "t0"}, "codomain": {"variable": "t1"}}}}},
"body": {
"lambda": {
"parameter": "pa",
"domain": {"application": {"function": {"variable": "hydra.core.parsing.Parser"}, "argument": {"variable": "t0"}}},
"body": {
"let": {
"bindings": [
{
"name": "parse",
"term": {
"lambda": {
"parameter": "input",
"domain": {"variable": "hydra.core.parsing.ParseInput"},
"body": {
"application": {
"function": {
"typeApplication": {
"body": {
"cases": {
"typeName": "hydra.core.parsing.ParseResult",
"cases": [
{
"name": "success",
"handler": {
"lambda": {
"parameter": "sf",
"domain": {
"application": {
"function": {"variable": "hydra.core.parsing.ParseSuccess"},
"argument": {"function": {"domain": {"variable": "t0"}, "codomain": {"variable": "t1"}}}}},
"body": {
"application": {
"function": {
"typeApplication": {
"body": {
"cases": {
"typeName": "hydra.core.parsing.ParseResult",
"cases": [
{
"name": "success",
"handler": {
"lambda": {
"parameter": "sa",
"domain": {"application": {"function": {"variable": "hydra.core.parsing.ParseSuccess"}, "argument": {"variable": "t0"}}},
"body": {
"typeApplication": {
"body": {
"inject": {
"typeName": "hydra.core.parsing.ParseResult",
"field": {
"name": "success",
"term": {
"typeApplication": {
"body": {
"record": {
"typeName": "hydra.core.parsing.ParseSuccess",
"fields": [
{
"name": "value",
"term": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {"project": {"typeName": "hydra.core.parsing.ParseSuccess", "fieldName": "value"}},
"type": {"function": {"domain": {"variable": "t0"}, "codomain": {"variable": "t1"}}}}},
"argument": {"variable": "sf"}}},
"argument": {
"application": {
"function": {
"typeApplication": {"body": {"project": {"typeName": "hydra.core.parsing.ParseSuccess", "fieldName": "value"}}, "type": {"variable": "t0"}}},
"argument": {"variable": "sa"}}}}}},
{
"name": "remainder",
"term": {
"application": {
"function": {
"typeApplication": {
"body": {"project": {"typeName": "hydra.core.parsing.ParseSuccess", "fieldName": "remainder"}},
"type": {"variable": "t0"}}},
"argument": {"variable": "sa"}}}}]}},
"type": {"variable": "t1"}}}}}},
"type": {"variable": "t1"}}}}}},
{
"name": "failure",
"handler": {
"lambda": {
"parameter": "e",
"domain": {"variable": "hydra.core.parsing.ParseError"},
"body": {
"typeApplication": {
"body": {"inject": {"typeName": "hydra.core.parsing.ParseResult", "field": {"name": "failure", "term": {"variable": "e"}}}},
"type": {"variable": "t1"}}}}}}]}},
"type": {"variable": "t0"}}},
"argument": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"unwrap": "hydra.core.parsing.Parser"}, "type": {"variable": "t0"}}},
"argument": {"variable": "pa"}}},
"argument": {
"application": {
"function": {
"typeApplication": {
"body": {"project": {"typeName": "hydra.core.parsing.ParseSuccess", "fieldName": "remainder"}},
"type": {"function": {"domain": {"variable": "t0"}, "codomain": {"variable": "t1"}}}}},
"argument": {"variable": "sf"}}}}}}}}}},
{
"name": "failure",
"handler": {
"lambda": {
"parameter": "e",
"domain": {"variable": "hydra.core.parsing.ParseError"},
"body": {
"typeApplication": {
"body": {"inject": {"typeName": "hydra.core.parsing.ParseResult", "field": {"name": "failure", "term": {"variable": "e"}}}},
"type": {"variable": "t1"}}}}}}]}},
"type": {"function": {"domain": {"variable": "t0"}, "codomain": {"variable": "t1"}}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {"unwrap": "hydra.core.parsing.Parser"},
"type": {"function": {"domain": {"variable": "t0"}, "codomain": {"variable": "t1"}}}}},
"argument": {"variable": "pf"}}},
"argument": {"variable": "input"}}}}}}},
"typeScheme": {
"variables": [],
"body": {
"function": {
"domain": {"variable": "hydra.core.parsing.ParseInput"},
"codomain": {"application": {"function": {"variable": "hydra.core.parsing.ParseResult"}, "argument": {"variable": "t1"}}}}},
"constraints": []}}],
"body": {
"typeApplication": {"body": {"wrap": {"typeName": "hydra.core.parsing.Parser", "body": {"variable": "parse"}}}, "type": {"variable": "t1"}}}}}}}}},
"annotation": {
"map": [
{
"key": {"variable": "description"},
"value": {"literal": {"string": "Apply a parser containing a function to a parser containing a value"}}}]}}}}}}}}},
{
"term": {
"name": "hydra.core.parsers.between",
"signature": {
"typeParameters": [{"name": "t0", "constraints": []}, {"name": "t1", "constraints": []}, {"name": "t2", "constraints": []}],
"parameters": [
{
"name": "arg0",
"type": {"application": {"function": {"variable": "hydra.core.parsing.Parser"}, "argument": {"variable": "t0"}}},
"isLazy": false},
{
"name": "arg1",
"type": {"application": {"function": {"variable": "hydra.core.parsing.Parser"}, "argument": {"variable": "t1"}}},
"isLazy": false},
{
"name": "arg2",
"type": {"application": {"function": {"variable": "hydra.core.parsing.Parser"}, "argument": {"variable": "t2"}}},
"isLazy": false}],
"result": {"type": {"application": {"function": {"variable": "hydra.core.parsing.Parser"}, "argument": {"variable": "t2"}}}}},
"body": {
"typeLambda": {
"parameter": "t0",
"body": {
"typeLambda": {
"parameter": "t1",
"body": {
"typeLambda": {
"parameter": "t2",
"body": {
"annotated": {
"body": {
"lambda": {
"parameter": "open",
"domain": {"application": {"function": {"variable": "hydra.core.parsing.Parser"}, "argument": {"variable": "t0"}}},
"body": {
"lambda": {
"parameter": "close",
"domain": {"application": {"function": {"variable": "hydra.core.parsing.Parser"}, "argument": {"variable": "t1"}}},
"body": {
"lambda": {
"parameter": "p",
"domain": {"application": {"function": {"variable": "hydra.core.parsing.Parser"}, "argument": {"variable": "t2"}}},
"body": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.parsers.bind"}, "type": {"variable": "t0"}}},
"type": {"variable": "t2"}}},
"argument": {"variable": "open"}}},
"argument": {
"lambda": {
"parameter": "_",
"domain": {"variable": "t0"},
"body": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.parsers.bind"}, "type": {"variable": "t2"}}},
"type": {"variable": "t2"}}},
"argument": {"variable": "p"}}},
"argument": {
"lambda": {
"parameter": "x",
"domain": {"variable": "t2"},
"body": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.parsers.bind"}, "type": {"variable": "t1"}}},
"type": {"variable": "t2"}}},
"argument": {"variable": "close"}}},
"argument": {
"lambda": {
"parameter": "_",
"domain": {"variable": "t1"},
"body": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.parsers.pure"}, "type": {"variable": "t2"}}},
"argument": {"variable": "x"}}}}}}}}}}}}}}}}}}}}},
"annotation": {
"map": [
{
"key": {"variable": "description"},
"value": {"literal": {"string": "Parse something between an opening and closing parser"}}}]}}}}}}}}}}},
{
"term": {
"name": "hydra.core.parsers.bind",
"signature": {
"typeParameters": [{"name": "t0", "constraints": []}, {"name": "t1", "constraints": []}],
"parameters": [
{
"name": "arg0",
"type": {"application": {"function": {"variable": "hydra.core.parsing.Parser"}, "argument": {"variable": "t0"}}},
"isLazy": false},
{
"name": "arg1",
"type": {
"function": {
"domain": {"variable": "t0"},
"codomain": {"application": {"function": {"variable": "hydra.core.parsing.Parser"}, "argument": {"variable": "t1"}}}}},
"isLazy": false}],
"result": {"type": {"application": {"function": {"variable": "hydra.core.parsing.Parser"}, "argument": {"variable": "t1"}}}}},
"body": {
"typeLambda": {
"parameter": "t0",
"body": {
"typeLambda": {
"parameter": "t1",
"body": {
"annotated": {
"body": {
"lambda": {
"parameter": "pa",
"domain": {"application": {"function": {"variable": "hydra.core.parsing.Parser"}, "argument": {"variable": "t0"}}},
"body": {
"lambda": {
"parameter": "f",
"domain": {
"function": {
"domain": {"variable": "t0"},
"codomain": {"application": {"function": {"variable": "hydra.core.parsing.Parser"}, "argument": {"variable": "t1"}}}}},
"body": {
"let": {
"bindings": [
{
"name": "parse",
"term": {
"lambda": {
"parameter": "input",
"domain": {"variable": "hydra.core.parsing.ParseInput"},
"body": {
"application": {
"function": {
"typeApplication": {
"body": {
"cases": {
"typeName": "hydra.core.parsing.ParseResult",
"cases": [
{
"name": "success",
"handler": {
"lambda": {
"parameter": "s",
"domain": {"application": {"function": {"variable": "hydra.core.parsing.ParseSuccess"}, "argument": {"variable": "t0"}}},
"body": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"unwrap": "hydra.core.parsing.Parser"}, "type": {"variable": "t1"}}},
"argument": {
"application": {
"function": {"variable": "f"},
"argument": {
"application": {
"function": {
"typeApplication": {"body": {"project": {"typeName": "hydra.core.parsing.ParseSuccess", "fieldName": "value"}}, "type": {"variable": "t0"}}},
"argument": {"variable": "s"}}}}}}},
"argument": {
"application": {
"function": {
"typeApplication": {
"body": {"project": {"typeName": "hydra.core.parsing.ParseSuccess", "fieldName": "remainder"}},
"type": {"variable": "t0"}}},
"argument": {"variable": "s"}}}}}}}},
{
"name": "failure",
"handler": {
"lambda": {
"parameter": "e",
"domain": {"variable": "hydra.core.parsing.ParseError"},
"body": {
"typeApplication": {
"body": {"inject": {"typeName": "hydra.core.parsing.ParseResult", "field": {"name": "failure", "term": {"variable": "e"}}}},
"type": {"variable": "t1"}}}}}}]}},
"type": {"variable": "t0"}}},
"argument": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"unwrap": "hydra.core.parsing.Parser"}, "type": {"variable": "t0"}}},
"argument": {"variable": "pa"}}},
"argument": {"variable": "input"}}}}}}},
"typeScheme": {
"variables": [],
"body": {
"function": {
"domain": {"variable": "hydra.core.parsing.ParseInput"},
"codomain": {"application": {"function": {"variable": "hydra.core.parsing.ParseResult"}, "argument": {"variable": "t1"}}}}},
"constraints": []}}],
"body": {
"typeApplication": {"body": {"wrap": {"typeName": "hydra.core.parsing.Parser", "body": {"variable": "parse"}}}, "type": {"variable": "t1"}}}}}}}}},
"annotation": {
"map": [
{
"key": {"variable": "description"},
"value": {"literal": {"string": "Sequence two parsers, passing the result of the first to a function that produces the second"}}}]}}}}}}}}},
{
"term": {
"name": "hydra.core.parsers.char",
"signature": {
"typeParameters": [],
"parameters": [{"name": "arg0", "type": {"literal": {"integer": "int32"}}, "isLazy": false}],
"result": {
"type": {"application": {"function": {"variable": "hydra.core.parsing.Parser"}, "argument": {"literal": {"integer": "int32"}}}}}},
"body": {
"annotated": {
"body": {
"lambda": {
"parameter": "c",
"domain": {"literal": {"integer": "int32"}},
"body": {
"application": {
"function": {"variable": "hydra.core.parsers.satisfy"},
"argument": {
"lambda": {
"parameter": "x",
"domain": {"literal": {"integer": "int32"}},
"body": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.lib.equality.equal"}, "type": {"literal": {"integer": "int32"}}}},
"argument": {"variable": "x"}}},
"argument": {"variable": "c"}}}}}}}}},
"annotation": {
"map": [{"key": {"variable": "description"}, "value": {"literal": {"string": "Parse a specific character (codepoint)"}}}]}}}}},
{
"term": {
"name": "hydra.core.parsers.choice",
"signature": {
"typeParameters": [{"name": "t0", "constraints": []}],
"parameters": [
{
"name": "arg0",
"type": {"list": {"application": {"function": {"variable": "hydra.core.parsing.Parser"}, "argument": {"variable": "t0"}}}},
"isLazy": false}],
"result": {"type": {"application": {"function": {"variable": "hydra.core.parsing.Parser"}, "argument": {"variable": "t0"}}}}},
"body": {
"typeLambda": {
"parameter": "t0",
"body": {
"annotated": {
"body": {
"lambda": {
"parameter": "ps",
"domain": {"list": {"application": {"function": {"variable": "hydra.core.parsing.Parser"}, "argument": {"variable": "t0"}}}},
"body": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {"variable": "hydra.core.lib.lists.foldl"},
"type": {"application": {"function": {"variable": "hydra.core.parsing.Parser"}, "argument": {"variable": "t0"}}}}},
"type": {"application": {"function": {"variable": "hydra.core.parsing.Parser"}, "argument": {"variable": "t0"}}}}},
"argument": {"typeApplication": {"body": {"variable": "hydra.core.parsers.alt"}, "type": {"variable": "t0"}}}}},
"argument": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.parsers.fail"}, "type": {"variable": "t0"}}},
"argument": {"literal": {"string": "no choice matched"}}}}}},
"argument": {"variable": "ps"}}}}},
"annotation": {
"map": [
{"key": {"variable": "description"}, "value": {"literal": {"string": "Try each parser in the list until one succeeds"}}}]}}}}}}},
{
"term": {
"name": "hydra.core.parsers.eof",
"signature": {
"typeParameters": [],
"parameters": [],
"result": {"type": {"application": {"function": {"variable": "hydra.core.parsing.Parser"}, "argument": "unit"}}}},
"body": {
"annotated": {
"body": {
"typeApplication": {
"body": {
"wrap": {
"typeName": "hydra.core.parsing.Parser",
"body": {
"lambda": {
"parameter": "input",
"domain": {"variable": "hydra.core.parsing.ParseInput"},
"body": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {"variable": "hydra.core.lib.logic.ifElse"},
"type": {"application": {"function": {"variable": "hydra.core.parsing.ParseResult"}, "argument": "unit"}}}},
"argument": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.isEmpty"}, "type": {"literal": {"integer": "int32"}}}},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.parsing.ParseInput", "fieldName": "codepoints"}},
"argument": {"variable": "input"}}}}}}},
"argument": {
"typeApplication": {
"body": {
"inject": {
"typeName": "hydra.core.parsing.ParseResult",
"field": {
"name": "success",
"term": {
"typeApplication": {
"body": {
"record": {
"typeName": "hydra.core.parsing.ParseSuccess",
"fields": [{"name": "value", "term": "unit"}, {"name": "remainder", "term": {"variable": "input"}}]}},
"type": "unit"}}}}},
"type": "unit"}}}},
"argument": {
"typeApplication": {
"body": {
"inject": {
"typeName": "hydra.core.parsing.ParseResult",
"field": {
"name": "failure",
"term": {
"record": {
"typeName": "hydra.core.parsing.ParseError",
"fields": [
{"name": "message", "term": {"literal": {"string": "expected end of input"}}},
{"name": "remainder", "term": {"variable": "input"}}]}}}}},
"type": "unit"}}}}}}}},
"type": "unit"}},
"annotation": {
"map": [
{
"key": {"variable": "description"},
"value": {"literal": {"string": "A parser that succeeds only at the end of input"}}}]}}}}},
{
"term": {
"name": "hydra.core.parsers.fail",
"signature": {
"typeParameters": [{"name": "t0", "constraints": []}],
"parameters": [{"name": "arg0", "type": {"literal": "string"}, "isLazy": false}],
"result": {"type": {"application": {"function": {"variable": "hydra.core.parsing.Parser"}, "argument": {"variable": "t0"}}}}},
"body": {
"typeLambda": {
"parameter": "t0",
"body": {
"annotated": {
"body": {
"lambda": {
"parameter": "msg",
"domain": {"literal": "string"},
"body": {
"typeApplication": {
"body": {
"wrap": {
"typeName": "hydra.core.parsing.Parser",
"body": {
"lambda": {
"parameter": "input",
"domain": {"variable": "hydra.core.parsing.ParseInput"},
"body": {
"typeApplication": {
"body": {
"inject": {
"typeName": "hydra.core.parsing.ParseResult",
"field": {
"name": "failure",
"term": {
"record": {
"typeName": "hydra.core.parsing.ParseError",
"fields": [{"name": "message", "term": {"variable": "msg"}}, {"name": "remainder", "term": {"variable": "input"}}]}}}}},
"type": {"variable": "t0"}}}}}}},
"type": {"variable": "t0"}}}}},
"annotation": {
"map": [
{
"key": {"variable": "description"},
"value": {"literal": {"string": "A parser that always fails with the given error message"}}}]}}}}}}},
{
"term": {
"name": "hydra.core.parsers.lazy",
"signature": {
"typeParameters": [{"name": "t0", "constraints": []}],
"parameters": [
{
"name": "arg0",
"type": {
"function": {
"domain": "unit",
"codomain": {"application": {"function": {"variable": "hydra.core.parsing.Parser"}, "argument": {"variable": "t0"}}}}},
"isLazy": false}],
"result": {"type": {"application": {"function": {"variable": "hydra.core.parsing.Parser"}, "argument": {"variable": "t0"}}}}},
"body": {
"typeLambda": {
"parameter": "t0",
"body": {
"annotated": {
"body": {
"lambda": {
"parameter": "f",
"domain": {
"function": {
"domain": "unit",
"codomain": {"application": {"function": {"variable": "hydra.core.parsing.Parser"}, "argument": {"variable": "t0"}}}}},
"body": {
"typeApplication": {
"body": {
"wrap": {
"typeName": "hydra.core.parsing.Parser",
"body": {
"lambda": {
"parameter": "input",
"domain": {"variable": "hydra.core.parsing.ParseInput"},
"body": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"unwrap": "hydra.core.parsing.Parser"}, "type": {"variable": "t0"}}},
"argument": {"application": {"function": {"variable": "f"}, "argument": "unit"}}}},
"argument": {"variable": "input"}}}}}}},
"type": {"variable": "t0"}}}}},
"annotation": {
"map": [
{
"key": {"variable": "description"},
"value": {
"literal": {
"string": "Create a parser that defers construction of another parser until parsing time. This is essential for breaking recursive parser definitions."}}}]}}}}}}},
{
"term": {
"name": "hydra.core.parsers.many",
"signature": {
"typeParameters": [{"name": "t0", "constraints": []}],
"parameters": [
{
"name": "arg0",
"type": {"application": {"function": {"variable": "hydra.core.parsing.Parser"}, "argument": {"variable": "t0"}}},
"isLazy": false}],
"result": {
"type": {"application": {"function": {"variable": "hydra.core.parsing.Parser"}, "argument": {"list": {"variable": "t0"}}}}}},
"body": {
"typeLambda": {
"parameter": "t0",
"body": {
"annotated": {
"body": {
"lambda": {
"parameter": "p",
"domain": {"application": {"function": {"variable": "hydra.core.parsing.Parser"}, "argument": {"variable": "t0"}}},
"body": {
"let": {
"bindings": [
{
"name": "parse",
"term": {
"lambda": {
"parameter": "input",
"domain": {"variable": "hydra.core.parsing.ParseInput"},
"body": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.parsers.manyLoop"}, "type": {"variable": "t0"}}},
"argument": {"variable": "p"}}},
"argument": {"variable": "input"}}},
"argument": {"typeApplication": {"body": {"list": []}, "type": {"variable": "t0"}}}}}}},
"typeScheme": {
"variables": [],
"body": {
"function": {
"domain": {"variable": "hydra.core.parsing.ParseInput"},
"codomain": {"application": {"function": {"variable": "hydra.core.parsing.ParseResult"}, "argument": {"list": {"variable": "t0"}}}}}},
"constraints": []}}],
"body": {
"typeApplication": {
"body": {"wrap": {"typeName": "hydra.core.parsing.Parser", "body": {"variable": "parse"}}},
"type": {"list": {"variable": "t0"}}}}}}}},
"annotation": {
"map": [
{
"key": {"variable": "description"},
"value": {"literal": {"string": "Parse zero or more occurrences of the given parser"}}}]}}}}}}},
{
"term": {
"name": "hydra.core.parsers.manyLoop",
"signature": {
"typeParameters": [{"name": "t0", "constraints": []}],
"parameters": [
{
"name": "arg0",
"type": {"application": {"function": {"variable": "hydra.core.parsing.Parser"}, "argument": {"variable": "t0"}}},
"isLazy": false},
{"name": "arg1", "type": {"variable": "hydra.core.parsing.ParseInput"}, "isLazy": false},
{"name": "arg2", "type": {"list": {"variable": "t0"}}, "isLazy": false}],
"result": {
"type": {"application": {"function": {"variable": "hydra.core.parsing.ParseResult"}, "argument": {"list": {"variable": "t0"}}}}}},
"body": {
"typeLambda": {
"parameter": "t0",
"body": {
"annotated": {
"body": {
"lambda": {
"parameter": "p",
"domain": {"application": {"function": {"variable": "hydra.core.parsing.Parser"}, "argument": {"variable": "t0"}}},
"body": {
"lambda": {
"parameter": "input",
"domain": {"variable": "hydra.core.parsing.ParseInput"},
"body": {
"lambda": {
"parameter": "acc",
"domain": {"list": {"variable": "t0"}},
"body": {
"application": {
"function": {
"typeApplication": {
"body": {
"cases": {
"typeName": "hydra.core.parsing.ParseResult",
"cases": [
{
"name": "success",
"handler": {
"lambda": {
"parameter": "s",
"domain": {"application": {"function": {"variable": "hydra.core.parsing.ParseSuccess"}, "argument": {"variable": "t0"}}},
"body": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.parsers.manyLoop"}, "type": {"variable": "t0"}}},
"argument": {"variable": "p"}}},
"argument": {
"application": {
"function": {
"typeApplication": {
"body": {"project": {"typeName": "hydra.core.parsing.ParseSuccess", "fieldName": "remainder"}},
"type": {"variable": "t0"}}},
"argument": {"variable": "s"}}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.cons"}, "type": {"variable": "t0"}}},
"argument": {
"application": {
"function": {
"typeApplication": {"body": {"project": {"typeName": "hydra.core.parsing.ParseSuccess", "fieldName": "value"}}, "type": {"variable": "t0"}}},
"argument": {"variable": "s"}}}}},
"argument": {"variable": "acc"}}}}}}}},
{
"name": "failure",
"handler": {
"lambda": {
"parameter": "_",
"domain": {"variable": "hydra.core.parsing.ParseError"},
"body": {
"typeApplication": {
"body": {
"inject": {
"typeName": "hydra.core.parsing.ParseResult",
"field": {
"name": "success",
"term": {
"typeApplication": {
"body": {
"record": {
"typeName": "hydra.core.parsing.ParseSuccess",
"fields": [
{
"name": "value",
"term": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.reverse"}, "type": {"variable": "t0"}}},
"argument": {"variable": "acc"}}}},
{"name": "remainder", "term": {"variable": "input"}}]}},
"type": {"list": {"variable": "t0"}}}}}}},
"type": {"list": {"variable": "t0"}}}}}}}]}},
"type": {"variable": "t0"}}},
"argument": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"unwrap": "hydra.core.parsing.Parser"}, "type": {"variable": "t0"}}},
"argument": {"variable": "p"}}},
"argument": {"variable": "input"}}}}}}}}}}},
"annotation": {
"map": [
{
"key": {"variable": "description"},
"value": {"literal": {"string": "Repeatedly apply a parser, accumulating results, until it fails"}}}]}}}}}}},
{
"term": {
"name": "hydra.core.parsers.map",
"signature": {
"typeParameters": [{"name": "t0", "constraints": []}, {"name": "t1", "constraints": []}],
"parameters": [
{"name": "arg0", "type": {"function": {"domain": {"variable": "t0"}, "codomain": {"variable": "t1"}}}, "isLazy": false},
{
"name": "arg1",
"type": {"application": {"function": {"variable": "hydra.core.parsing.Parser"}, "argument": {"variable": "t0"}}},
"isLazy": false}],
"result": {"type": {"application": {"function": {"variable": "hydra.core.parsing.Parser"}, "argument": {"variable": "t1"}}}}},
"body": {
"typeLambda": {
"parameter": "t0",
"body": {
"typeLambda": {
"parameter": "t1",
"body": {
"annotated": {
"body": {
"lambda": {
"parameter": "f",
"domain": {"function": {"domain": {"variable": "t0"}, "codomain": {"variable": "t1"}}},
"body": {
"lambda": {
"parameter": "pa",
"domain": {"application": {"function": {"variable": "hydra.core.parsing.Parser"}, "argument": {"variable": "t0"}}},
"body": {
"let": {
"bindings": [
{
"name": "parse",
"term": {
"lambda": {
"parameter": "input",
"domain": {"variable": "hydra.core.parsing.ParseInput"},
"body": {
"application": {
"function": {
"typeApplication": {
"body": {
"cases": {
"typeName": "hydra.core.parsing.ParseResult",
"cases": [
{
"name": "success",
"handler": {
"lambda": {
"parameter": "s",
"domain": {"application": {"function": {"variable": "hydra.core.parsing.ParseSuccess"}, "argument": {"variable": "t0"}}},
"body": {
"typeApplication": {
"body": {
"inject": {
"typeName": "hydra.core.parsing.ParseResult",
"field": {
"name": "success",
"term": {
"typeApplication": {
"body": {
"record": {
"typeName": "hydra.core.parsing.ParseSuccess",
"fields": [
{
"name": "value",
"term": {
"application": {
"function": {"variable": "f"},
"argument": {
"application": {
"function": {
"typeApplication": {"body": {"project": {"typeName": "hydra.core.parsing.ParseSuccess", "fieldName": "value"}}, "type": {"variable": "t0"}}},
"argument": {"variable": "s"}}}}}},
{
"name": "remainder",
"term": {
"application": {
"function": {
"typeApplication": {
"body": {"project": {"typeName": "hydra.core.parsing.ParseSuccess", "fieldName": "remainder"}},
"type": {"variable": "t0"}}},
"argument": {"variable": "s"}}}}]}},
"type": {"variable": "t1"}}}}}},
"type": {"variable": "t1"}}}}}},
{
"name": "failure",
"handler": {
"lambda": {
"parameter": "e",
"domain": {"variable": "hydra.core.parsing.ParseError"},
"body": {
"typeApplication": {
"body": {"inject": {"typeName": "hydra.core.parsing.ParseResult", "field": {"name": "failure", "term": {"variable": "e"}}}},
"type": {"variable": "t1"}}}}}}]}},
"type": {"variable": "t0"}}},
"argument": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"unwrap": "hydra.core.parsing.Parser"}, "type": {"variable": "t0"}}},
"argument": {"variable": "pa"}}},
"argument": {"variable": "input"}}}}}}},
"typeScheme": {
"variables": [],
"body": {
"function": {
"domain": {"variable": "hydra.core.parsing.ParseInput"},
"codomain": {"application": {"function": {"variable": "hydra.core.parsing.ParseResult"}, "argument": {"variable": "t1"}}}}},
"constraints": []}}],
"body": {
"typeApplication": {"body": {"wrap": {"typeName": "hydra.core.parsing.Parser", "body": {"variable": "parse"}}}, "type": {"variable": "t1"}}}}}}}}},
"annotation": {
"map": [{"key": {"variable": "description"}, "value": {"literal": {"string": "Apply a function to the result of a parser"}}}]}}}}}}}}},
{
"term": {
"name": "hydra.core.parsers.markTokenEnd",
"signature": {
"typeParameters": [],
"parameters": [],
"result": {"type": {"application": {"function": {"variable": "hydra.core.parsing.Parser"}, "argument": "unit"}}}},
"body": {
"annotated": {
"body": {
"typeApplication": {
"body": {
"wrap": {
"typeName": "hydra.core.parsing.Parser",
"body": {
"lambda": {
"parameter": "input",
"domain": {"variable": "hydra.core.parsing.ParseInput"},
"body": {
"typeApplication": {
"body": {
"inject": {
"typeName": "hydra.core.parsing.ParseResult",
"field": {
"name": "success",
"term": {
"typeApplication": {
"body": {
"record": {
"typeName": "hydra.core.parsing.ParseSuccess",
"fields": [
{"name": "value", "term": "unit"},
{
"name": "remainder",
"term": {
"record": {
"typeName": "hydra.core.parsing.ParseInput",
"fields": [
{
"name": "offset",
"term": {
"application": {
"function": {"project": {"typeName": "hydra.core.parsing.ParseInput", "fieldName": "offset"}},
"argument": {"variable": "input"}}}},
{
"name": "tokenEnd",
"term": {
"application": {
"function": {"project": {"typeName": "hydra.core.parsing.ParseInput", "fieldName": "offset"}},
"argument": {"variable": "input"}}}},
{
"name": "codepoints",
"term": {
"application": {
"function": {"project": {"typeName": "hydra.core.parsing.ParseInput", "fieldName": "codepoints"}},
"argument": {"variable": "input"}}}}]}}}]}},
"type": "unit"}}}}},
"type": "unit"}}}}}},
"type": "unit"}},
"annotation": {
"map": [
{
"key": {"variable": "description"},
"value": {
"literal": {
"string": "Record that a token has just been completed, so that a surrounding 'spanned' parser can end its span here rather than after any trailing whitespace or comments. Consumes no input."}}}]}}}}},
{
"term": {
"name": "hydra.core.parsers.optional",
"signature": {
"typeParameters": [{"name": "t0", "constraints": []}],
"parameters": [
{
"name": "arg0",
"type": {"application": {"function": {"variable": "hydra.core.parsing.Parser"}, "argument": {"variable": "t0"}}},
"isLazy": false}],
"result": {
"type": {"application": {"function": {"variable": "hydra.core.parsing.Parser"}, "argument": {"optional": {"variable": "t0"}}}}}},
"body": {
"typeLambda": {
"parameter": "t0",
"body": {
"annotated": {
"body": {
"lambda": {
"parameter": "p",
"domain": {"application": {"function": {"variable": "hydra.core.parsing.Parser"}, "argument": {"variable": "t0"}}},
"body": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.parsers.alt"}, "type": {"optional": {"variable": "t0"}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.parsers.map"}, "type": {"variable": "t0"}}},
"type": {"optional": {"variable": "t0"}}}},
"argument": {"typeApplication": {"body": {"variable": "hydra.core.lib.optionals.given"}, "type": {"variable": "t0"}}}}},
"argument": {"variable": "p"}}}}},
"argument": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.parsers.pure"}, "type": {"optional": {"variable": "t0"}}}},
"argument": {"typeApplication": {"body": {"optional": null}, "type": {"variable": "t0"}}}}}}}}},
"annotation": {
"map": [
{
"key": {"variable": "description"},
"value": {"literal": {"string": "Optionally parse something, returning Nothing if it fails"}}}]}}}}}}},
{
"term": {
"name": "hydra.core.parsers.pure",
"signature": {
"typeParameters": [{"name": "t0", "constraints": []}],
"parameters": [{"name": "arg0", "type": {"variable": "t0"}, "isLazy": false}],
"result": {"type": {"application": {"function": {"variable": "hydra.core.parsing.Parser"}, "argument": {"variable": "t0"}}}}},
"body": {
"typeLambda": {
"parameter": "t0",
"body": {
"annotated": {
"body": {
"lambda": {
"parameter": "a",
"domain": {"variable": "t0"},
"body": {
"typeApplication": {
"body": {
"wrap": {
"typeName": "hydra.core.parsing.Parser",
"body": {
"lambda": {
"parameter": "input",
"domain": {"variable": "hydra.core.parsing.ParseInput"},
"body": {
"typeApplication": {
"body": {
"inject": {
"typeName": "hydra.core.parsing.ParseResult",
"field": {
"name": "success",
"term": {
"typeApplication": {
"body": {
"record": {
"typeName": "hydra.core.parsing.ParseSuccess",
"fields": [{"name": "value", "term": {"variable": "a"}}, {"name": "remainder", "term": {"variable": "input"}}]}},
"type": {"variable": "t0"}}}}}},
"type": {"variable": "t0"}}}}}}},
"type": {"variable": "t0"}}}}},
"annotation": {
"map": [
{
"key": {"variable": "description"},
"value": {"literal": {"string": "A parser that always succeeds with the given value without consuming input"}}}]}}}}}}},
{
"term": {
"name": "hydra.core.parsers.runParser",
"signature": {
"typeParameters": [{"name": "t0", "constraints": []}],
"parameters": [
{
"name": "arg0",
"type": {"application": {"function": {"variable": "hydra.core.parsing.Parser"}, "argument": {"variable": "t0"}}},
"isLazy": false},
{"name": "arg1", "type": {"literal": "string"}, "isLazy": false}],
"result": {"type": {"application": {"function": {"variable": "hydra.core.parsing.ParseResult"}, "argument": {"variable": "t0"}}}}},
"body": {
"typeLambda": {
"parameter": "t0",
"body": {
"annotated": {
"body": {
"lambda": {
"parameter": "p",
"domain": {"application": {"function": {"variable": "hydra.core.parsing.Parser"}, "argument": {"variable": "t0"}}},
"body": {
"lambda": {
"parameter": "input",
"domain": {"literal": "string"},
"body": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"unwrap": "hydra.core.parsing.Parser"}, "type": {"variable": "t0"}}},
"argument": {"variable": "p"}}},
"argument": {
"record": {
"typeName": "hydra.core.parsing.ParseInput",
"fields": [
{"name": "offset", "term": {"literal": {"integer": {"int32": 0}}}},
{"name": "tokenEnd", "term": {"literal": {"integer": {"int32": 0}}}},
{
"name": "codepoints",
"term": {"application": {"function": {"variable": "hydra.core.lib.strings.toList"}, "argument": {"variable": "input"}}}}]}}}}}}}},
"annotation": {
"map": [
{
"key": {"variable": "description"},
"value": {
"literal": {
"string": "Run a parser on the given input string. The string is converted to a codepoint list once, up front, so that the parser itself can consume characters in constant time."}}}]}}}}}}},
{
"term": {
"name": "hydra.core.parsers.satisfy",
"signature": {
"typeParameters": [],
"parameters": [
{
"name": "arg0",
"type": {"function": {"domain": {"literal": {"integer": "int32"}}, "codomain": {"literal": "boolean"}}},
"isLazy": false}],
"result": {
"type": {"application": {"function": {"variable": "hydra.core.parsing.Parser"}, "argument": {"literal": {"integer": "int32"}}}}}},
"body": {
"annotated": {
"body": {
"lambda": {
"parameter": "pred",
"domain": {"function": {"domain": {"literal": {"integer": "int32"}}, "codomain": {"literal": "boolean"}}},
"body": {
"let": {
"bindings": [
{
"name": "parse",
"term": {
"lambda": {
"parameter": "input",
"domain": {"variable": "hydra.core.parsing.ParseInput"},
"body": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {"variable": "hydra.core.lib.optionals.match"},
"type": {"pair": {"first": {"literal": {"integer": "int32"}}, "second": {"list": {"literal": {"integer": "int32"}}}}}}},
"type": {
"application": {"function": {"variable": "hydra.core.parsing.ParseResult"}, "argument": {"literal": {"integer": "int32"}}}}}},
"argument": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.uncons"}, "type": {"literal": {"integer": "int32"}}}},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.parsing.ParseInput", "fieldName": "codepoints"}},
"argument": {"variable": "input"}}}}}}},
"argument": {
"typeApplication": {
"body": {
"inject": {
"typeName": "hydra.core.parsing.ParseResult",
"field": {
"name": "failure",
"term": {
"record": {
"typeName": "hydra.core.parsing.ParseError",
"fields": [
{"name": "message", "term": {"literal": {"string": "unexpected end of input"}}},
{"name": "remainder", "term": {"variable": "input"}}]}}}}},
"type": {"literal": {"integer": "int32"}}}}}},
"argument": {
"lambda": {
"parameter": "uc",
"domain": {"pair": {"first": {"literal": {"integer": "int32"}}, "second": {"list": {"literal": {"integer": "int32"}}}}},
"body": {
"let": {
"bindings": [
{
"name": "c",
"term": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"literal": {"integer": "int32"}}}},
"type": {"list": {"literal": {"integer": "int32"}}}}},
"argument": {"variable": "uc"}}},
"typeScheme": {"variables": [], "body": {"literal": {"integer": "int32"}}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "rest",
"term": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"literal": {"integer": "int32"}}}},
"type": {"list": {"literal": {"integer": "int32"}}}}},
"argument": {"variable": "uc"}}},
"typeScheme": {"variables": [], "body": {"list": {"literal": {"integer": "int32"}}}, "constraints": []}}],
"body": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {"variable": "hydra.core.lib.logic.ifElse"},
"type": {
"application": {"function": {"variable": "hydra.core.parsing.ParseResult"}, "argument": {"literal": {"integer": "int32"}}}}}},
"argument": {"application": {"function": {"variable": "pred"}, "argument": {"variable": "c"}}}}},
"argument": {
"typeApplication": {
"body": {
"inject": {
"typeName": "hydra.core.parsing.ParseResult",
"field": {
"name": "success",
"term": {
"typeApplication": {
"body": {
"record": {
"typeName": "hydra.core.parsing.ParseSuccess",
"fields": [
{"name": "value", "term": {"variable": "c"}},
{
"name": "remainder",
"term": {
"record": {
"typeName": "hydra.core.parsing.ParseInput",
"fields": [
{
"name": "offset",
"term": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.lib.math.add"}, "type": {"literal": {"integer": "int32"}}}},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.parsing.ParseInput", "fieldName": "offset"}},
"argument": {"variable": "input"}}}}},
"argument": {"literal": {"integer": {"int32": 1}}}}}},
{
"name": "tokenEnd",
"term": {
"application": {
"function": {"project": {"typeName": "hydra.core.parsing.ParseInput", "fieldName": "tokenEnd"}},
"argument": {"variable": "input"}}}},
{"name": "codepoints", "term": {"variable": "rest"}}]}}}]}},
"type": {"literal": {"integer": "int32"}}}}}}},
"type": {"literal": {"integer": "int32"}}}}}},
"argument": {
"typeApplication": {
"body": {
"inject": {
"typeName": "hydra.core.parsing.ParseResult",
"field": {
"name": "failure",
"term": {
"record": {
"typeName": "hydra.core.parsing.ParseError",
"fields": [
{"name": "message", "term": {"literal": {"string": "character did not satisfy predicate"}}},
{"name": "remainder", "term": {"variable": "input"}}]}}}}},
"type": {"literal": {"integer": "int32"}}}}}}}}}}}}}}}},
"typeScheme": {
"variables": [],
"body": {
"function": {
"domain": {"variable": "hydra.core.parsing.ParseInput"},
"codomain": {
"application": {"function": {"variable": "hydra.core.parsing.ParseResult"}, "argument": {"literal": {"integer": "int32"}}}}}},
"constraints": []}}],
"body": {
"typeApplication": {
"body": {"wrap": {"typeName": "hydra.core.parsing.Parser", "body": {"variable": "parse"}}},
"type": {"literal": {"integer": "int32"}}}}}}}},
"annotation": {
"map": [
{
"key": {"variable": "description"},
"value": {"literal": {"string": "Parse a character (codepoint) that satisfies the given predicate"}}}]}}}}},
{
"term": {
"name": "hydra.core.parsers.sepBy",
"signature": {
"typeParameters": [{"name": "t0", "constraints": []}, {"name": "t1", "constraints": []}],
"parameters": [
{
"name": "arg0",
"type": {"application": {"function": {"variable": "hydra.core.parsing.Parser"}, "argument": {"variable": "t0"}}},
"isLazy": false},
{
"name": "arg1",
"type": {"application": {"function": {"variable": "hydra.core.parsing.Parser"}, "argument": {"variable": "t1"}}},
"isLazy": false}],
"result": {
"type": {"application": {"function": {"variable": "hydra.core.parsing.Parser"}, "argument": {"list": {"variable": "t0"}}}}}},
"body": {
"typeLambda": {
"parameter": "t0",
"body": {
"typeLambda": {
"parameter": "t1",
"body": {
"annotated": {
"body": {
"lambda": {
"parameter": "p",
"domain": {"application": {"function": {"variable": "hydra.core.parsing.Parser"}, "argument": {"variable": "t0"}}},
"body": {
"lambda": {
"parameter": "sep",
"domain": {"application": {"function": {"variable": "hydra.core.parsing.Parser"}, "argument": {"variable": "t1"}}},
"body": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.parsers.alt"}, "type": {"list": {"variable": "t0"}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.parsers.sepBy1"}, "type": {"variable": "t0"}}},
"type": {"variable": "t1"}}},
"argument": {"variable": "p"}}},
"argument": {"variable": "sep"}}}}},
"argument": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.parsers.pure"}, "type": {"list": {"variable": "t0"}}}},
"argument": {"typeApplication": {"body": {"list": []}, "type": {"variable": "t0"}}}}}}}}}}},
"annotation": {
"map": [
{
"key": {"variable": "description"},
"value": {"literal": {"string": "Parse zero or more occurrences separated by a separator"}}}]}}}}}}}}},
{
"term": {
"name": "hydra.core.parsers.sepBy1",
"signature": {
"typeParameters": [{"name": "t0", "constraints": []}, {"name": "t1", "constraints": []}],
"parameters": [
{
"name": "arg0",
"type": {"application": {"function": {"variable": "hydra.core.parsing.Parser"}, "argument": {"variable": "t0"}}},
"isLazy": false},
{
"name": "arg1",
"type": {"application": {"function": {"variable": "hydra.core.parsing.Parser"}, "argument": {"variable": "t1"}}},
"isLazy": false}],
"result": {
"type": {"application": {"function": {"variable": "hydra.core.parsing.Parser"}, "argument": {"list": {"variable": "t0"}}}}}},
"body": {
"typeLambda": {
"parameter": "t0",
"body": {
"typeLambda": {
"parameter": "t1",
"body": {
"annotated": {
"body": {
"lambda": {
"parameter": "p",
"domain": {"application": {"function": {"variable": "hydra.core.parsing.Parser"}, "argument": {"variable": "t0"}}},
"body": {
"lambda": {
"parameter": "sep",
"domain": {"application": {"function": {"variable": "hydra.core.parsing.Parser"}, "argument": {"variable": "t1"}}},
"body": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.parsers.bind"}, "type": {"variable": "t0"}}},
"type": {"list": {"variable": "t0"}}}},
"argument": {"variable": "p"}}},
"argument": {
"lambda": {
"parameter": "x",
"domain": {"variable": "t0"},
"body": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.parsers.bind"}, "type": {"list": {"variable": "t0"}}}},
"type": {"list": {"variable": "t0"}}}},
"argument": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.parsers.many"}, "type": {"variable": "t0"}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.parsers.bind"}, "type": {"variable": "t1"}}},
"type": {"variable": "t0"}}},
"argument": {"variable": "sep"}}},
"argument": {"lambda": {"parameter": "_", "domain": {"variable": "t1"}, "body": {"variable": "p"}}}}}}}}},
"argument": {
"lambda": {
"parameter": "xs",
"domain": {"list": {"variable": "t0"}},
"body": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.parsers.pure"}, "type": {"list": {"variable": "t0"}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.cons"}, "type": {"variable": "t0"}}},
"argument": {"variable": "x"}}},
"argument": {"variable": "xs"}}}}}}}}}}}}}}}}},
"annotation": {
"map": [
{
"key": {"variable": "description"},
"value": {"literal": {"string": "Parse one or more occurrences separated by a separator"}}}]}}}}}}}}},
{
"term": {
"name": "hydra.core.parsers.some",
"signature": {
"typeParameters": [{"name": "t0", "constraints": []}],
"parameters": [
{
"name": "arg0",
"type": {"application": {"function": {"variable": "hydra.core.parsing.Parser"}, "argument": {"variable": "t0"}}},
"isLazy": false}],
"result": {
"type": {"application": {"function": {"variable": "hydra.core.parsing.Parser"}, "argument": {"list": {"variable": "t0"}}}}}},
"body": {
"typeLambda": {
"parameter": "t0",
"body": {
"annotated": {
"body": {
"lambda": {
"parameter": "p",
"domain": {"application": {"function": {"variable": "hydra.core.parsing.Parser"}, "argument": {"variable": "t0"}}},
"body": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.parsers.bind"}, "type": {"variable": "t0"}}},
"type": {"list": {"variable": "t0"}}}},
"argument": {"variable": "p"}}},
"argument": {
"lambda": {
"parameter": "x",
"domain": {"variable": "t0"},
"body": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {"typeApplication": {"body": {"variable": "hydra.core.parsers.bind"}, "type": {"list": {"variable": "t0"}}}},
"type": {"list": {"variable": "t0"}}}},
"argument": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.parsers.many"}, "type": {"variable": "t0"}}},
"argument": {"variable": "p"}}}}},
"argument": {
"lambda": {
"parameter": "xs",
"domain": {"list": {"variable": "t0"}},
"body": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.parsers.pure"}, "type": {"list": {"variable": "t0"}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.cons"}, "type": {"variable": "t0"}}},
"argument": {"variable": "x"}}},
"argument": {"variable": "xs"}}}}}}}}}}}}}}},
"annotation": {
"map": [
{
"key": {"variable": "description"},
"value": {"literal": {"string": "Parse one or more occurrences of the given parser"}}}]}}}}}}},
{
"term": {
"name": "hydra.core.parsers.spanned",
"signature": {
"typeParameters": [{"name": "t0", "constraints": []}],
"parameters": [
{
"name": "arg0",
"type": {"application": {"function": {"variable": "hydra.core.parsing.Parser"}, "argument": {"variable": "t0"}}},
"isLazy": false}],
"result": {
"type": {
"application": {
"function": {"variable": "hydra.core.parsing.Parser"},
"argument": {"pair": {"first": {"variable": "t0"}, "second": {"variable": "hydra.core.parsing.SourceSpan"}}}}}}},
"body": {
"typeLambda": {
"parameter": "t0",
"body": {
"annotated": {
"body": {
"lambda": {
"parameter": "p",
"domain": {"application": {"function": {"variable": "hydra.core.parsing.Parser"}, "argument": {"variable": "t0"}}},
"body": {
"let": {
"bindings": [
{
"name": "parse",
"term": {
"lambda": {
"parameter": "input",
"domain": {"variable": "hydra.core.parsing.ParseInput"},
"body": {
"application": {
"function": {
"typeApplication": {
"body": {
"cases": {
"typeName": "hydra.core.parsing.ParseResult",
"cases": [
{
"name": "success",
"handler": {
"lambda": {
"parameter": "s",
"domain": {"application": {"function": {"variable": "hydra.core.parsing.ParseSuccess"}, "argument": {"variable": "t0"}}},
"body": {
"let": {
"bindings": [
{
"name": "start",
"term": {
"application": {
"function": {"project": {"typeName": "hydra.core.parsing.ParseInput", "fieldName": "offset"}},
"argument": {"variable": "input"}}},
"typeScheme": {"variables": [], "body": {"literal": {"integer": "int32"}}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "end",
"term": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.lib.ordering.max"}, "type": {"literal": {"integer": "int32"}}}},
"argument": {"variable": "start"}}},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.parsing.ParseInput", "fieldName": "tokenEnd"}},
"argument": {
"application": {
"function": {
"typeApplication": {
"body": {"project": {"typeName": "hydra.core.parsing.ParseSuccess", "fieldName": "remainder"}},
"type": {"variable": "t0"}}},
"argument": {"variable": "s"}}}}}}},
"typeScheme": {"variables": [], "body": {"literal": {"integer": "int32"}}, "constraints": []}}],
"body": {
"typeApplication": {
"body": {
"inject": {
"typeName": "hydra.core.parsing.ParseResult",
"field": {
"name": "success",
"term": {
"typeApplication": {
"body": {
"record": {
"typeName": "hydra.core.parsing.ParseSuccess",
"fields": [
{
"name": "value",
"term": {
"typeApplication": {
"body": {
"typeApplication": {
"body": {
"pair": {
"first": {
"application": {
"function": {
"typeApplication": {"body": {"project": {"typeName": "hydra.core.parsing.ParseSuccess", "fieldName": "value"}}, "type": {"variable": "t0"}}},
"argument": {"variable": "s"}}},
"second": {
"record": {
"typeName": "hydra.core.parsing.SourceSpan",
"fields": [{"name": "start", "term": {"variable": "start"}}, {"name": "end", "term": {"variable": "end"}}]}}}},
"type": {"variable": "t0"}}},
"type": {"variable": "hydra.core.parsing.SourceSpan"}}}},
{
"name": "remainder",
"term": {
"application": {
"function": {
"typeApplication": {
"body": {"project": {"typeName": "hydra.core.parsing.ParseSuccess", "fieldName": "remainder"}},
"type": {"variable": "t0"}}},
"argument": {"variable": "s"}}}}]}},
"type": {"pair": {"first": {"variable": "t0"}, "second": {"variable": "hydra.core.parsing.SourceSpan"}}}}}}}},
"type": {"pair": {"first": {"variable": "t0"}, "second": {"variable": "hydra.core.parsing.SourceSpan"}}}}}}}}}}}},
{
"name": "failure",
"handler": {
"lambda": {
"parameter": "e",
"domain": {"variable": "hydra.core.parsing.ParseError"},
"body": {
"typeApplication": {
"body": {"inject": {"typeName": "hydra.core.parsing.ParseResult", "field": {"name": "failure", "term": {"variable": "e"}}}},
"type": {"pair": {"first": {"variable": "t0"}, "second": {"variable": "hydra.core.parsing.SourceSpan"}}}}}}}}]}},
"type": {"variable": "t0"}}},
"argument": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"unwrap": "hydra.core.parsing.Parser"}, "type": {"variable": "t0"}}},
"argument": {"variable": "p"}}},
"argument": {"variable": "input"}}}}}}},
"typeScheme": {
"variables": [],
"body": {
"function": {
"domain": {"variable": "hydra.core.parsing.ParseInput"},
"codomain": {
"application": {
"function": {"variable": "hydra.core.parsing.ParseResult"},
"argument": {"pair": {"first": {"variable": "t0"}, "second": {"variable": "hydra.core.parsing.SourceSpan"}}}}}}},
"constraints": []}}],
"body": {
"typeApplication": {
"body": {"wrap": {"typeName": "hydra.core.parsing.Parser", "body": {"variable": "parse"}}},
"type": {"pair": {"first": {"variable": "t0"}, "second": {"variable": "hydra.core.parsing.SourceSpan"}}}}}}}}},
"annotation": {
"map": [
{
"key": {"variable": "description"},
"value": {
"literal": {
"string": "Run a parser and pair its result with the source span it consumed. The span starts at the first codepoint the parser consumed and ends at the end of the last token it completed (see markTokenEnd), so trailing whitespace and comments are excluded."}}}]}}}}}}},
{
"term": {
"name": "hydra.core.parsers.string",
"signature": {
"typeParameters": [],
"parameters": [{"name": "arg0", "type": {"literal": "string"}, "isLazy": false}],
"result": {"type": {"application": {"function": {"variable": "hydra.core.parsing.Parser"}, "argument": {"literal": "string"}}}}},
"body": {
"annotated": {
"body": {
"lambda": {
"parameter": "str",
"domain": {"literal": "string"},
"body": {
"let": {
"bindings": [
{
"name": "strCodes",
"term": {"application": {"function": {"variable": "hydra.core.lib.strings.toList"}, "argument": {"variable": "str"}}},
"typeScheme": {"variables": [], "body": {"list": {"literal": {"integer": "int32"}}}, "constraints": []}}],
"body": {
"let": {
"bindings": [
{
"name": "strLen",
"term": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.length"}, "type": {"literal": {"integer": "int32"}}}},
"argument": {"variable": "strCodes"}}},
"typeScheme": {"variables": [], "body": {"literal": {"integer": "int32"}}, "constraints": []}}],
"body": {
"typeApplication": {
"body": {
"wrap": {
"typeName": "hydra.core.parsing.Parser",
"body": {
"lambda": {
"parameter": "input",
"domain": {"variable": "hydra.core.parsing.ParseInput"},
"body": {
"let": {
"bindings": [
{
"name": "inputPrefix",
"term": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.take"}, "type": {"literal": {"integer": "int32"}}}},
"argument": {"variable": "strLen"}}},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.parsing.ParseInput", "fieldName": "codepoints"}},
"argument": {"variable": "input"}}}}},
"typeScheme": {"variables": [], "body": {"list": {"literal": {"integer": "int32"}}}, "constraints": []}}],
"body": {
"application": {
"function": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {
"body": {"variable": "hydra.core.lib.logic.ifElse"},
"type": {"application": {"function": {"variable": "hydra.core.parsing.ParseResult"}, "argument": {"literal": "string"}}}}},
"argument": {
"application": {
"function": {
"application": {
"function": {
"typeApplication": {"body": {"variable": "hydra.core.lib.equality.equal"}, "type": {"list": {"literal": {"integer": "int32"}}}}},
"argument": {"variable": "strCodes"}}},
"argument": {"variable": "inputPrefix"}}}}},
"argument": {
"typeApplication": {
"body": {
"inject": {
"typeName": "hydra.core.parsing.ParseResult",
"field": {
"name": "success",
"term": {
"typeApplication": {
"body": {
"record": {
"typeName": "hydra.core.parsing.ParseSuccess",
"fields": [
{"name": "value", "term": {"variable": "str"}},
{
"name": "remainder",
"term": {
"record": {
"typeName": "hydra.core.parsing.ParseInput",
"fields": [
{
"name": "offset",
"term": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.lib.math.add"}, "type": {"literal": {"integer": "int32"}}}},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.parsing.ParseInput", "fieldName": "offset"}},
"argument": {"variable": "input"}}}}},
"argument": {"variable": "strLen"}}}},
{
"name": "tokenEnd",
"term": {
"application": {
"function": {"project": {"typeName": "hydra.core.parsing.ParseInput", "fieldName": "tokenEnd"}},
"argument": {"variable": "input"}}}},
{
"name": "codepoints",
"term": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.drop"}, "type": {"literal": {"integer": "int32"}}}},
"argument": {"variable": "strLen"}}},
"argument": {
"application": {
"function": {"project": {"typeName": "hydra.core.parsing.ParseInput", "fieldName": "codepoints"}},
"argument": {"variable": "input"}}}}}}]}}}]}},
"type": {"literal": "string"}}}}}},
"type": {"literal": "string"}}}}},
"argument": {
"typeApplication": {
"body": {
"inject": {
"typeName": "hydra.core.parsing.ParseResult",
"field": {
"name": "failure",
"term": {
"record": {
"typeName": "hydra.core.parsing.ParseError",
"fields": [
{
"name": "message",
"term": {
"application": {
"function": {
"application": {"function": {"variable": "hydra.core.lib.strings.concat2"}, "argument": {"literal": {"string": "expected: "}}}},
"argument": {"variable": "str"}}}},
{"name": "remainder", "term": {"variable": "input"}}]}}}}},
"type": {"literal": "string"}}}}}}}}}}},
"type": {"literal": "string"}}}}}}}}},
"annotation": {"map": [{"key": {"variable": "description"}, "value": {"literal": {"string": "Parse a specific string"}}}]}}}}},
{
"term": {
"name": "hydra.core.parsers.try",
"signature": {
"typeParameters": [{"name": "t0", "constraints": []}],
"parameters": [
{
"name": "arg0",
"type": {"application": {"function": {"variable": "hydra.core.parsing.Parser"}, "argument": {"variable": "t0"}}},
"isLazy": false}],
"result": {"type": {"application": {"function": {"variable": "hydra.core.parsing.Parser"}, "argument": {"variable": "t0"}}}}},
"body": {
"typeLambda": {
"parameter": "t0",
"body": {
"annotated": {
"body": {
"lambda": {
"parameter": "p",
"domain": {"application": {"function": {"variable": "hydra.core.parsing.Parser"}, "argument": {"variable": "t0"}}},
"body": {
"let": {
"bindings": [
{
"name": "parse",
"term": {
"lambda": {
"parameter": "input",
"domain": {"variable": "hydra.core.parsing.ParseInput"},
"body": {
"application": {
"function": {
"typeApplication": {
"body": {
"cases": {
"typeName": "hydra.core.parsing.ParseResult",
"cases": [
{
"name": "success",
"handler": {
"lambda": {
"parameter": "s",
"domain": {"application": {"function": {"variable": "hydra.core.parsing.ParseSuccess"}, "argument": {"variable": "t0"}}},
"body": {
"typeApplication": {
"body": {"inject": {"typeName": "hydra.core.parsing.ParseResult", "field": {"name": "success", "term": {"variable": "s"}}}},
"type": {"variable": "t0"}}}}}},
{
"name": "failure",
"handler": {
"lambda": {
"parameter": "e",
"domain": {"variable": "hydra.core.parsing.ParseError"},
"body": {
"typeApplication": {
"body": {
"inject": {
"typeName": "hydra.core.parsing.ParseResult",
"field": {
"name": "failure",
"term": {
"record": {
"typeName": "hydra.core.parsing.ParseError",
"fields": [
{
"name": "message",
"term": {
"application": {
"function": {"project": {"typeName": "hydra.core.parsing.ParseError", "fieldName": "message"}},
"argument": {"variable": "e"}}}},
{"name": "remainder", "term": {"variable": "input"}}]}}}}},
"type": {"variable": "t0"}}}}}}]}},
"type": {"variable": "t0"}}},
"argument": {
"application": {
"function": {
"application": {
"function": {"typeApplication": {"body": {"unwrap": "hydra.core.parsing.Parser"}, "type": {"variable": "t0"}}},
"argument": {"variable": "p"}}},
"argument": {"variable": "input"}}}}}}},
"typeScheme": {
"variables": [],
"body": {
"function": {
"domain": {"variable": "hydra.core.parsing.ParseInput"},
"codomain": {"application": {"function": {"variable": "hydra.core.parsing.ParseResult"}, "argument": {"variable": "t0"}}}}},
"constraints": []}}],
"body": {
"typeApplication": {"body": {"wrap": {"typeName": "hydra.core.parsing.Parser", "body": {"variable": "parse"}}}, "type": {"variable": "t0"}}}}}}},
"annotation": {
"map": [
{
"key": {"variable": "description"},
"value": {"literal": {"string": "Make a parser's failure backtrackable, rewinding to the original input on failure"}}}]}}}}}}}]}