packages feed

hydra-kernel-0.18.1: hydra-kernel-json/hydra/core/sorting.json

{
  "name": "hydra.core.sorting",
  "metadata": {
    "description": "Utilities for sorting. This module includes an implementation of Tarjan's algorithm, originally based on GraphSCC by Iavor S. Diatchki: https://hackage.haskell.org/package/GraphSCC. Tarjan was chosen because it computes strongly connected components in O(V+E), in a single pass, and yields the components in reverse topological order — exactly the shape every consumer in the kernel (HM let-generalization, schema graph construction, target-language emission) needs.",
    "comments": [],
    "seeAlso": [],
    "provisions": []},
  "dependencies": [
    {"module": "hydra.core.constants"},
    {"module": "hydra.core.lib.equality"},
    {"module": "hydra.core.lib.functions"},
    {"module": "hydra.core.lib.lists"},
    {"module": "hydra.core.lib.logic"},
    {"module": "hydra.core.lib.maps"},
    {"module": "hydra.core.lib.math"},
    {"module": "hydra.core.lib.optionals"},
    {"module": "hydra.core.lib.ordering"},
    {"module": "hydra.core.lib.pairs"},
    {"module": "hydra.core.lib.sets"},
    {"module": "hydra.core.topology"}],
  "definitions": [
    {
      "term": {
        "name": "hydra.core.sorting.adjacencyListToMap",
        "signature": {
          "typeParameters": [{"name": "t0", "constraints": [{"simple": "ordering"}]}, {"name": "t1", "constraints": []}],
          "parameters": [
            {
              "name": "arg0",
              "type": {"list": {"pair": {"first": {"variable": "t0"}, "second": {"list": {"variable": "t1"}}}}},
              "isLazy": false}],
          "result": {"type": {"map": {"keys": {"variable": "t0"}, "values": {"list": {"variable": "t1"}}}}}},
        "body": {
          "typeLambda": {
            "parameter": "t0",
            "body": {
              "typeLambda": {
                "parameter": "t1",
                "body": {
                  "annotated": {
                    "body": {
                      "lambda": {
                        "parameter": "pairs",
                        "domain": {"list": {"pair": {"first": {"variable": "t0"}, "second": {"list": {"variable": "t1"}}}}},
                        "body": {
                          "application": {
                            "function": {
                              "application": {
                                "function": {
                                  "application": {
                                    "function": {
                                      "typeApplication": {
                                        "body": {
                                          "typeApplication": {
                                            "body": {"variable": "hydra.core.lib.lists.foldl"},
                                            "type": {"map": {"keys": {"variable": "t0"}, "values": {"list": {"variable": "t1"}}}}}},
                                        "type": {"pair": {"first": {"variable": "t0"}, "second": {"list": {"variable": "t1"}}}}}},
                                    "argument": {
                                      "lambda": {
                                        "parameter": "mp",
                                        "domain": {"map": {"keys": {"variable": "t0"}, "values": {"list": {"variable": "t1"}}}},
                                        "body": {
                                          "lambda": {
                                            "parameter": "p",
                                            "domain": {"pair": {"first": {"variable": "t0"}, "second": {"list": {"variable": "t1"}}}},
                                            "body": {
                                              "let": {
                                                "bindings": [
                                                  {
                                                    "name": "k",
                                                    "term": {
                                                      "application": {
                                                        "function": {
                                                          "typeApplication": {
                                                            "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"variable": "t0"}}},
                                                            "type": {"list": {"variable": "t1"}}}},
                                                        "argument": {"variable": "p"}}},
                                                    "typeScheme": {"variables": [], "body": {"variable": "t0"}, "constraints": []}}],
                                                "body": {
                                                  "let": {
                                                    "bindings": [
                                                      {
                                                        "name": "vs",
                                                        "term": {
                                                          "application": {
                                                            "function": {
                                                              "typeApplication": {
                                                                "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"variable": "t0"}}},
                                                                "type": {"list": {"variable": "t1"}}}},
                                                            "argument": {"variable": "p"}}},
                                                        "typeScheme": {"variables": [], "body": {"list": {"variable": "t1"}}, "constraints": []}}],
                                                    "body": {
                                                      "let": {
                                                        "bindings": [
                                                          {
                                                            "name": "existing",
                                                            "term": {
                                                              "application": {
                                                                "function": {
                                                                  "application": {
                                                                    "function": {
                                                                      "application": {
                                                                        "function": {
                                                                          "typeApplication": {
                                                                            "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.optionals.match"}, "type": {"list": {"variable": "t1"}}}},
                                                                            "type": {"list": {"variable": "t1"}}}},
                                                                        "argument": {
                                                                          "application": {
                                                                            "function": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "typeApplication": {
                                                                                    "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.lookup"}, "type": {"variable": "t0"}}},
                                                                                    "type": {"list": {"variable": "t1"}}}},
                                                                                "argument": {"variable": "k"}}},
                                                                            "argument": {"variable": "mp"}}}}},
                                                                    "argument": {"typeApplication": {"body": {"list": []}, "type": {"variable": "t1"}}}}},
                                                                "argument": {"typeApplication": {"body": {"variable": "hydra.core.lib.functions.identity"}, "type": {"list": {"variable": "t1"}}}}}},
                                                            "typeScheme": {"variables": [], "body": {"list": {"variable": "t1"}}, "constraints": []}}],
                                                        "body": {
                                                          "application": {
                                                            "function": {
                                                              "application": {
                                                                "function": {
                                                                  "application": {
                                                                    "function": {
                                                                      "typeApplication": {
                                                                        "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.insert"}, "type": {"variable": "t0"}}},
                                                                        "type": {"list": {"variable": "t1"}}}},
                                                                    "argument": {"variable": "k"}}},
                                                                "argument": {
                                                                  "application": {
                                                                    "function": {
                                                                      "application": {
                                                                        "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.concat2"}, "type": {"variable": "t1"}}},
                                                                        "argument": {"variable": "existing"}}},
                                                                    "argument": {"variable": "vs"}}}}},
                                                            "argument": {"variable": "mp"}}}}}}}}}}}}}}},
                                "argument": {
                                  "typeApplication": {
                                    "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.empty"}, "type": {"variable": "t0"}}},
                                    "type": {"list": {"variable": "t1"}}}}}},
                            "argument": {"variable": "pairs"}}}}},
                    "annotation": {
                      "map": [
                        {
                          "key": {"variable": "description"},
                          "value": {"literal": {"string": "Convert an adjacency list to a map, concatenating values for duplicate keys"}}}]}}}}}}}}},
    {
      "term": {
        "name": "hydra.core.sorting.adjacencyListsToGraph",
        "signature": {
          "typeParameters": [{"name": "t0", "constraints": [{"simple": "ordering"}]}],
          "parameters": [
            {
              "name": "arg0",
              "type": {"list": {"pair": {"first": {"variable": "t0"}, "second": {"list": {"variable": "t0"}}}}},
              "isLazy": false}],
          "result": {
            "type": {
              "pair": {
                "first": {"map": {"keys": {"literal": {"integer": "int32"}}, "values": {"list": {"literal": {"integer": "int32"}}}}},
                "second": {"function": {"domain": {"literal": {"integer": "int32"}}, "codomain": {"optional": {"variable": "t0"}}}}}}}},
        "body": {
          "typeLambda": {
            "parameter": "t0",
            "body": {
              "annotated": {
                "body": {
                  "lambda": {
                    "parameter": "edges0",
                    "domain": {"list": {"pair": {"first": {"variable": "t0"}, "second": {"list": {"variable": "t0"}}}}},
                    "body": {
                      "let": {
                        "bindings": [
                          {
                            "name": "sortedEdges",
                            "term": {
                              "application": {
                                "function": {
                                  "application": {
                                    "function": {
                                      "typeApplication": {
                                        "body": {
                                          "typeApplication": {
                                            "body": {"variable": "hydra.core.lib.lists.sortBy"},
                                            "type": {"pair": {"first": {"variable": "t0"}, "second": {"list": {"variable": "t0"}}}}}},
                                        "type": {"variable": "t0"}}},
                                    "argument": {
                                      "typeApplication": {
                                        "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"variable": "t0"}}},
                                        "type": {"list": {"variable": "t0"}}}}}},
                                "argument": {"variable": "edges0"}}},
                            "typeScheme": {
                              "variables": [],
                              "body": {"list": {"pair": {"first": {"variable": "t0"}, "second": {"list": {"variable": "t0"}}}}},
                              "constraints": []}}],
                        "body": {
                          "let": {
                            "bindings": [
                              {
                                "name": "indexedEdges",
                                "term": {
                                  "application": {
                                    "function": {
                                      "application": {
                                        "function": {
                                          "typeApplication": {
                                            "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.zip"}, "type": {"literal": {"integer": "int32"}}}},
                                            "type": {"pair": {"first": {"variable": "t0"}, "second": {"list": {"variable": "t0"}}}}}},
                                        "argument": {
                                          "application": {
                                            "function": {
                                              "application": {"function": {"variable": "hydra.core.lib.math.range"}, "argument": {"literal": {"integer": {"int32": 0}}}}},
                                            "argument": {
                                              "application": {
                                                "function": {
                                                  "typeApplication": {
                                                    "body": {"variable": "hydra.core.lib.lists.length"},
                                                    "type": {"pair": {"first": {"variable": "t0"}, "second": {"list": {"variable": "t0"}}}}}},
                                                "argument": {"variable": "sortedEdges"}}}}}}},
                                    "argument": {"variable": "sortedEdges"}}},
                                "typeScheme": {
                                  "variables": [],
                                  "body": {
                                    "list": {
                                      "pair": {
                                        "first": {"literal": {"integer": "int32"}},
                                        "second": {"pair": {"first": {"variable": "t0"}, "second": {"list": {"variable": "t0"}}}}}}},
                                  "constraints": []}}],
                            "body": {
                              "let": {
                                "bindings": [
                                  {
                                    "name": "keyToVertex",
                                    "term": {
                                      "application": {
                                        "function": {
                                          "typeApplication": {
                                            "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.fromList"}, "type": {"variable": "t0"}}},
                                            "type": {"literal": {"integer": "int32"}}}},
                                        "argument": {
                                          "application": {
                                            "function": {
                                              "application": {
                                                "function": {
                                                  "typeApplication": {
                                                    "body": {
                                                      "typeApplication": {
                                                        "body": {"variable": "hydra.core.lib.lists.map"},
                                                        "type": {
                                                          "pair": {
                                                            "first": {"literal": {"integer": "int32"}},
                                                            "second": {"pair": {"first": {"variable": "t0"}, "second": {"list": {"variable": "t0"}}}}}}}},
                                                    "type": {"pair": {"first": {"variable": "t0"}, "second": {"literal": {"integer": "int32"}}}}}},
                                                "argument": {
                                                  "lambda": {
                                                    "parameter": "vkNeighbors",
                                                    "domain": {
                                                      "pair": {
                                                        "first": {"literal": {"integer": "int32"}},
                                                        "second": {"pair": {"first": {"variable": "t0"}, "second": {"list": {"variable": "t0"}}}}}},
                                                    "body": {
                                                      "let": {
                                                        "bindings": [
                                                          {
                                                            "name": "v",
                                                            "term": {
                                                              "application": {
                                                                "function": {
                                                                  "typeApplication": {
                                                                    "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"literal": {"integer": "int32"}}}},
                                                                    "type": {"pair": {"first": {"variable": "t0"}, "second": {"list": {"variable": "t0"}}}}}},
                                                                "argument": {"variable": "vkNeighbors"}}},
                                                            "typeScheme": {"variables": [], "body": {"literal": {"integer": "int32"}}, "constraints": []}}],
                                                        "body": {
                                                          "let": {
                                                            "bindings": [
                                                              {
                                                                "name": "kNeighbors",
                                                                "term": {
                                                                  "application": {
                                                                    "function": {
                                                                      "typeApplication": {
                                                                        "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"literal": {"integer": "int32"}}}},
                                                                        "type": {"pair": {"first": {"variable": "t0"}, "second": {"list": {"variable": "t0"}}}}}},
                                                                    "argument": {"variable": "vkNeighbors"}}},
                                                                "typeScheme": {
                                                                  "variables": [],
                                                                  "body": {"pair": {"first": {"variable": "t0"}, "second": {"list": {"variable": "t0"}}}},
                                                                  "constraints": []}}],
                                                            "body": {
                                                              "let": {
                                                                "bindings": [
                                                                  {
                                                                    "name": "k",
                                                                    "term": {
                                                                      "application": {
                                                                        "function": {
                                                                          "typeApplication": {
                                                                            "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"variable": "t0"}}},
                                                                            "type": {"list": {"variable": "t0"}}}},
                                                                        "argument": {"variable": "kNeighbors"}}},
                                                                    "typeScheme": {"variables": [], "body": {"variable": "t0"}, "constraints": []}}],
                                                                "body": {
                                                                  "typeApplication": {
                                                                    "body": {
                                                                      "typeApplication": {"body": {"pair": {"first": {"variable": "k"}, "second": {"variable": "v"}}}, "type": {"variable": "t0"}}},
                                                                    "type": {"literal": {"integer": "int32"}}}}}}}}}}}}}},
                                            "argument": {"variable": "indexedEdges"}}}}},
                                    "typeScheme": {
                                      "variables": [],
                                      "body": {"map": {"keys": {"variable": "t0"}, "values": {"literal": {"integer": "int32"}}}},
                                      "constraints": []}}],
                                "body": {
                                  "let": {
                                    "bindings": [
                                      {
                                        "name": "vertexMap",
                                        "term": {
                                          "application": {
                                            "function": {
                                              "typeApplication": {
                                                "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.fromList"}, "type": {"literal": {"integer": "int32"}}}},
                                                "type": {"variable": "t0"}}},
                                            "argument": {
                                              "application": {
                                                "function": {
                                                  "application": {
                                                    "function": {
                                                      "typeApplication": {
                                                        "body": {
                                                          "typeApplication": {
                                                            "body": {"variable": "hydra.core.lib.lists.map"},
                                                            "type": {
                                                              "pair": {
                                                                "first": {"literal": {"integer": "int32"}},
                                                                "second": {"pair": {"first": {"variable": "t0"}, "second": {"list": {"variable": "t0"}}}}}}}},
                                                        "type": {"pair": {"first": {"literal": {"integer": "int32"}}, "second": {"variable": "t0"}}}}},
                                                    "argument": {
                                                      "lambda": {
                                                        "parameter": "vkNeighbors",
                                                        "domain": {
                                                          "pair": {
                                                            "first": {"literal": {"integer": "int32"}},
                                                            "second": {"pair": {"first": {"variable": "t0"}, "second": {"list": {"variable": "t0"}}}}}},
                                                        "body": {
                                                          "let": {
                                                            "bindings": [
                                                              {
                                                                "name": "v",
                                                                "term": {
                                                                  "application": {
                                                                    "function": {
                                                                      "typeApplication": {
                                                                        "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"literal": {"integer": "int32"}}}},
                                                                        "type": {"pair": {"first": {"variable": "t0"}, "second": {"list": {"variable": "t0"}}}}}},
                                                                    "argument": {"variable": "vkNeighbors"}}},
                                                                "typeScheme": {"variables": [], "body": {"literal": {"integer": "int32"}}, "constraints": []}}],
                                                            "body": {
                                                              "let": {
                                                                "bindings": [
                                                                  {
                                                                    "name": "kNeighbors",
                                                                    "term": {
                                                                      "application": {
                                                                        "function": {
                                                                          "typeApplication": {
                                                                            "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"literal": {"integer": "int32"}}}},
                                                                            "type": {"pair": {"first": {"variable": "t0"}, "second": {"list": {"variable": "t0"}}}}}},
                                                                        "argument": {"variable": "vkNeighbors"}}},
                                                                    "typeScheme": {
                                                                      "variables": [],
                                                                      "body": {"pair": {"first": {"variable": "t0"}, "second": {"list": {"variable": "t0"}}}},
                                                                      "constraints": []}}],
                                                                "body": {
                                                                  "let": {
                                                                    "bindings": [
                                                                      {
                                                                        "name": "k",
                                                                        "term": {
                                                                          "application": {
                                                                            "function": {
                                                                              "typeApplication": {
                                                                                "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"variable": "t0"}}},
                                                                                "type": {"list": {"variable": "t0"}}}},
                                                                            "argument": {"variable": "kNeighbors"}}},
                                                                        "typeScheme": {"variables": [], "body": {"variable": "t0"}, "constraints": []}}],
                                                                    "body": {
                                                                      "typeApplication": {
                                                                        "body": {
                                                                          "typeApplication": {"body": {"pair": {"first": {"variable": "v"}, "second": {"variable": "k"}}}, "type": {"literal": {"integer": "int32"}}}},
                                                                        "type": {"variable": "t0"}}}}}}}}}}}}},
                                                "argument": {"variable": "indexedEdges"}}}}},
                                        "typeScheme": {
                                          "variables": [],
                                          "body": {"map": {"keys": {"literal": {"integer": "int32"}}, "values": {"variable": "t0"}}},
                                          "constraints": []}}],
                                    "body": {
                                      "let": {
                                        "bindings": [
                                          {
                                            "name": "graph",
                                            "term": {
                                              "application": {
                                                "function": {
                                                  "typeApplication": {
                                                    "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.fromList"}, "type": {"literal": {"integer": "int32"}}}},
                                                    "type": {"list": {"literal": {"integer": "int32"}}}}},
                                                "argument": {
                                                  "application": {
                                                    "function": {
                                                      "application": {
                                                        "function": {
                                                          "typeApplication": {
                                                            "body": {
                                                              "typeApplication": {
                                                                "body": {"variable": "hydra.core.lib.lists.map"},
                                                                "type": {
                                                                  "pair": {
                                                                    "first": {"literal": {"integer": "int32"}},
                                                                    "second": {"pair": {"first": {"variable": "t0"}, "second": {"list": {"variable": "t0"}}}}}}}},
                                                            "type": {"pair": {"first": {"literal": {"integer": "int32"}}, "second": {"list": {"literal": {"integer": "int32"}}}}}}},
                                                        "argument": {
                                                          "lambda": {
                                                            "parameter": "vkNeighbors",
                                                            "domain": {
                                                              "pair": {
                                                                "first": {"literal": {"integer": "int32"}},
                                                                "second": {"pair": {"first": {"variable": "t0"}, "second": {"list": {"variable": "t0"}}}}}},
                                                            "body": {
                                                              "let": {
                                                                "bindings": [
                                                                  {
                                                                    "name": "v",
                                                                    "term": {
                                                                      "application": {
                                                                        "function": {
                                                                          "typeApplication": {
                                                                            "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"literal": {"integer": "int32"}}}},
                                                                            "type": {"pair": {"first": {"variable": "t0"}, "second": {"list": {"variable": "t0"}}}}}},
                                                                        "argument": {"variable": "vkNeighbors"}}},
                                                                    "typeScheme": {"variables": [], "body": {"literal": {"integer": "int32"}}, "constraints": []}}],
                                                                "body": {
                                                                  "let": {
                                                                    "bindings": [
                                                                      {
                                                                        "name": "kNeighbors",
                                                                        "term": {
                                                                          "application": {
                                                                            "function": {
                                                                              "typeApplication": {
                                                                                "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"literal": {"integer": "int32"}}}},
                                                                                "type": {"pair": {"first": {"variable": "t0"}, "second": {"list": {"variable": "t0"}}}}}},
                                                                            "argument": {"variable": "vkNeighbors"}}},
                                                                        "typeScheme": {
                                                                          "variables": [],
                                                                          "body": {"pair": {"first": {"variable": "t0"}, "second": {"list": {"variable": "t0"}}}},
                                                                          "constraints": []}}],
                                                                    "body": {
                                                                      "let": {
                                                                        "bindings": [
                                                                          {
                                                                            "name": "neighbors",
                                                                            "term": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "typeApplication": {
                                                                                    "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"variable": "t0"}}},
                                                                                    "type": {"list": {"variable": "t0"}}}},
                                                                                "argument": {"variable": "kNeighbors"}}},
                                                                            "typeScheme": {"variables": [], "body": {"list": {"variable": "t0"}}, "constraints": []}}],
                                                                        "body": {
                                                                          "typeApplication": {
                                                                            "body": {
                                                                              "typeApplication": {
                                                                                "body": {
                                                                                  "pair": {
                                                                                    "first": {"variable": "v"},
                                                                                    "second": {
                                                                                      "application": {
                                                                                        "function": {
                                                                                          "application": {
                                                                                            "function": {
                                                                                              "typeApplication": {
                                                                                                "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.optionals.mapOptional"}, "type": {"variable": "t0"}}},
                                                                                                "type": {"literal": {"integer": "int32"}}}},
                                                                                            "argument": {
                                                                                              "lambda": {
                                                                                                "parameter": "k",
                                                                                                "domain": {"variable": "t0"},
                                                                                                "body": {
                                                                                                  "application": {
                                                                                                    "function": {
                                                                                                      "application": {
                                                                                                        "function": {
                                                                                                          "typeApplication": {
                                                                                                            "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.lookup"}, "type": {"variable": "t0"}}},
                                                                                                            "type": {"literal": {"integer": "int32"}}}},
                                                                                                        "argument": {"variable": "k"}}},
                                                                                                    "argument": {"variable": "keyToVertex"}}}}}}},
                                                                                        "argument": {"variable": "neighbors"}}}}},
                                                                                "type": {"literal": {"integer": "int32"}}}},
                                                                            "type": {"list": {"literal": {"integer": "int32"}}}}}}}}}}}}}}},
                                                    "argument": {"variable": "indexedEdges"}}}}},
                                            "typeScheme": {
                                              "variables": [],
                                              "body": {"map": {"keys": {"literal": {"integer": "int32"}}, "values": {"list": {"literal": {"integer": "int32"}}}}},
                                              "constraints": []}}],
                                        "body": {
                                          "let": {
                                            "bindings": [
                                              {
                                                "name": "vertexToKey",
                                                "term": {
                                                  "lambda": {
                                                    "parameter": "v",
                                                    "domain": {"literal": {"integer": "int32"}},
                                                    "body": {
                                                      "application": {
                                                        "function": {
                                                          "application": {
                                                            "function": {
                                                              "typeApplication": {
                                                                "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.lookup"}, "type": {"literal": {"integer": "int32"}}}},
                                                                "type": {"variable": "t0"}}},
                                                            "argument": {"variable": "v"}}},
                                                        "argument": {"variable": "vertexMap"}}}}},
                                                "typeScheme": {
                                                  "variables": [],
                                                  "body": {"function": {"domain": {"literal": {"integer": "int32"}}, "codomain": {"optional": {"variable": "t0"}}}},
                                                  "constraints": []}}],
                                            "body": {
                                              "typeApplication": {
                                                "body": {
                                                  "typeApplication": {
                                                    "body": {"pair": {"first": {"variable": "graph"}, "second": {"variable": "vertexToKey"}}},
                                                    "type": {"map": {"keys": {"literal": {"integer": "int32"}}, "values": {"list": {"literal": {"integer": "int32"}}}}}}},
                                                "type": {"function": {"domain": {"literal": {"integer": "int32"}}, "codomain": {"optional": {"variable": "t0"}}}}}}}}}}}}}}}}}}}},
                "annotation": {
                  "map": [
                    {
                      "key": {"variable": "description"},
                      "value": {
                        "literal": {
                          "string": "Given a list of adjacency lists represented as (key, [key]) pairs, construct a graph along with a function mapping each vertex (an Int) back to its original key (Nothing for unknown vertices)."}}}]}}}}}}},
    {
      "term": {
        "name": "hydra.core.sorting.createOrderingIsomorphism",
        "signature": {
          "typeParameters": [{"name": "t0", "constraints": [{"simple": "ordering"}]}, {"name": "t1", "constraints": []}],
          "parameters": [
            {"name": "arg0", "type": {"list": {"variable": "t0"}}, "isLazy": false},
            {"name": "arg1", "type": {"list": {"variable": "t0"}}, "isLazy": false}],
          "result": {
            "type": {"application": {"function": {"variable": "hydra.core.topology.OrderingIsomorphism"}, "argument": {"variable": "t1"}}}}},
        "body": {
          "typeLambda": {
            "parameter": "t0",
            "body": {
              "typeLambda": {
                "parameter": "t1",
                "body": {
                  "annotated": {
                    "body": {
                      "lambda": {
                        "parameter": "sourceOrd",
                        "domain": {"list": {"variable": "t0"}},
                        "body": {
                          "lambda": {
                            "parameter": "targetOrd",
                            "domain": {"list": {"variable": "t0"}},
                            "body": {
                              "let": {
                                "bindings": [
                                  {
                                    "name": "sourceToTargetMapping",
                                    "term": {
                                      "typeLambda": {
                                        "parameter": "t2",
                                        "body": {
                                          "lambda": {
                                            "parameter": "els",
                                            "domain": {"list": {"variable": "t2"}},
                                            "body": {
                                              "let": {
                                                "bindings": [
                                                  {
                                                    "name": "mp",
                                                    "term": {
                                                      "application": {
                                                        "function": {
                                                          "typeApplication": {
                                                            "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.fromList"}, "type": {"variable": "t0"}}},
                                                            "type": {"variable": "t2"}}},
                                                        "argument": {
                                                          "application": {
                                                            "function": {
                                                              "application": {
                                                                "function": {
                                                                  "typeApplication": {
                                                                    "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.zip"}, "type": {"variable": "t0"}}},
                                                                    "type": {"variable": "t2"}}},
                                                                "argument": {"variable": "sourceOrd"}}},
                                                            "argument": {"variable": "els"}}}}},
                                                    "typeScheme": {"variables": [], "body": {"map": {"keys": {"variable": "t0"}, "values": {"variable": "t2"}}}, "constraints": []}}],
                                                "body": {
                                                  "application": {
                                                    "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.optionals.givens"}, "type": {"variable": "t2"}}},
                                                    "argument": {
                                                      "application": {
                                                        "function": {
                                                          "application": {
                                                            "function": {
                                                              "typeApplication": {
                                                                "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "t0"}}},
                                                                "type": {"optional": {"variable": "t2"}}}},
                                                            "argument": {
                                                              "lambda": {
                                                                "parameter": "n",
                                                                "domain": {"variable": "t0"},
                                                                "body": {
                                                                  "application": {
                                                                    "function": {
                                                                      "application": {
                                                                        "function": {
                                                                          "typeApplication": {
                                                                            "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.lookup"}, "type": {"variable": "t0"}}},
                                                                            "type": {"variable": "t2"}}},
                                                                        "argument": {"variable": "n"}}},
                                                                    "argument": {"variable": "mp"}}}}}}},
                                                        "argument": {"variable": "targetOrd"}}}}}}}}}}},
                                    "typeScheme": {
                                      "variables": ["t2"],
                                      "body": {"function": {"domain": {"list": {"variable": "t2"}}, "codomain": {"list": {"variable": "t2"}}}},
                                      "constraints": [{"key": "t2", "value": {"classes": []}}]}}],
                                "body": {
                                  "let": {
                                    "bindings": [
                                      {
                                        "name": "targetToSourceMapping",
                                        "term": {
                                          "typeLambda": {
                                            "parameter": "t2",
                                            "body": {
                                              "lambda": {
                                                "parameter": "els",
                                                "domain": {"list": {"variable": "t2"}},
                                                "body": {
                                                  "let": {
                                                    "bindings": [
                                                      {
                                                        "name": "mp",
                                                        "term": {
                                                          "application": {
                                                            "function": {
                                                              "typeApplication": {
                                                                "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.fromList"}, "type": {"variable": "t0"}}},
                                                                "type": {"variable": "t2"}}},
                                                            "argument": {
                                                              "application": {
                                                                "function": {
                                                                  "application": {
                                                                    "function": {
                                                                      "typeApplication": {
                                                                        "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.zip"}, "type": {"variable": "t0"}}},
                                                                        "type": {"variable": "t2"}}},
                                                                    "argument": {"variable": "targetOrd"}}},
                                                                "argument": {"variable": "els"}}}}},
                                                        "typeScheme": {"variables": [], "body": {"map": {"keys": {"variable": "t0"}, "values": {"variable": "t2"}}}, "constraints": []}}],
                                                    "body": {
                                                      "application": {
                                                        "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.optionals.givens"}, "type": {"variable": "t2"}}},
                                                        "argument": {
                                                          "application": {
                                                            "function": {
                                                              "application": {
                                                                "function": {
                                                                  "typeApplication": {
                                                                    "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "t0"}}},
                                                                    "type": {"optional": {"variable": "t2"}}}},
                                                                "argument": {
                                                                  "lambda": {
                                                                    "parameter": "n",
                                                                    "domain": {"variable": "t0"},
                                                                    "body": {
                                                                      "application": {
                                                                        "function": {
                                                                          "application": {
                                                                            "function": {
                                                                              "typeApplication": {
                                                                                "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.lookup"}, "type": {"variable": "t0"}}},
                                                                                "type": {"variable": "t2"}}},
                                                                            "argument": {"variable": "n"}}},
                                                                        "argument": {"variable": "mp"}}}}}}},
                                                            "argument": {"variable": "sourceOrd"}}}}}}}}}}},
                                        "typeScheme": {
                                          "variables": ["t2"],
                                          "body": {"function": {"domain": {"list": {"variable": "t2"}}, "codomain": {"list": {"variable": "t2"}}}},
                                          "constraints": [{"key": "t2", "value": {"classes": []}}]}}],
                                    "body": {
                                      "typeApplication": {
                                        "body": {
                                          "record": {
                                            "typeName": "hydra.core.topology.OrderingIsomorphism",
                                            "fields": [
                                              {
                                                "name": "encode",
                                                "term": {"typeApplication": {"body": {"variable": "sourceToTargetMapping"}, "type": {"variable": "t1"}}}},
                                              {
                                                "name": "decode",
                                                "term": {"typeApplication": {"body": {"variable": "targetToSourceMapping"}, "type": {"variable": "t1"}}}}]}},
                                        "type": {"variable": "t1"}}}}}}}}}}},
                    "annotation": {
                      "map": [
                        {
                          "key": {"variable": "description"},
                          "value": {
                            "literal": {
                              "string": "Construct an OrderingIsomorphism between two orderings of the same elements. The two list arguments must be permutations of each other; the result is a pair of mappings that transport an element list from one ordering to the other."}}}]}}}}}}}}},
    {
      "term": {
        "name": "hydra.core.sorting.findReachableNodes",
        "signature": {
          "typeParameters": [{"name": "t0", "constraints": [{"simple": "ordering"}]}],
          "parameters": [
            {
              "name": "arg0",
              "type": {"function": {"domain": {"variable": "t0"}, "codomain": {"set": {"variable": "t0"}}}},
              "isLazy": false},
            {"name": "arg1", "type": {"variable": "t0"}, "isLazy": false}],
          "result": {"type": {"set": {"variable": "t0"}}}},
        "body": {
          "typeLambda": {
            "parameter": "t0",
            "body": {
              "annotated": {
                "body": {
                  "lambda": {
                    "parameter": "adj",
                    "domain": {"function": {"domain": {"variable": "t0"}, "codomain": {"set": {"variable": "t0"}}}},
                    "body": {
                      "lambda": {
                        "parameter": "root",
                        "domain": {"variable": "t0"},
                        "body": {
                          "let": {
                            "bindings": [
                              {
                                "name": "visit",
                                "term": {
                                  "lambda": {
                                    "parameter": "visited",
                                    "domain": {"set": {"variable": "t0"}},
                                    "body": {
                                      "lambda": {
                                        "parameter": "node",
                                        "domain": {"variable": "t0"},
                                        "body": {
                                          "let": {
                                            "bindings": [
                                              {
                                                "name": "toVisit",
                                                "term": {
                                                  "application": {
                                                    "function": {
                                                      "application": {
                                                        "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.difference"}, "type": {"variable": "t0"}}},
                                                        "argument": {"application": {"function": {"variable": "adj"}, "argument": {"variable": "node"}}}}},
                                                    "argument": {"variable": "visited"}}},
                                                "typeScheme": {"variables": [], "body": {"set": {"variable": "t0"}}, "constraints": []}}],
                                            "body": {
                                              "application": {
                                                "function": {
                                                  "application": {
                                                    "function": {
                                                      "application": {
                                                        "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.logic.ifElse"}, "type": {"set": {"variable": "t0"}}}},
                                                        "argument": {
                                                          "application": {
                                                            "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.isEmpty"}, "type": {"variable": "t0"}}},
                                                            "argument": {"variable": "toVisit"}}}}},
                                                    "argument": {"variable": "visited"}}},
                                                "argument": {
                                                  "application": {
                                                    "function": {
                                                      "application": {
                                                        "function": {
                                                          "application": {
                                                            "function": {
                                                              "typeApplication": {
                                                                "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.foldl"}, "type": {"set": {"variable": "t0"}}}},
                                                                "type": {"variable": "t0"}}},
                                                            "argument": {
                                                              "lambda": {
                                                                "parameter": "v",
                                                                "domain": {"set": {"variable": "t0"}},
                                                                "body": {
                                                                  "lambda": {
                                                                    "parameter": "n",
                                                                    "domain": {"variable": "t0"},
                                                                    "body": {
                                                                      "application": {
                                                                        "function": {
                                                                          "application": {
                                                                            "function": {"variable": "visit"},
                                                                            "argument": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "application": {
                                                                                    "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.insert"}, "type": {"variable": "t0"}}},
                                                                                    "argument": {"variable": "n"}}},
                                                                                "argument": {"variable": "v"}}}}},
                                                                        "argument": {"variable": "n"}}}}}}}}},
                                                        "argument": {"variable": "visited"}}},
                                                    "argument": {
                                                      "application": {
                                                        "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.toList"}, "type": {"variable": "t0"}}},
                                                        "argument": {"variable": "toVisit"}}}}}}}}}}}}},
                                "typeScheme": {
                                  "variables": [],
                                  "body": {
                                    "function": {
                                      "domain": {"set": {"variable": "t0"}},
                                      "codomain": {"function": {"domain": {"variable": "t0"}, "codomain": {"set": {"variable": "t0"}}}}}},
                                  "constraints": []}}],
                            "body": {
                              "application": {
                                "function": {
                                  "application": {
                                    "function": {"variable": "visit"},
                                    "argument": {
                                      "application": {
                                        "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.singleton"}, "type": {"variable": "t0"}}},
                                        "argument": {"variable": "root"}}}}},
                                "argument": {"variable": "root"}}}}}}}}},
                "annotation": {
                  "map": [
                    {
                      "key": {"variable": "description"},
                      "value": {
                        "literal": {
                          "string": "Given an adjacency function and a distinguished root node, find all reachable nodes (including the root node)"}}}]}}}}}}},
    {
      "term": {
        "name": "hydra.core.sorting.initialState",
        "signature": {"typeParameters": [], "parameters": [], "result": {"type": {"variable": "hydra.core.topology.TarjanState"}}},
        "body": {
          "annotated": {
            "body": {
              "record": {
                "typeName": "hydra.core.topology.TarjanState",
                "fields": [
                  {"name": "counter", "term": {"literal": {"integer": {"int32": 0}}}},
                  {
                    "name": "indices",
                    "term": {
                      "typeApplication": {
                        "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.empty"}, "type": {"literal": {"integer": "int32"}}}},
                        "type": {"literal": {"integer": "int32"}}}}},
                  {
                    "name": "lowLinks",
                    "term": {
                      "typeApplication": {
                        "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.empty"}, "type": {"literal": {"integer": "int32"}}}},
                        "type": {"literal": {"integer": "int32"}}}}},
                  {"name": "stack", "term": {"typeApplication": {"body": {"list": []}, "type": {"literal": {"integer": "int32"}}}}},
                  {
                    "name": "onStack",
                    "term": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.empty"}, "type": {"literal": {"integer": "int32"}}}}},
                  {
                    "name": "sccs",
                    "term": {"typeApplication": {"body": {"list": []}, "type": {"list": {"literal": {"integer": "int32"}}}}}}]}},
            "annotation": {
              "map": [{"key": {"variable": "description"}, "value": {"literal": {"string": "Initial state for Tarjan's algorithm"}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.sorting.popStackUntil",
        "signature": {
          "typeParameters": [],
          "parameters": [
            {"name": "arg0", "type": {"literal": {"integer": "int32"}}, "isLazy": false},
            {"name": "arg1", "type": {"variable": "hydra.core.topology.TarjanState"}, "isLazy": false}],
          "result": {
            "type": {
              "pair": {"first": {"list": {"literal": {"integer": "int32"}}}, "second": {"variable": "hydra.core.topology.TarjanState"}}}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "v",
                "domain": {"literal": {"integer": "int32"}},
                "body": {
                  "lambda": {
                    "parameter": "st0",
                    "domain": {"variable": "hydra.core.topology.TarjanState"},
                    "body": {
                      "let": {
                        "bindings": [
                          {
                            "name": "go",
                            "term": {
                              "lambda": {
                                "parameter": "acc",
                                "domain": {"list": {"literal": {"integer": "int32"}}},
                                "body": {
                                  "lambda": {
                                    "parameter": "st",
                                    "domain": {"variable": "hydra.core.topology.TarjanState"},
                                    "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": {
                                                      "pair": {"first": {"list": {"literal": {"integer": "int32"}}}, "second": {"variable": "hydra.core.topology.TarjanState"}}}}},
                                                "argument": {
                                                  "application": {
                                                    "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.uncons"}, "type": {"literal": {"integer": "int32"}}}},
                                                    "argument": {
                                                      "application": {
                                                        "function": {"project": {"typeName": "hydra.core.topology.TarjanState", "fieldName": "stack"}},
                                                        "argument": {"variable": "st"}}}}}}},
                                            "argument": {
                                              "typeApplication": {
                                                "body": {
                                                  "typeApplication": {
                                                    "body": {
                                                      "pair": {
                                                        "first": {
                                                          "application": {
                                                            "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.reverse"}, "type": {"literal": {"integer": "int32"}}}},
                                                            "argument": {"variable": "acc"}}},
                                                        "second": {"variable": "st"}}},
                                                    "type": {"list": {"literal": {"integer": "int32"}}}}},
                                                "type": {"variable": "hydra.core.topology.TarjanState"}}}}},
                                        "argument": {
                                          "lambda": {
                                            "parameter": "uc",
                                            "domain": {"pair": {"first": {"literal": {"integer": "int32"}}, "second": {"list": {"literal": {"integer": "int32"}}}}},
                                            "body": {
                                              "let": {
                                                "bindings": [
                                                  {
                                                    "name": "x",
                                                    "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": "xs",
                                                        "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": {
                                                      "let": {
                                                        "bindings": [
                                                          {
                                                            "name": "newSt",
                                                            "term": {
                                                              "record": {
                                                                "typeName": "hydra.core.topology.TarjanState",
                                                                "fields": [
                                                                  {
                                                                    "name": "counter",
                                                                    "term": {
                                                                      "application": {
                                                                        "function": {"project": {"typeName": "hydra.core.topology.TarjanState", "fieldName": "counter"}},
                                                                        "argument": {"variable": "st"}}}},
                                                                  {
                                                                    "name": "indices",
                                                                    "term": {
                                                                      "application": {
                                                                        "function": {"project": {"typeName": "hydra.core.topology.TarjanState", "fieldName": "indices"}},
                                                                        "argument": {"variable": "st"}}}},
                                                                  {
                                                                    "name": "lowLinks",
                                                                    "term": {
                                                                      "application": {
                                                                        "function": {"project": {"typeName": "hydra.core.topology.TarjanState", "fieldName": "lowLinks"}},
                                                                        "argument": {"variable": "st"}}}},
                                                                  {"name": "stack", "term": {"variable": "xs"}},
                                                                  {
                                                                    "name": "onStack",
                                                                    "term": {
                                                                      "application": {
                                                                        "function": {"project": {"typeName": "hydra.core.topology.TarjanState", "fieldName": "onStack"}},
                                                                        "argument": {"variable": "st"}}}},
                                                                  {
                                                                    "name": "sccs",
                                                                    "term": {
                                                                      "application": {
                                                                        "function": {"project": {"typeName": "hydra.core.topology.TarjanState", "fieldName": "sccs"}},
                                                                        "argument": {"variable": "st"}}}}]}},
                                                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.topology.TarjanState"}, "constraints": []}}],
                                                        "body": {
                                                          "let": {
                                                            "bindings": [
                                                              {
                                                                "name": "newSt2",
                                                                "term": {
                                                                  "record": {
                                                                    "typeName": "hydra.core.topology.TarjanState",
                                                                    "fields": [
                                                                      {
                                                                        "name": "counter",
                                                                        "term": {
                                                                          "application": {
                                                                            "function": {"project": {"typeName": "hydra.core.topology.TarjanState", "fieldName": "counter"}},
                                                                            "argument": {"variable": "newSt"}}}},
                                                                      {
                                                                        "name": "indices",
                                                                        "term": {
                                                                          "application": {
                                                                            "function": {"project": {"typeName": "hydra.core.topology.TarjanState", "fieldName": "indices"}},
                                                                            "argument": {"variable": "newSt"}}}},
                                                                      {
                                                                        "name": "lowLinks",
                                                                        "term": {
                                                                          "application": {
                                                                            "function": {"project": {"typeName": "hydra.core.topology.TarjanState", "fieldName": "lowLinks"}},
                                                                            "argument": {"variable": "newSt"}}}},
                                                                      {
                                                                        "name": "stack",
                                                                        "term": {
                                                                          "application": {
                                                                            "function": {"project": {"typeName": "hydra.core.topology.TarjanState", "fieldName": "stack"}},
                                                                            "argument": {"variable": "newSt"}}}},
                                                                      {
                                                                        "name": "onStack",
                                                                        "term": {
                                                                          "application": {
                                                                            "function": {
                                                                              "application": {
                                                                                "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.delete"}, "type": {"literal": {"integer": "int32"}}}},
                                                                                "argument": {"variable": "x"}}},
                                                                            "argument": {
                                                                              "application": {
                                                                                "function": {"project": {"typeName": "hydra.core.topology.TarjanState", "fieldName": "onStack"}},
                                                                                "argument": {"variable": "st"}}}}}},
                                                                      {
                                                                        "name": "sccs",
                                                                        "term": {
                                                                          "application": {
                                                                            "function": {"project": {"typeName": "hydra.core.topology.TarjanState", "fieldName": "sccs"}},
                                                                            "argument": {"variable": "newSt"}}}}]}},
                                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.topology.TarjanState"}, "constraints": []}}],
                                                            "body": {
                                                              "let": {
                                                                "bindings": [
                                                                  {
                                                                    "name": "acc'",
                                                                    "term": {
                                                                      "application": {
                                                                        "function": {
                                                                          "application": {
                                                                            "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.cons"}, "type": {"literal": {"integer": "int32"}}}},
                                                                            "argument": {"variable": "x"}}},
                                                                        "argument": {"variable": "acc"}}},
                                                                    "typeScheme": {"variables": [], "body": {"list": {"literal": {"integer": "int32"}}}, "constraints": []}}],
                                                                "body": {
                                                                  "application": {
                                                                    "function": {
                                                                      "application": {
                                                                        "function": {
                                                                          "application": {
                                                                            "function": {
                                                                              "typeApplication": {
                                                                                "body": {"variable": "hydra.core.lib.logic.ifElse"},
                                                                                "type": {
                                                                                  "pair": {"first": {"list": {"literal": {"integer": "int32"}}}, "second": {"variable": "hydra.core.topology.TarjanState"}}}}},
                                                                            "argument": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "application": {
                                                                                    "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.equality.equal"}, "type": {"literal": {"integer": "int32"}}}},
                                                                                    "argument": {"variable": "x"}}},
                                                                                "argument": {"variable": "v"}}}}},
                                                                        "argument": {
                                                                          "typeApplication": {
                                                                            "body": {
                                                                              "typeApplication": {
                                                                                "body": {
                                                                                  "pair": {
                                                                                    "first": {
                                                                                      "application": {
                                                                                        "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.reverse"}, "type": {"literal": {"integer": "int32"}}}},
                                                                                        "argument": {"variable": "acc'"}}},
                                                                                    "second": {"variable": "newSt2"}}},
                                                                                "type": {"list": {"literal": {"integer": "int32"}}}}},
                                                                            "type": {"variable": "hydra.core.topology.TarjanState"}}}}},
                                                                    "argument": {
                                                                      "application": {
                                                                        "function": {"application": {"function": {"variable": "go"}, "argument": {"variable": "acc'"}}},
                                                                        "argument": {"variable": "newSt2"}}}}}}}}}}}}}}}}}}}}}}},
                            "typeScheme": {
                              "variables": [],
                              "body": {
                                "function": {
                                  "domain": {"list": {"literal": {"integer": "int32"}}},
                                  "codomain": {
                                    "function": {
                                      "domain": {"variable": "hydra.core.topology.TarjanState"},
                                      "codomain": {
                                        "pair": {"first": {"list": {"literal": {"integer": "int32"}}}, "second": {"variable": "hydra.core.topology.TarjanState"}}}}}}},
                              "constraints": []}}],
                        "body": {
                          "application": {
                            "function": {
                              "application": {
                                "function": {"variable": "go"},
                                "argument": {"typeApplication": {"body": {"list": []}, "type": {"literal": {"integer": "int32"}}}}}},
                            "argument": {"variable": "st0"}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {
                    "literal": {
                      "string": "Pop vertices off the stack until the given vertex is reached, collecting the current strongly connected component"}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.sorting.propagateTags",
        "signature": {
          "typeParameters": [{"name": "t0", "constraints": [{"simple": "ordering"}]}, {"name": "t1", "constraints": [{"simple": "ordering"}]}],
          "parameters": [
            {
              "name": "arg0",
              "type": {"list": {"pair": {"first": {"variable": "t0"}, "second": {"list": {"variable": "t0"}}}}},
              "isLazy": false},
            {
              "name": "arg1",
              "type": {"list": {"pair": {"first": {"variable": "t0"}, "second": {"list": {"variable": "t1"}}}}},
              "isLazy": false}],
          "result": {"type": {"list": {"pair": {"first": {"variable": "t0"}, "second": {"set": {"variable": "t1"}}}}}}},
        "body": {
          "typeLambda": {
            "parameter": "t0",
            "body": {
              "typeLambda": {
                "parameter": "t1",
                "body": {
                  "annotated": {
                    "body": {
                      "lambda": {
                        "parameter": "edges",
                        "domain": {"list": {"pair": {"first": {"variable": "t0"}, "second": {"list": {"variable": "t0"}}}}},
                        "body": {
                          "lambda": {
                            "parameter": "nodeTags",
                            "domain": {"list": {"pair": {"first": {"variable": "t0"}, "second": {"list": {"variable": "t1"}}}}},
                            "body": {
                              "let": {
                                "bindings": [
                                  {
                                    "name": "adjMap",
                                    "term": {
                                      "application": {
                                        "function": {
                                          "typeApplication": {
                                            "body": {"typeApplication": {"body": {"variable": "hydra.core.sorting.adjacencyListToMap"}, "type": {"variable": "t0"}}},
                                            "type": {"variable": "t0"}}},
                                        "argument": {"variable": "edges"}}},
                                    "typeScheme": {
                                      "variables": [],
                                      "body": {"map": {"keys": {"variable": "t0"}, "values": {"list": {"variable": "t0"}}}},
                                      "constraints": []}}],
                                "body": {
                                  "let": {
                                    "bindings": [
                                      {
                                        "name": "tagMap",
                                        "term": {
                                          "application": {
                                            "function": {
                                              "application": {
                                                "function": {
                                                  "typeApplication": {
                                                    "body": {
                                                      "typeApplication": {
                                                        "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.map"}, "type": {"list": {"variable": "t1"}}}},
                                                        "type": {"set": {"variable": "t1"}}}},
                                                    "type": {"variable": "t0"}}},
                                                "argument": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.fromList"}, "type": {"variable": "t1"}}}}},
                                            "argument": {
                                              "application": {
                                                "function": {
                                                  "typeApplication": {
                                                    "body": {"typeApplication": {"body": {"variable": "hydra.core.sorting.adjacencyListToMap"}, "type": {"variable": "t0"}}},
                                                    "type": {"variable": "t1"}}},
                                                "argument": {"variable": "nodeTags"}}}}},
                                        "typeScheme": {
                                          "variables": [],
                                          "body": {"map": {"keys": {"variable": "t0"}, "values": {"set": {"variable": "t1"}}}},
                                          "constraints": []}}],
                                    "body": {
                                      "let": {
                                        "bindings": [
                                          {
                                            "name": "allNodes",
                                            "term": {
                                              "application": {
                                                "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.toList"}, "type": {"variable": "t0"}}},
                                                "argument": {
                                                  "application": {
                                                    "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.fromList"}, "type": {"variable": "t0"}}},
                                                    "argument": {
                                                      "application": {
                                                        "function": {
                                                          "application": {
                                                            "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.concat2"}, "type": {"variable": "t0"}}},
                                                            "argument": {
                                                              "application": {
                                                                "function": {
                                                                  "application": {
                                                                    "function": {
                                                                      "typeApplication": {
                                                                        "body": {
                                                                          "typeApplication": {
                                                                            "body": {"variable": "hydra.core.lib.lists.map"},
                                                                            "type": {"pair": {"first": {"variable": "t0"}, "second": {"list": {"variable": "t0"}}}}}},
                                                                        "type": {"variable": "t0"}}},
                                                                    "argument": {
                                                                      "typeApplication": {
                                                                        "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"variable": "t0"}}},
                                                                        "type": {"list": {"variable": "t0"}}}}}},
                                                                "argument": {"variable": "edges"}}}}},
                                                        "argument": {
                                                          "application": {
                                                            "function": {
                                                              "application": {
                                                                "function": {
                                                                  "typeApplication": {
                                                                    "body": {
                                                                      "typeApplication": {
                                                                        "body": {"variable": "hydra.core.lib.lists.map"},
                                                                        "type": {"pair": {"first": {"variable": "t0"}, "second": {"list": {"variable": "t1"}}}}}},
                                                                    "type": {"variable": "t0"}}},
                                                                "argument": {
                                                                  "typeApplication": {
                                                                    "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"variable": "t0"}}},
                                                                    "type": {"list": {"variable": "t1"}}}}}},
                                                            "argument": {"variable": "nodeTags"}}}}}}}}},
                                            "typeScheme": {"variables": [], "body": {"list": {"variable": "t0"}}, "constraints": []}}],
                                        "body": {
                                          "let": {
                                            "bindings": [
                                              {
                                                "name": "getTagsForNode",
                                                "term": {
                                                  "lambda": {
                                                    "parameter": "node",
                                                    "domain": {"variable": "t0"},
                                                    "body": {
                                                      "let": {
                                                        "bindings": [
                                                          {
                                                            "name": "reachable",
                                                            "term": {
                                                              "application": {
                                                                "function": {
                                                                  "application": {
                                                                    "function": {"typeApplication": {"body": {"variable": "hydra.core.sorting.findReachableNodes"}, "type": {"variable": "t0"}}},
                                                                    "argument": {
                                                                      "lambda": {
                                                                        "parameter": "n",
                                                                        "domain": {"variable": "t0"},
                                                                        "body": {
                                                                          "application": {
                                                                            "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.fromList"}, "type": {"variable": "t0"}}},
                                                                            "argument": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "application": {
                                                                                    "function": {
                                                                                      "application": {
                                                                                        "function": {
                                                                                          "typeApplication": {
                                                                                            "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.optionals.match"}, "type": {"list": {"variable": "t0"}}}},
                                                                                            "type": {"list": {"variable": "t0"}}}},
                                                                                        "argument": {
                                                                                          "application": {
                                                                                            "function": {
                                                                                              "application": {
                                                                                                "function": {
                                                                                                  "typeApplication": {
                                                                                                    "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.lookup"}, "type": {"variable": "t0"}}},
                                                                                                    "type": {"list": {"variable": "t0"}}}},
                                                                                                "argument": {"variable": "n"}}},
                                                                                            "argument": {"variable": "adjMap"}}}}},
                                                                                    "argument": {"typeApplication": {"body": {"list": []}, "type": {"variable": "t0"}}}}},
                                                                                "argument": {"typeApplication": {"body": {"variable": "hydra.core.lib.functions.identity"}, "type": {"list": {"variable": "t0"}}}}}}}}}}}},
                                                                "argument": {"variable": "node"}}},
                                                            "typeScheme": {"variables": [], "body": {"set": {"variable": "t0"}}, "constraints": []}}],
                                                        "body": {
                                                          "application": {
                                                            "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.unions"}, "type": {"variable": "t1"}}},
                                                            "argument": {
                                                              "application": {
                                                                "function": {
                                                                  "application": {
                                                                    "function": {
                                                                      "typeApplication": {
                                                                        "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "t0"}}},
                                                                        "type": {"set": {"variable": "t1"}}}},
                                                                    "argument": {
                                                                      "lambda": {
                                                                        "parameter": "n",
                                                                        "domain": {"variable": "t0"},
                                                                        "body": {
                                                                          "application": {
                                                                            "function": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "application": {
                                                                                    "function": {
                                                                                      "typeApplication": {
                                                                                        "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.optionals.match"}, "type": {"set": {"variable": "t1"}}}},
                                                                                        "type": {"set": {"variable": "t1"}}}},
                                                                                    "argument": {
                                                                                      "application": {
                                                                                        "function": {
                                                                                          "application": {
                                                                                            "function": {
                                                                                              "typeApplication": {
                                                                                                "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.lookup"}, "type": {"variable": "t0"}}},
                                                                                                "type": {"set": {"variable": "t1"}}}},
                                                                                            "argument": {"variable": "n"}}},
                                                                                        "argument": {"variable": "tagMap"}}}}},
                                                                                "argument": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.empty"}, "type": {"variable": "t1"}}}}},
                                                                            "argument": {"typeApplication": {"body": {"variable": "hydra.core.lib.functions.identity"}, "type": {"set": {"variable": "t1"}}}}}}}}}},
                                                                "argument": {
                                                                  "application": {
                                                                    "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.toList"}, "type": {"variable": "t0"}}},
                                                                    "argument": {"variable": "reachable"}}}}}}}}}}},
                                                "typeScheme": {
                                                  "variables": [],
                                                  "body": {"function": {"domain": {"variable": "t0"}, "codomain": {"set": {"variable": "t1"}}}},
                                                  "constraints": []}}],
                                            "body": {
                                              "application": {
                                                "function": {
                                                  "application": {
                                                    "function": {
                                                      "typeApplication": {
                                                        "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "t0"}}},
                                                        "type": {"pair": {"first": {"variable": "t0"}, "second": {"set": {"variable": "t1"}}}}}},
                                                    "argument": {
                                                      "lambda": {
                                                        "parameter": "n",
                                                        "domain": {"variable": "t0"},
                                                        "body": {
                                                          "typeApplication": {
                                                            "body": {
                                                              "typeApplication": {
                                                                "body": {
                                                                  "pair": {
                                                                    "first": {"variable": "n"},
                                                                    "second": {"application": {"function": {"variable": "getTagsForNode"}, "argument": {"variable": "n"}}}}},
                                                                "type": {"variable": "t0"}}},
                                                            "type": {"set": {"variable": "t1"}}}}}}}},
                                                "argument": {"variable": "allNodes"}}}}}}}}}}}}}}},
                    "annotation": {
                      "map": [
                        {
                          "key": {"variable": "description"},
                          "value": {
                            "literal": {
                              "string": "Given a graph as an adjacency list of edges and a list of explicit tags per node, compute the full set of tags for each node by propagating tags through edges. If there is an edge from n1 to n2 and n2 has tag t, then n1 also has tag t. Note: pairs in the output are not ordered."}}}]}}}}}}}}},
    {
      "term": {
        "name": "hydra.core.sorting.strongConnect",
        "signature": {
          "typeParameters": [],
          "parameters": [
            {
              "name": "arg0",
              "type": {"map": {"keys": {"literal": {"integer": "int32"}}, "values": {"list": {"literal": {"integer": "int32"}}}}},
              "isLazy": false},
            {"name": "arg1", "type": {"literal": {"integer": "int32"}}, "isLazy": false},
            {"name": "arg2", "type": {"variable": "hydra.core.topology.TarjanState"}, "isLazy": false}],
          "result": {"type": {"variable": "hydra.core.topology.TarjanState"}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "graph",
                "domain": {"map": {"keys": {"literal": {"integer": "int32"}}, "values": {"list": {"literal": {"integer": "int32"}}}}},
                "body": {
                  "lambda": {
                    "parameter": "v",
                    "domain": {"literal": {"integer": "int32"}},
                    "body": {
                      "lambda": {
                        "parameter": "st",
                        "domain": {"variable": "hydra.core.topology.TarjanState"},
                        "body": {
                          "let": {
                            "bindings": [
                              {
                                "name": "i",
                                "term": {
                                  "application": {
                                    "function": {"project": {"typeName": "hydra.core.topology.TarjanState", "fieldName": "counter"}},
                                    "argument": {"variable": "st"}}},
                                "typeScheme": {"variables": [], "body": {"literal": {"integer": "int32"}}, "constraints": []}}],
                            "body": {
                              "let": {
                                "bindings": [
                                  {
                                    "name": "newSt",
                                    "term": {
                                      "record": {
                                        "typeName": "hydra.core.topology.TarjanState",
                                        "fields": [
                                          {
                                            "name": "counter",
                                            "term": {
                                              "application": {
                                                "function": {
                                                  "application": {
                                                    "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.math.add"}, "type": {"literal": {"integer": "int32"}}}},
                                                    "argument": {"variable": "i"}}},
                                                "argument": {"literal": {"integer": {"int32": 1}}}}}},
                                          {
                                            "name": "indices",
                                            "term": {
                                              "application": {
                                                "function": {
                                                  "application": {
                                                    "function": {
                                                      "application": {
                                                        "function": {
                                                          "typeApplication": {
                                                            "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.insert"}, "type": {"literal": {"integer": "int32"}}}},
                                                            "type": {"literal": {"integer": "int32"}}}},
                                                        "argument": {"variable": "v"}}},
                                                    "argument": {"variable": "i"}}},
                                                "argument": {
                                                  "application": {
                                                    "function": {"project": {"typeName": "hydra.core.topology.TarjanState", "fieldName": "indices"}},
                                                    "argument": {"variable": "st"}}}}}},
                                          {
                                            "name": "lowLinks",
                                            "term": {
                                              "application": {
                                                "function": {
                                                  "application": {
                                                    "function": {
                                                      "application": {
                                                        "function": {
                                                          "typeApplication": {
                                                            "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.insert"}, "type": {"literal": {"integer": "int32"}}}},
                                                            "type": {"literal": {"integer": "int32"}}}},
                                                        "argument": {"variable": "v"}}},
                                                    "argument": {"variable": "i"}}},
                                                "argument": {
                                                  "application": {
                                                    "function": {"project": {"typeName": "hydra.core.topology.TarjanState", "fieldName": "lowLinks"}},
                                                    "argument": {"variable": "st"}}}}}},
                                          {
                                            "name": "stack",
                                            "term": {
                                              "application": {
                                                "function": {
                                                  "application": {
                                                    "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.cons"}, "type": {"literal": {"integer": "int32"}}}},
                                                    "argument": {"variable": "v"}}},
                                                "argument": {
                                                  "application": {
                                                    "function": {"project": {"typeName": "hydra.core.topology.TarjanState", "fieldName": "stack"}},
                                                    "argument": {"variable": "st"}}}}}},
                                          {
                                            "name": "onStack",
                                            "term": {
                                              "application": {
                                                "function": {
                                                  "application": {
                                                    "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.insert"}, "type": {"literal": {"integer": "int32"}}}},
                                                    "argument": {"variable": "v"}}},
                                                "argument": {
                                                  "application": {
                                                    "function": {"project": {"typeName": "hydra.core.topology.TarjanState", "fieldName": "onStack"}},
                                                    "argument": {"variable": "st"}}}}}},
                                          {
                                            "name": "sccs",
                                            "term": {
                                              "application": {
                                                "function": {"project": {"typeName": "hydra.core.topology.TarjanState", "fieldName": "sccs"}},
                                                "argument": {"variable": "st"}}}}]}},
                                    "typeScheme": {"variables": [], "body": {"variable": "hydra.core.topology.TarjanState"}, "constraints": []}}],
                                "body": {
                                  "let": {
                                    "bindings": [
                                      {
                                        "name": "neighbors",
                                        "term": {
                                          "application": {
                                            "function": {
                                              "application": {
                                                "function": {
                                                  "application": {
                                                    "function": {
                                                      "typeApplication": {
                                                        "body": {
                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.maps.findWithDefault"}, "type": {"list": {"literal": {"integer": "int32"}}}}},
                                                        "type": {"literal": {"integer": "int32"}}}},
                                                    "argument": {"typeApplication": {"body": {"list": []}, "type": {"literal": {"integer": "int32"}}}}}},
                                                "argument": {"variable": "v"}}},
                                            "argument": {"variable": "graph"}}},
                                        "typeScheme": {"variables": [], "body": {"list": {"literal": {"integer": "int32"}}}, "constraints": []}}],
                                    "body": {
                                      "let": {
                                        "bindings": [
                                          {
                                            "name": "processNeighbor",
                                            "term": {
                                              "lambda": {
                                                "parameter": "st_",
                                                "domain": {"variable": "hydra.core.topology.TarjanState"},
                                                "body": {
                                                  "lambda": {
                                                    "parameter": "w",
                                                    "domain": {"literal": {"integer": "int32"}},
                                                    "body": {
                                                      "let": {
                                                        "bindings": [
                                                          {
                                                            "name": "lowLink",
                                                            "term": {
                                                              "lambda": {
                                                                "parameter": "s",
                                                                "domain": {"variable": "hydra.core.topology.TarjanState"},
                                                                "body": {
                                                                  "let": {
                                                                    "bindings": [
                                                                      {
                                                                        "name": "lowV1",
                                                                        "term": {
                                                                          "application": {
                                                                            "function": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "application": {
                                                                                    "function": {
                                                                                      "typeApplication": {
                                                                                        "body": {
                                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.maps.findWithDefault"}, "type": {"literal": {"integer": "int32"}}}},
                                                                                        "type": {"literal": {"integer": "int32"}}}},
                                                                                    "argument": {"variable": "hydra.core.constants.maxInt32"}}},
                                                                                "argument": {"variable": "v"}}},
                                                                            "argument": {
                                                                              "application": {
                                                                                "function": {"project": {"typeName": "hydra.core.topology.TarjanState", "fieldName": "lowLinks"}},
                                                                                "argument": {"variable": "s"}}}}},
                                                                        "typeScheme": {"variables": [], "body": {"literal": {"integer": "int32"}}, "constraints": []}}],
                                                                    "body": {
                                                                      "let": {
                                                                        "bindings": [
                                                                          {
                                                                            "name": "idx_w",
                                                                            "term": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "application": {
                                                                                    "function": {
                                                                                      "application": {
                                                                                        "function": {
                                                                                          "typeApplication": {
                                                                                            "body": {
                                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.maps.findWithDefault"}, "type": {"literal": {"integer": "int32"}}}},
                                                                                            "type": {"literal": {"integer": "int32"}}}},
                                                                                        "argument": {"variable": "hydra.core.constants.maxInt32"}}},
                                                                                    "argument": {"variable": "w"}}},
                                                                                "argument": {
                                                                                  "application": {
                                                                                    "function": {"project": {"typeName": "hydra.core.topology.TarjanState", "fieldName": "indices"}},
                                                                                    "argument": {"variable": "s"}}}}},
                                                                            "typeScheme": {"variables": [], "body": {"literal": {"integer": "int32"}}, "constraints": []}}],
                                                                        "body": {
                                                                          "record": {
                                                                            "typeName": "hydra.core.topology.TarjanState",
                                                                            "fields": [
                                                                              {
                                                                                "name": "counter",
                                                                                "term": {
                                                                                  "application": {
                                                                                    "function": {"project": {"typeName": "hydra.core.topology.TarjanState", "fieldName": "counter"}},
                                                                                    "argument": {"variable": "s"}}}},
                                                                              {
                                                                                "name": "indices",
                                                                                "term": {
                                                                                  "application": {
                                                                                    "function": {"project": {"typeName": "hydra.core.topology.TarjanState", "fieldName": "indices"}},
                                                                                    "argument": {"variable": "s"}}}},
                                                                              {
                                                                                "name": "lowLinks",
                                                                                "term": {
                                                                                  "application": {
                                                                                    "function": {
                                                                                      "application": {
                                                                                        "function": {
                                                                                          "application": {
                                                                                            "function": {
                                                                                              "typeApplication": {
                                                                                                "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.insert"}, "type": {"literal": {"integer": "int32"}}}},
                                                                                                "type": {"literal": {"integer": "int32"}}}},
                                                                                            "argument": {"variable": "v"}}},
                                                                                        "argument": {
                                                                                          "application": {
                                                                                            "function": {
                                                                                              "application": {
                                                                                                "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.ordering.min"}, "type": {"literal": {"integer": "int32"}}}},
                                                                                                "argument": {"variable": "lowV1"}}},
                                                                                            "argument": {"variable": "idx_w"}}}}},
                                                                                    "argument": {
                                                                                      "application": {
                                                                                        "function": {"project": {"typeName": "hydra.core.topology.TarjanState", "fieldName": "lowLinks"}},
                                                                                        "argument": {"variable": "s"}}}}}},
                                                                              {
                                                                                "name": "stack",
                                                                                "term": {
                                                                                  "application": {
                                                                                    "function": {"project": {"typeName": "hydra.core.topology.TarjanState", "fieldName": "stack"}},
                                                                                    "argument": {"variable": "s"}}}},
                                                                              {
                                                                                "name": "onStack",
                                                                                "term": {
                                                                                  "application": {
                                                                                    "function": {"project": {"typeName": "hydra.core.topology.TarjanState", "fieldName": "onStack"}},
                                                                                    "argument": {"variable": "s"}}}},
                                                                              {
                                                                                "name": "sccs",
                                                                                "term": {
                                                                                  "application": {
                                                                                    "function": {"project": {"typeName": "hydra.core.topology.TarjanState", "fieldName": "sccs"}},
                                                                                    "argument": {"variable": "s"}}}}]}}}}}}}},
                                                            "typeScheme": {
                                                              "variables": [],
                                                              "body": {
                                                                "function": {"domain": {"variable": "hydra.core.topology.TarjanState"}, "codomain": {"variable": "hydra.core.topology.TarjanState"}}},
                                                              "constraints": []}}],
                                                        "body": {
                                                          "application": {
                                                            "function": {
                                                              "application": {
                                                                "function": {
                                                                  "application": {
                                                                    "function": {
                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.logic.ifElse"}, "type": {"variable": "hydra.core.topology.TarjanState"}}},
                                                                    "argument": {
                                                                      "application": {
                                                                        "function": {"variable": "hydra.core.lib.logic.not"},
                                                                        "argument": {
                                                                          "application": {
                                                                            "function": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "typeApplication": {
                                                                                    "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.member"}, "type": {"literal": {"integer": "int32"}}}},
                                                                                    "type": {"literal": {"integer": "int32"}}}},
                                                                                "argument": {"variable": "w"}}},
                                                                            "argument": {
                                                                              "application": {
                                                                                "function": {"project": {"typeName": "hydra.core.topology.TarjanState", "fieldName": "indices"}},
                                                                                "argument": {"variable": "st_"}}}}}}}}},
                                                                "argument": {
                                                                  "let": {
                                                                    "bindings": [
                                                                      {
                                                                        "name": "stAfter",
                                                                        "term": {
                                                                          "application": {
                                                                            "function": {
                                                                              "application": {
                                                                                "function": {"application": {"function": {"variable": "hydra.core.sorting.strongConnect"}, "argument": {"variable": "graph"}}},
                                                                                "argument": {"variable": "w"}}},
                                                                            "argument": {"variable": "st_"}}},
                                                                        "typeScheme": {"variables": [], "body": {"variable": "hydra.core.topology.TarjanState"}, "constraints": []}}],
                                                                    "body": {
                                                                      "let": {
                                                                        "bindings": [
                                                                          {
                                                                            "name": "lowV2",
                                                                            "term": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "application": {
                                                                                    "function": {
                                                                                      "application": {
                                                                                        "function": {
                                                                                          "typeApplication": {
                                                                                            "body": {
                                                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.maps.findWithDefault"}, "type": {"literal": {"integer": "int32"}}}},
                                                                                            "type": {"literal": {"integer": "int32"}}}},
                                                                                        "argument": {"variable": "hydra.core.constants.maxInt32"}}},
                                                                                    "argument": {"variable": "v"}}},
                                                                                "argument": {
                                                                                  "application": {
                                                                                    "function": {"project": {"typeName": "hydra.core.topology.TarjanState", "fieldName": "lowLinks"}},
                                                                                    "argument": {"variable": "stAfter"}}}}},
                                                                            "typeScheme": {"variables": [], "body": {"literal": {"integer": "int32"}}, "constraints": []}}],
                                                                        "body": {
                                                                          "let": {
                                                                            "bindings": [
                                                                              {
                                                                                "name": "low_w",
                                                                                "term": {
                                                                                  "application": {
                                                                                    "function": {
                                                                                      "application": {
                                                                                        "function": {
                                                                                          "application": {
                                                                                            "function": {
                                                                                              "typeApplication": {
                                                                                                "body": {
                                                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.maps.findWithDefault"}, "type": {"literal": {"integer": "int32"}}}},
                                                                                                "type": {"literal": {"integer": "int32"}}}},
                                                                                            "argument": {"variable": "hydra.core.constants.maxInt32"}}},
                                                                                        "argument": {"variable": "w"}}},
                                                                                    "argument": {
                                                                                      "application": {
                                                                                        "function": {"project": {"typeName": "hydra.core.topology.TarjanState", "fieldName": "lowLinks"}},
                                                                                        "argument": {"variable": "stAfter"}}}}},
                                                                                "typeScheme": {"variables": [], "body": {"literal": {"integer": "int32"}}, "constraints": []}}],
                                                                            "body": {
                                                                              "record": {
                                                                                "typeName": "hydra.core.topology.TarjanState",
                                                                                "fields": [
                                                                                  {
                                                                                    "name": "counter",
                                                                                    "term": {
                                                                                      "application": {
                                                                                        "function": {"project": {"typeName": "hydra.core.topology.TarjanState", "fieldName": "counter"}},
                                                                                        "argument": {"variable": "stAfter"}}}},
                                                                                  {
                                                                                    "name": "indices",
                                                                                    "term": {
                                                                                      "application": {
                                                                                        "function": {"project": {"typeName": "hydra.core.topology.TarjanState", "fieldName": "indices"}},
                                                                                        "argument": {"variable": "stAfter"}}}},
                                                                                  {
                                                                                    "name": "lowLinks",
                                                                                    "term": {
                                                                                      "application": {
                                                                                        "function": {
                                                                                          "application": {
                                                                                            "function": {
                                                                                              "application": {
                                                                                                "function": {
                                                                                                  "typeApplication": {
                                                                                                    "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.insert"}, "type": {"literal": {"integer": "int32"}}}},
                                                                                                    "type": {"literal": {"integer": "int32"}}}},
                                                                                                "argument": {"variable": "v"}}},
                                                                                            "argument": {
                                                                                              "application": {
                                                                                                "function": {
                                                                                                  "application": {
                                                                                                    "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.ordering.min"}, "type": {"literal": {"integer": "int32"}}}},
                                                                                                    "argument": {"variable": "lowV2"}}},
                                                                                                "argument": {"variable": "low_w"}}}}},
                                                                                        "argument": {
                                                                                          "application": {
                                                                                            "function": {"project": {"typeName": "hydra.core.topology.TarjanState", "fieldName": "lowLinks"}},
                                                                                            "argument": {"variable": "stAfter"}}}}}},
                                                                                  {
                                                                                    "name": "stack",
                                                                                    "term": {
                                                                                      "application": {
                                                                                        "function": {"project": {"typeName": "hydra.core.topology.TarjanState", "fieldName": "stack"}},
                                                                                        "argument": {"variable": "stAfter"}}}},
                                                                                  {
                                                                                    "name": "onStack",
                                                                                    "term": {
                                                                                      "application": {
                                                                                        "function": {"project": {"typeName": "hydra.core.topology.TarjanState", "fieldName": "onStack"}},
                                                                                        "argument": {"variable": "stAfter"}}}},
                                                                                  {
                                                                                    "name": "sccs",
                                                                                    "term": {
                                                                                      "application": {
                                                                                        "function": {"project": {"typeName": "hydra.core.topology.TarjanState", "fieldName": "sccs"}},
                                                                                        "argument": {"variable": "stAfter"}}}}]}}}}}}}}}},
                                                            "argument": {
                                                              "application": {
                                                                "function": {
                                                                  "application": {
                                                                    "function": {
                                                                      "application": {
                                                                        "function": {
                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.logic.ifElse"}, "type": {"variable": "hydra.core.topology.TarjanState"}}},
                                                                        "argument": {
                                                                          "application": {
                                                                            "function": {
                                                                              "application": {
                                                                                "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.sets.member"}, "type": {"literal": {"integer": "int32"}}}},
                                                                                "argument": {"variable": "w"}}},
                                                                            "argument": {
                                                                              "application": {
                                                                                "function": {"project": {"typeName": "hydra.core.topology.TarjanState", "fieldName": "onStack"}},
                                                                                "argument": {"variable": "st_"}}}}}}},
                                                                    "argument": {"application": {"function": {"variable": "lowLink"}, "argument": {"variable": "st_"}}}}},
                                                                "argument": {"variable": "st_"}}}}}}}}}}},
                                            "typeScheme": {
                                              "variables": [],
                                              "body": {
                                                "function": {
                                                  "domain": {"variable": "hydra.core.topology.TarjanState"},
                                                  "codomain": {"function": {"domain": {"literal": {"integer": "int32"}}, "codomain": {"variable": "hydra.core.topology.TarjanState"}}}}},
                                              "constraints": []}}],
                                        "body": {
                                          "let": {
                                            "bindings": [
                                              {
                                                "name": "stAfterNeighbors",
                                                "term": {
                                                  "application": {
                                                    "function": {
                                                      "application": {
                                                        "function": {
                                                          "application": {
                                                            "function": {
                                                              "typeApplication": {
                                                                "body": {
                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.lists.foldl"}, "type": {"variable": "hydra.core.topology.TarjanState"}}},
                                                                "type": {"literal": {"integer": "int32"}}}},
                                                            "argument": {"variable": "processNeighbor"}}},
                                                        "argument": {"variable": "newSt"}}},
                                                    "argument": {"variable": "neighbors"}}},
                                                "typeScheme": {"variables": [], "body": {"variable": "hydra.core.topology.TarjanState"}, "constraints": []}}],
                                            "body": {
                                              "let": {
                                                "bindings": [
                                                  {
                                                    "name": "low_v",
                                                    "term": {
                                                      "application": {
                                                        "function": {
                                                          "application": {
                                                            "function": {
                                                              "application": {
                                                                "function": {
                                                                  "typeApplication": {
                                                                    "body": {
                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.maps.findWithDefault"}, "type": {"literal": {"integer": "int32"}}}},
                                                                    "type": {"literal": {"integer": "int32"}}}},
                                                                "argument": {"variable": "hydra.core.constants.maxInt32"}}},
                                                            "argument": {"variable": "v"}}},
                                                        "argument": {
                                                          "application": {
                                                            "function": {"project": {"typeName": "hydra.core.topology.TarjanState", "fieldName": "lowLinks"}},
                                                            "argument": {"variable": "stAfterNeighbors"}}}}},
                                                    "typeScheme": {"variables": [], "body": {"literal": {"integer": "int32"}}, "constraints": []}}],
                                                "body": {
                                                  "let": {
                                                    "bindings": [
                                                      {
                                                        "name": "idx_v",
                                                        "term": {
                                                          "application": {
                                                            "function": {
                                                              "application": {
                                                                "function": {
                                                                  "application": {
                                                                    "function": {
                                                                      "typeApplication": {
                                                                        "body": {
                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.maps.findWithDefault"}, "type": {"literal": {"integer": "int32"}}}},
                                                                        "type": {"literal": {"integer": "int32"}}}},
                                                                    "argument": {"variable": "hydra.core.constants.maxInt32"}}},
                                                                "argument": {"variable": "v"}}},
                                                            "argument": {
                                                              "application": {
                                                                "function": {"project": {"typeName": "hydra.core.topology.TarjanState", "fieldName": "indices"}},
                                                                "argument": {"variable": "stAfterNeighbors"}}}}},
                                                        "typeScheme": {"variables": [], "body": {"literal": {"integer": "int32"}}, "constraints": []}}],
                                                    "body": {
                                                      "application": {
                                                        "function": {
                                                          "application": {
                                                            "function": {
                                                              "application": {
                                                                "function": {
                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.logic.ifElse"}, "type": {"variable": "hydra.core.topology.TarjanState"}}},
                                                                "argument": {
                                                                  "application": {
                                                                    "function": {
                                                                      "application": {
                                                                        "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.equality.equal"}, "type": {"literal": {"integer": "int32"}}}},
                                                                        "argument": {"variable": "low_v"}}},
                                                                    "argument": {"variable": "idx_v"}}}}},
                                                            "argument": {
                                                              "let": {
                                                                "bindings": [
                                                                  {
                                                                    "name": "compResult",
                                                                    "term": {
                                                                      "application": {
                                                                        "function": {"application": {"function": {"variable": "hydra.core.sorting.popStackUntil"}, "argument": {"variable": "v"}}},
                                                                        "argument": {"variable": "stAfterNeighbors"}}},
                                                                    "typeScheme": {
                                                                      "variables": [],
                                                                      "body": {
                                                                        "pair": {"first": {"list": {"literal": {"integer": "int32"}}}, "second": {"variable": "hydra.core.topology.TarjanState"}}},
                                                                      "constraints": []}}],
                                                                "body": {
                                                                  "let": {
                                                                    "bindings": [
                                                                      {
                                                                        "name": "comp",
                                                                        "term": {
                                                                          "application": {
                                                                            "function": {
                                                                              "typeApplication": {
                                                                                "body": {
                                                                                  "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.first"}, "type": {"list": {"literal": {"integer": "int32"}}}}},
                                                                                "type": {"variable": "hydra.core.topology.TarjanState"}}},
                                                                            "argument": {"variable": "compResult"}}},
                                                                        "typeScheme": {"variables": [], "body": {"list": {"literal": {"integer": "int32"}}}, "constraints": []}}],
                                                                    "body": {
                                                                      "let": {
                                                                        "bindings": [
                                                                          {
                                                                            "name": "stPopped",
                                                                            "term": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "typeApplication": {
                                                                                    "body": {
                                                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.pairs.second"}, "type": {"list": {"literal": {"integer": "int32"}}}}},
                                                                                    "type": {"variable": "hydra.core.topology.TarjanState"}}},
                                                                                "argument": {"variable": "compResult"}}},
                                                                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.topology.TarjanState"}, "constraints": []}}],
                                                                        "body": {
                                                                          "record": {
                                                                            "typeName": "hydra.core.topology.TarjanState",
                                                                            "fields": [
                                                                              {
                                                                                "name": "counter",
                                                                                "term": {
                                                                                  "application": {
                                                                                    "function": {"project": {"typeName": "hydra.core.topology.TarjanState", "fieldName": "counter"}},
                                                                                    "argument": {"variable": "stPopped"}}}},
                                                                              {
                                                                                "name": "indices",
                                                                                "term": {
                                                                                  "application": {
                                                                                    "function": {"project": {"typeName": "hydra.core.topology.TarjanState", "fieldName": "indices"}},
                                                                                    "argument": {"variable": "stPopped"}}}},
                                                                              {
                                                                                "name": "lowLinks",
                                                                                "term": {
                                                                                  "application": {
                                                                                    "function": {"project": {"typeName": "hydra.core.topology.TarjanState", "fieldName": "lowLinks"}},
                                                                                    "argument": {"variable": "stPopped"}}}},
                                                                              {
                                                                                "name": "stack",
                                                                                "term": {
                                                                                  "application": {
                                                                                    "function": {"project": {"typeName": "hydra.core.topology.TarjanState", "fieldName": "stack"}},
                                                                                    "argument": {"variable": "stPopped"}}}},
                                                                              {
                                                                                "name": "onStack",
                                                                                "term": {
                                                                                  "application": {
                                                                                    "function": {"project": {"typeName": "hydra.core.topology.TarjanState", "fieldName": "onStack"}},
                                                                                    "argument": {"variable": "stPopped"}}}},
                                                                              {
                                                                                "name": "sccs",
                                                                                "term": {
                                                                                  "application": {
                                                                                    "function": {
                                                                                      "application": {
                                                                                        "function": {
                                                                                          "typeApplication": {"body": {"variable": "hydra.core.lib.lists.cons"}, "type": {"list": {"literal": {"integer": "int32"}}}}},
                                                                                        "argument": {"variable": "comp"}}},
                                                                                    "argument": {
                                                                                      "application": {
                                                                                        "function": {"project": {"typeName": "hydra.core.topology.TarjanState", "fieldName": "sccs"}},
                                                                                        "argument": {"variable": "stPopped"}}}}}}]}}}}}}}}}},
                                                        "argument": {"variable": "stAfterNeighbors"}}}}}}}}}}}}}}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {"literal": {"string": "Visit a vertex and recursively explore its successors"}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.sorting.stronglyConnectedComponents",
        "signature": {
          "typeParameters": [],
          "parameters": [
            {
              "name": "arg0",
              "type": {"map": {"keys": {"literal": {"integer": "int32"}}, "values": {"list": {"literal": {"integer": "int32"}}}}},
              "isLazy": false}],
          "result": {"type": {"list": {"list": {"literal": {"integer": "int32"}}}}}},
        "body": {
          "annotated": {
            "body": {
              "lambda": {
                "parameter": "graph",
                "domain": {"map": {"keys": {"literal": {"integer": "int32"}}, "values": {"list": {"literal": {"integer": "int32"}}}}},
                "body": {
                  "let": {
                    "bindings": [
                      {
                        "name": "verts",
                        "term": {
                          "application": {
                            "function": {
                              "typeApplication": {
                                "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.keys"}, "type": {"literal": {"integer": "int32"}}}},
                                "type": {"list": {"literal": {"integer": "int32"}}}}},
                            "argument": {"variable": "graph"}}},
                        "typeScheme": {"variables": [], "body": {"list": {"literal": {"integer": "int32"}}}, "constraints": []}}],
                    "body": {
                      "let": {
                        "bindings": [
                          {
                            "name": "finalState",
                            "term": {
                              "application": {
                                "function": {
                                  "application": {
                                    "function": {
                                      "application": {
                                        "function": {
                                          "typeApplication": {
                                            "body": {
                                              "typeApplication": {"body": {"variable": "hydra.core.lib.lists.foldl"}, "type": {"variable": "hydra.core.topology.TarjanState"}}},
                                            "type": {"literal": {"integer": "int32"}}}},
                                        "argument": {
                                          "lambda": {
                                            "parameter": "st",
                                            "domain": {"variable": "hydra.core.topology.TarjanState"},
                                            "body": {
                                              "lambda": {
                                                "parameter": "v",
                                                "domain": {"literal": {"integer": "int32"}},
                                                "body": {
                                                  "application": {
                                                    "function": {
                                                      "application": {
                                                        "function": {
                                                          "application": {
                                                            "function": {
                                                              "typeApplication": {"body": {"variable": "hydra.core.lib.logic.ifElse"}, "type": {"variable": "hydra.core.topology.TarjanState"}}},
                                                            "argument": {
                                                              "application": {
                                                                "function": {
                                                                  "application": {
                                                                    "function": {
                                                                      "typeApplication": {
                                                                        "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.member"}, "type": {"literal": {"integer": "int32"}}}},
                                                                        "type": {"literal": {"integer": "int32"}}}},
                                                                    "argument": {"variable": "v"}}},
                                                                "argument": {
                                                                  "application": {
                                                                    "function": {"project": {"typeName": "hydra.core.topology.TarjanState", "fieldName": "indices"}},
                                                                    "argument": {"variable": "st"}}}}}}},
                                                        "argument": {"variable": "st"}}},
                                                    "argument": {
                                                      "application": {
                                                        "function": {
                                                          "application": {
                                                            "function": {"application": {"function": {"variable": "hydra.core.sorting.strongConnect"}, "argument": {"variable": "graph"}}},
                                                            "argument": {"variable": "v"}}},
                                                        "argument": {"variable": "st"}}}}}}}}}}},
                                    "argument": {"variable": "hydra.core.sorting.initialState"}}},
                                "argument": {"variable": "verts"}}},
                            "typeScheme": {"variables": [], "body": {"variable": "hydra.core.topology.TarjanState"}, "constraints": []}}],
                        "body": {
                          "application": {
                            "function": {
                              "typeApplication": {"body": {"variable": "hydra.core.lib.lists.reverse"}, "type": {"list": {"literal": {"integer": "int32"}}}}},
                            "argument": {
                              "application": {
                                "function": {
                                  "application": {
                                    "function": {
                                      "typeApplication": {
                                        "body": {
                                          "typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"list": {"literal": {"integer": "int32"}}}}},
                                        "type": {"list": {"literal": {"integer": "int32"}}}}},
                                    "argument": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.sort"}, "type": {"literal": {"integer": "int32"}}}}}},
                                "argument": {
                                  "application": {
                                    "function": {"project": {"typeName": "hydra.core.topology.TarjanState", "fieldName": "sccs"}},
                                    "argument": {"variable": "finalState"}}}}}}}}}}}}},
            "annotation": {
              "map": [
                {
                  "key": {"variable": "description"},
                  "value": {
                    "literal": {
                      "string": "Compute the strongly connected components of the given graph. The components are returned in reverse topological order"}}}]}}}}},
    {
      "term": {
        "name": "hydra.core.sorting.topologicalSort",
        "signature": {
          "typeParameters": [{"name": "t0", "constraints": [{"simple": "ordering"}]}],
          "parameters": [
            {
              "name": "arg0",
              "type": {"list": {"pair": {"first": {"variable": "t0"}, "second": {"list": {"variable": "t0"}}}}},
              "isLazy": false}],
          "result": {"type": {"either": {"left": {"list": {"list": {"variable": "t0"}}}, "right": {"list": {"variable": "t0"}}}}}},
        "body": {
          "typeLambda": {
            "parameter": "t0",
            "body": {
              "annotated": {
                "body": {
                  "lambda": {
                    "parameter": "pairs",
                    "domain": {"list": {"pair": {"first": {"variable": "t0"}, "second": {"list": {"variable": "t0"}}}}},
                    "body": {
                      "let": {
                        "bindings": [
                          {
                            "name": "sccs",
                            "term": {
                              "application": {
                                "function": {"typeApplication": {"body": {"variable": "hydra.core.sorting.topologicalSortComponents"}, "type": {"variable": "t0"}}},
                                "argument": {"variable": "pairs"}}},
                            "typeScheme": {"variables": [], "body": {"list": {"list": {"variable": "t0"}}}, "constraints": []}}],
                        "body": {
                          "let": {
                            "bindings": [
                              {
                                "name": "isCycle",
                                "term": {
                                  "typeLambda": {
                                    "parameter": "t1",
                                    "body": {
                                      "lambda": {
                                        "parameter": "scc",
                                        "domain": {"list": {"variable": "t1"}},
                                        "body": {
                                          "application": {
                                            "function": {
                                              "application": {
                                                "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.ordering.gt"}, "type": {"literal": {"integer": "int32"}}}},
                                                "argument": {
                                                  "application": {
                                                    "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.length"}, "type": {"variable": "t1"}}},
                                                    "argument": {"variable": "scc"}}}}},
                                            "argument": {"literal": {"integer": {"int32": 1}}}}}}}}},
                                "typeScheme": {
                                  "variables": ["t1"],
                                  "body": {"function": {"domain": {"list": {"variable": "t1"}}, "codomain": {"literal": "boolean"}}},
                                  "constraints": [{"key": "t1", "value": {"classes": []}}]}}],
                            "body": {
                              "let": {
                                "bindings": [
                                  {
                                    "name": "withCycles",
                                    "term": {
                                      "application": {
                                        "function": {
                                          "application": {
                                            "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.filter"}, "type": {"list": {"variable": "t0"}}}},
                                            "argument": {"typeApplication": {"body": {"variable": "isCycle"}, "type": {"variable": "t0"}}}}},
                                        "argument": {"variable": "sccs"}}},
                                    "typeScheme": {"variables": [], "body": {"list": {"list": {"variable": "t0"}}}, "constraints": []}}],
                                "body": {
                                  "application": {
                                    "function": {
                                      "application": {
                                        "function": {
                                          "application": {
                                            "function": {
                                              "typeApplication": {
                                                "body": {"variable": "hydra.core.lib.logic.ifElse"},
                                                "type": {"either": {"left": {"list": {"list": {"variable": "t0"}}}, "right": {"list": {"variable": "t0"}}}}}},
                                            "argument": {
                                              "application": {
                                                "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.isEmpty"}, "type": {"list": {"variable": "t0"}}}},
                                                "argument": {"variable": "withCycles"}}}}},
                                        "argument": {
                                          "typeApplication": {
                                            "body": {
                                              "typeApplication": {
                                                "body": {
                                                  "either": {
                                                    "right": {
                                                      "application": {
                                                        "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.concat"}, "type": {"variable": "t0"}}},
                                                        "argument": {"variable": "sccs"}}}}},
                                                "type": {"list": {"list": {"variable": "t0"}}}}},
                                            "type": {"list": {"variable": "t0"}}}}}},
                                    "argument": {
                                      "typeApplication": {
                                        "body": {
                                          "typeApplication": {"body": {"either": {"left": {"variable": "withCycles"}}}, "type": {"list": {"list": {"variable": "t0"}}}}},
                                        "type": {"list": {"variable": "t0"}}}}}}}}}}}}}},
                "annotation": {
                  "map": [
                    {
                      "key": {"variable": "description"},
                      "value": {
                        "literal": {
                          "string": "Sort a directed acyclic graph (DAG) based on an adjacency list. Yields a list of nontrivial strongly connected components if the graph has cycles, otherwise a simple list."}}}]}}}}}}},
    {
      "term": {
        "name": "hydra.core.sorting.topologicalSortComponents",
        "signature": {
          "typeParameters": [{"name": "t0", "constraints": [{"simple": "ordering"}]}],
          "parameters": [
            {
              "name": "arg0",
              "type": {"list": {"pair": {"first": {"variable": "t0"}, "second": {"list": {"variable": "t0"}}}}},
              "isLazy": false}],
          "result": {"type": {"list": {"list": {"variable": "t0"}}}}},
        "body": {
          "typeLambda": {
            "parameter": "t0",
            "body": {
              "annotated": {
                "body": {
                  "lambda": {
                    "parameter": "pairs",
                    "domain": {"list": {"pair": {"first": {"variable": "t0"}, "second": {"list": {"variable": "t0"}}}}},
                    "body": {
                      "let": {
                        "bindings": [
                          {
                            "name": "graphResult",
                            "term": {
                              "application": {
                                "function": {"typeApplication": {"body": {"variable": "hydra.core.sorting.adjacencyListsToGraph"}, "type": {"variable": "t0"}}},
                                "argument": {"variable": "pairs"}}},
                            "typeScheme": {
                              "variables": [],
                              "body": {
                                "pair": {
                                  "first": {"map": {"keys": {"literal": {"integer": "int32"}}, "values": {"list": {"literal": {"integer": "int32"}}}}},
                                  "second": {"function": {"domain": {"literal": {"integer": "int32"}}, "codomain": {"optional": {"variable": "t0"}}}}}},
                              "constraints": []}}],
                        "body": {
                          "let": {
                            "bindings": [
                              {
                                "name": "g",
                                "term": {
                                  "application": {
                                    "function": {
                                      "typeApplication": {
                                        "body": {
                                          "typeApplication": {
                                            "body": {"variable": "hydra.core.lib.pairs.first"},
                                            "type": {"map": {"keys": {"literal": {"integer": "int32"}}, "values": {"list": {"literal": {"integer": "int32"}}}}}}},
                                        "type": {"function": {"domain": {"literal": {"integer": "int32"}}, "codomain": {"optional": {"variable": "t0"}}}}}},
                                    "argument": {"variable": "graphResult"}}},
                                "typeScheme": {
                                  "variables": [],
                                  "body": {"map": {"keys": {"literal": {"integer": "int32"}}, "values": {"list": {"literal": {"integer": "int32"}}}}},
                                  "constraints": []}}],
                            "body": {
                              "application": {
                                "function": {
                                  "application": {
                                    "function": {
                                      "typeApplication": {
                                        "body": {
                                          "typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"list": {"literal": {"integer": "int32"}}}}},
                                        "type": {"list": {"variable": "t0"}}}},
                                    "argument": {
                                      "lambda": {
                                        "parameter": "comp",
                                        "domain": {"list": {"literal": {"integer": "int32"}}},
                                        "body": {
                                          "application": {
                                            "function": {
                                              "application": {
                                                "function": {
                                                  "typeApplication": {
                                                    "body": {
                                                      "typeApplication": {"body": {"variable": "hydra.core.lib.optionals.mapOptional"}, "type": {"literal": {"integer": "int32"}}}},
                                                    "type": {"variable": "t0"}}},
                                                "argument": {
                                                  "application": {
                                                    "function": {
                                                      "typeApplication": {
                                                        "body": {
                                                          "typeApplication": {
                                                            "body": {"variable": "hydra.core.lib.pairs.second"},
                                                            "type": {"map": {"keys": {"literal": {"integer": "int32"}}, "values": {"list": {"literal": {"integer": "int32"}}}}}}},
                                                        "type": {"function": {"domain": {"literal": {"integer": "int32"}}, "codomain": {"optional": {"variable": "t0"}}}}}},
                                                    "argument": {"variable": "graphResult"}}}}},
                                            "argument": {"variable": "comp"}}}}}}},
                                "argument": {
                                  "application": {"function": {"variable": "hydra.core.sorting.stronglyConnectedComponents"}, "argument": {"variable": "g"}}}}}}}}}}},
                "annotation": {
                  "map": [
                    {
                      "key": {"variable": "description"},
                      "value": {
                        "literal": {
                          "string": "Find the strongly connected components (including cycles and isolated vertices) of a graph, in (reverse) topological order, i.e. dependencies before dependents"}}}]}}}}}}},
    {
      "term": {
        "name": "hydra.core.sorting.topologicalSortNodes",
        "signature": {
          "typeParameters": [{"name": "t0", "constraints": []}, {"name": "t1", "constraints": [{"simple": "ordering"}]}],
          "parameters": [
            {"name": "arg0", "type": {"function": {"domain": {"variable": "t0"}, "codomain": {"variable": "t1"}}}, "isLazy": false},
            {
              "name": "arg1",
              "type": {"function": {"domain": {"variable": "t0"}, "codomain": {"list": {"variable": "t1"}}}},
              "isLazy": false},
            {"name": "arg2", "type": {"list": {"variable": "t0"}}, "isLazy": false}],
          "result": {"type": {"list": {"list": {"variable": "t0"}}}}},
        "body": {
          "typeLambda": {
            "parameter": "t0",
            "body": {
              "typeLambda": {
                "parameter": "t1",
                "body": {
                  "annotated": {
                    "body": {
                      "lambda": {
                        "parameter": "getKey",
                        "domain": {"function": {"domain": {"variable": "t0"}, "codomain": {"variable": "t1"}}},
                        "body": {
                          "lambda": {
                            "parameter": "getAdj",
                            "domain": {"function": {"domain": {"variable": "t0"}, "codomain": {"list": {"variable": "t1"}}}},
                            "body": {
                              "lambda": {
                                "parameter": "nodes",
                                "domain": {"list": {"variable": "t0"}},
                                "body": {
                                  "let": {
                                    "bindings": [
                                      {
                                        "name": "nodesByKey",
                                        "term": {
                                          "application": {
                                            "function": {
                                              "typeApplication": {
                                                "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.fromList"}, "type": {"variable": "t1"}}},
                                                "type": {"variable": "t0"}}},
                                            "argument": {
                                              "application": {
                                                "function": {
                                                  "application": {
                                                    "function": {
                                                      "typeApplication": {
                                                        "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "t0"}}},
                                                        "type": {"pair": {"first": {"variable": "t1"}, "second": {"variable": "t0"}}}}},
                                                    "argument": {
                                                      "lambda": {
                                                        "parameter": "n",
                                                        "domain": {"variable": "t0"},
                                                        "body": {
                                                          "typeApplication": {
                                                            "body": {
                                                              "typeApplication": {
                                                                "body": {
                                                                  "pair": {
                                                                    "first": {"application": {"function": {"variable": "getKey"}, "argument": {"variable": "n"}}},
                                                                    "second": {"variable": "n"}}},
                                                                "type": {"variable": "t1"}}},
                                                            "type": {"variable": "t0"}}}}}}},
                                                "argument": {"variable": "nodes"}}}}},
                                        "typeScheme": {"variables": [], "body": {"map": {"keys": {"variable": "t1"}, "values": {"variable": "t0"}}}, "constraints": []}}],
                                    "body": {
                                      "let": {
                                        "bindings": [
                                          {
                                            "name": "pairs",
                                            "term": {
                                              "application": {
                                                "function": {
                                                  "application": {
                                                    "function": {
                                                      "typeApplication": {
                                                        "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "t0"}}},
                                                        "type": {"pair": {"first": {"variable": "t1"}, "second": {"list": {"variable": "t1"}}}}}},
                                                    "argument": {
                                                      "lambda": {
                                                        "parameter": "n",
                                                        "domain": {"variable": "t0"},
                                                        "body": {
                                                          "typeApplication": {
                                                            "body": {
                                                              "typeApplication": {
                                                                "body": {
                                                                  "pair": {
                                                                    "first": {"application": {"function": {"variable": "getKey"}, "argument": {"variable": "n"}}},
                                                                    "second": {"application": {"function": {"variable": "getAdj"}, "argument": {"variable": "n"}}}}},
                                                                "type": {"variable": "t1"}}},
                                                            "type": {"list": {"variable": "t1"}}}}}}}},
                                                "argument": {"variable": "nodes"}}},
                                            "typeScheme": {
                                              "variables": [],
                                              "body": {"list": {"pair": {"first": {"variable": "t1"}, "second": {"list": {"variable": "t1"}}}}},
                                              "constraints": []}}],
                                        "body": {
                                          "let": {
                                            "bindings": [
                                              {
                                                "name": "comps",
                                                "term": {
                                                  "application": {
                                                    "function": {"typeApplication": {"body": {"variable": "hydra.core.sorting.topologicalSortComponents"}, "type": {"variable": "t1"}}},
                                                    "argument": {"variable": "pairs"}}},
                                                "typeScheme": {"variables": [], "body": {"list": {"list": {"variable": "t1"}}}, "constraints": []}}],
                                            "body": {
                                              "application": {
                                                "function": {
                                                  "application": {
                                                    "function": {
                                                      "typeApplication": {
                                                        "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"list": {"variable": "t1"}}}},
                                                        "type": {"list": {"variable": "t0"}}}},
                                                    "argument": {
                                                      "lambda": {
                                                        "parameter": "c",
                                                        "domain": {"list": {"variable": "t1"}},
                                                        "body": {
                                                          "application": {
                                                            "function": {"typeApplication": {"body": {"variable": "hydra.core.lib.optionals.givens"}, "type": {"variable": "t0"}}},
                                                            "argument": {
                                                              "application": {
                                                                "function": {
                                                                  "application": {
                                                                    "function": {
                                                                      "typeApplication": {
                                                                        "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.lists.map"}, "type": {"variable": "t1"}}},
                                                                        "type": {"optional": {"variable": "t0"}}}},
                                                                    "argument": {
                                                                      "lambda": {
                                                                        "parameter": "k",
                                                                        "domain": {"variable": "t1"},
                                                                        "body": {
                                                                          "application": {
                                                                            "function": {
                                                                              "application": {
                                                                                "function": {
                                                                                  "typeApplication": {
                                                                                    "body": {"typeApplication": {"body": {"variable": "hydra.core.lib.maps.lookup"}, "type": {"variable": "t1"}}},
                                                                                    "type": {"variable": "t0"}}},
                                                                                "argument": {"variable": "k"}}},
                                                                            "argument": {"variable": "nodesByKey"}}}}}}},
                                                                "argument": {"variable": "c"}}}}}}}}},
                                                "argument": {"variable": "comps"}}}}}}}}}}}}}}},
                    "annotation": {
                      "map": [
                        {
                          "key": {"variable": "description"},
                          "value": {
                            "literal": {
                              "string": "Sort a directed acyclic graph (DAG) of nodes using two helper functions: one for node keys, and one for the adjacency list of connected node keys. The result is a list of strongly-connected components (cycles), in which singleton lists represent acyclic nodes."}}}]}}}}}}}}}]}